12345678910111213141516171819202122232425262728 |
- 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/,
- 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/,
- 'function': /(?!\d)[a-z0-9_$]+(?=\()/i
- });
- Prism.languages.insertBefore('javascript', 'keyword', {
- 'regex': {
- pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
- lookbehind: true
- }
- });
- if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'script': {
- pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/i,
- inside: {
- 'tag': {
- pattern: /<script[\w\W]*?>|<\/script>/i,
- inside: Prism.languages.markup.tag.inside
- },
- rest: Prism.languages.javascript
- },
- alias: 'language-javascript'
- }
- });
- }
|