You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
10 years ago
|
Prism.languages.javascript = Prism.languages.extend('clike', {
|
||
|
'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,
|
||
|
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,
|
||
|
'function': /(?!\d)[a-z0-9_$]+(?=\()/ig
|
||
|
});
|
||
|
|
||
|
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
|
||
|
},
|
||
|
alias: 'language-javascript'
|
||
|
}
|
||
|
});
|
||
|
}
|