mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
28 lines
859 B
JavaScript
28 lines
859 B
JavaScript
(function(Prism) {
|
|
|
|
var javascript = Prism.util.clone(Prism.languages.javascript);
|
|
|
|
Prism.languages.jsx = Prism.languages.extend('markup', javascript);
|
|
Prism.languages.jsx.tag.pattern= /<\/?[\w\.:-]+\s*(?:\s+[\w\.:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i;
|
|
|
|
Prism.languages.jsx.tag.inside['attr-value'].pattern = /=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i;
|
|
|
|
var jsxExpression = Prism.util.clone(Prism.languages.jsx);
|
|
|
|
delete jsxExpression.punctuation
|
|
|
|
jsxExpression = Prism.languages.insertBefore('jsx', 'operator', {
|
|
'punctuation': /=(?={)|[{}[\];(),.:]/
|
|
}, { jsx: jsxExpression });
|
|
|
|
Prism.languages.insertBefore('inside', 'attr-value',{
|
|
'script': {
|
|
// Allow for one level of nesting
|
|
pattern: /=(\{(?:\{[^}]*\}|[^}])+\})/i,
|
|
inside: jsxExpression,
|
|
'alias': 'language-javascript'
|
|
}
|
|
}, Prism.languages.jsx.tag);
|
|
|
|
}(Prism));
|