mirror of
https://github.com/arsenetar/PrismHighlight.git
synced 2024-11-24 04:39:01 +00:00
26 lines
839 B
JavaScript
26 lines
839 B
JavaScript
Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
'keyword': /\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,
|
|
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g
|
|
});
|
|
|
|
Prism.languages.insertBefore('javascript', 'keyword', {
|
|
'regex': {
|
|
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
|
|
lookbehind: true
|
|
}
|
|
});
|
|
|
|
if (Prism.languages.markup) {
|
|
Prism.languages.insertBefore('markup', 'tag', {
|
|
'script': {
|
|
pattern: /(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,
|
|
inside: {
|
|
'tag': {
|
|
pattern: /(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,
|
|
inside: Prism.languages.markup.tag.inside
|
|
},
|
|
rest: Prism.languages.javascript
|
|
}
|
|
}
|
|
});
|
|
} |