summaryrefslogtreecommitdiffstats
path: root/data/resources/prism/components/prism-markup.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/resources/prism/components/prism-markup.js')
-rw-r--r--data/resources/prism/components/prism-markup.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/data/resources/prism/components/prism-markup.js b/data/resources/prism/components/prism-markup.js
new file mode 100644
index 0000000..1dafd24
--- /dev/null
+++ b/data/resources/prism/components/prism-markup.js
@@ -0,0 +1,55 @@
+Prism.languages.markup = {
+ 'comment': /<!--[\s\S]*?-->/,
+ 'prolog': /<\?[\s\S]+?\?>/,
+ 'doctype': /<!DOCTYPE[\s\S]+?>/i,
+ 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
+ 'tag': {
+ pattern: /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
+ inside: {
+ 'tag': {
+ pattern: /^<\/?[^\s>\/]+/i,
+ inside: {
+ 'punctuation': /^<\/?/,
+ 'namespace': /^[^\s>\/:]+:/
+ }
+ },
+ 'attr-value': {
+ pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
+ inside: {
+ 'punctuation': [
+ /^=/,
+ {
+ pattern: /(^|[^\\])["']/,
+ lookbehind: true
+ }
+ ]
+ }
+ },
+ 'punctuation': /\/?>/,
+ 'attr-name': {
+ pattern: /[^\s>\/]+/,
+ inside: {
+ 'namespace': /^[^\s>\/:]+:/
+ }
+ }
+
+ }
+ },
+ 'entity': /&#?[\da-z]{1,8};/i
+};
+
+Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
+ Prism.languages.markup['entity'];
+
+// Plugin to make entity title show the real entity, idea by Roman Komarov
+Prism.hooks.add('wrap', function(env) {
+
+ if (env.type === 'entity') {
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
+ }
+});
+
+Prism.languages.xml = Prism.languages.markup;
+Prism.languages.html = Prism.languages.markup;
+Prism.languages.mathml = Prism.languages.markup;
+Prism.languages.svg = Prism.languages.markup;