From 849a8ab4fa04094650e4a5470f98fe62b714837d Mon Sep 17 00:00:00 2001 From: w3suli Date: Sun, 10 Nov 2019 14:47:08 +0100 Subject: [PATCH 1/5] enh(xml) support for highlighting entities (#2260) --- CHANGES.md | 2 ++ src/languages/xml.js | 13 ++++++++++--- test/markup/twig/template_tags.expect.txt | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index dda7020b19..d93baf79ab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ New styles: none. Improvements: +- enh(xml) support for highlighting entities (#2260) [w3suli][] - enh(gml) fix naming of keyword class (consistency fix) (#2254) [Liam Nobel][] - enh(javascript): Add support for jsdoc comments (#2245) [Milutin Kristofic][] - ehh(build) Add CI check for building a "use strict" safe rollup package from NPM builds (#2247) [Josh Goebel][] @@ -23,6 +24,7 @@ Improvements: [Liam Nobel]: https://github.com/liamnobel [Carl Baxter]: https://github.com/cdbax [Milutin Kristofic]: https://github.com/milutin +[w3suli]: https://github.com/w3suli ## Version 9.16.2 diff --git a/src/languages/xml.js b/src/languages/xml.js index 1f16442735..3eb47ed10b 100644 --- a/src/languages/xml.js +++ b/src/languages/xml.js @@ -6,6 +6,10 @@ Category: common function(hljs) { var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; + var XML_ENTITIES = { + className: 'symbol', + begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;' + }; var TAG_INTERNALS = { endsWithParent: true, illegal: /`]+/} ] } @@ -41,7 +45,9 @@ function(hljs) { className: 'meta', begin: '', relevance: 10, - contains: [{begin: '\\[', end: '\\]'}] + contains: [ + {begin: '\\[', end: '\\]'} + ] }, hljs.COMMENT( '