Skip to content

Commit

Permalink
Added support for SSML (PrismJS#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored Apr 27, 2020
1 parent cde5b0f commit eb70070
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@
},
"markup": {
"title": "Markup",
"alias": ["html", "xml", "svg", "mathml"],
"alias": ["html", "xml", "svg", "mathml", "ssml"],
"aliasTitles": {
"html": "HTML",
"xml": "XML",
"svg": "SVG",
"mathml": "MathML"
"mathml": "MathML",
"ssml": "SSML"
},
"option": "default"
},
Expand Down
10 changes: 6 additions & 4 deletions components/prism-markup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ Prism.languages.markup = {
},
'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
'tag': {
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
greedy: true,
inside: {
'tag': {
pattern: /^<\/?[^\s>\/]+/i,
pattern: /^<\/?[^\s>\/]+/,
inside: {
'punctuation': /^<\/?/,
'namespace': /^[^\s>\/:]+:/
}
},
'attr-value': {
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
inside: {
'punctuation': [
/^=/,
Expand Down Expand Up @@ -97,7 +97,9 @@ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
}
});

Prism.languages.xml = Prism.languages.extend('markup', {});
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;

Prism.languages.xml = Prism.languages.extend('markup', {});
Prism.languages.ssml = Prism.languages.xml;
2 changes: 1 addition & 1 deletion components/prism-markup.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plugins/autoloader/prism-autoloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
"xml": "markup",
"svg": "markup",
"mathml": "markup",
"ssml": "markup",
"js": "javascript",
"g4": "antlr4",
"adoc": "asciidoc",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"xml": "XML",
"svg": "SVG",
"mathml": "MathML",
"ssml": "SSML",
"css": "CSS",
"clike": "C-like",
"js": "JavaScript",
Expand Down
Loading

0 comments on commit eb70070

Please sign in to comment.