-
-
Save simov/2f037f7baccf8d45498e7b5dc1d90e1e to your computer and use it in GitHub Desktop.
Revisions
-
RexSkz revised this gist
Jun 10, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ Prism.languages.insertBefore('javascript', 'keyword', { } }, 'function-declaration': { pattern: /(?<=(\s|\/|^))[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?<!(if|else|for|while|switch))\b.*?\((.*?[^\)])?\)[^)\w]*?\{/, alias: 'function', inside: { 'argument': { -
RexSkz revised this gist
May 23, 2018 . 1 changed file with 25 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // current Prism.languages.javascript = Prism.languages.extend('clike', { 'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, @@ -17,8 +17,30 @@ Prism.languages.insertBefore('javascript', 'keyword', { }, // This must be declared before keyword because we use "function" inside the look-forward 'function-variable': { pattern: /([_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*|(?<=\W))?(\s*=?\s*(function\s*\([^()]*\)|(\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, alias: 'function', inside: { 'argument': { pattern: /((?<=\()[^()]*(?=\)))|((?<=\b)[^()\s]*?(?=\s*=>))/, inside: { rest: Prism.languages.javascript } }, rest: Prism.languages.javascript } }, 'function-declaration': { pattern: /(?<=(\s|\/|^))[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?<!(if|else|for|while|switch))\b.*?\((.*?[^\)])?\)[^)]*?\{/, alias: 'function', inside: { 'argument': { pattern: /((?<=\()[^()]*(?=\)))|((?<=\b)[^()\s]*?(?=\s*=>))/, inside: { rest: Prism.languages.javascript } }, rest: Prism.languages.javascript } }, 'constant': /\b[A-Z][A-Z\d_]*\b/ }); -
RexSkz created this gist
May 23, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ // original Prism.languages.javascript = Prism.languages.extend('clike', { 'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, 'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ }); Prism.languages.insertBefore('javascript', 'keyword', { 'regex': { pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, lookbehind: true, greedy: true }, // This must be declared before keyword because we use "function" inside the look-forward 'function-variable': { pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, alias: 'function' }, 'constant': /\b[A-Z][A-Z\d_]*\b/ }); Prism.languages.insertBefore('javascript', 'string', { 'template-string': { pattern: /`(?:\\[\s\S]|[^\\`])*`/, greedy: true, inside: { 'interpolation': { pattern: /\$\{[^}]+\}/, inside: { 'interpolation-punctuation': { pattern: /^\$\{|\}$/, alias: 'punctuation' }, rest: Prism.languages.javascript } }, 'string': /[\s\S]+/ } } }); if (Prism.languages.markup) { Prism.languages.insertBefore('markup', 'tag', { 'script': { pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i, lookbehind: true, inside: Prism.languages.javascript, alias: 'language-javascript', greedy: true } }); } Prism.languages.js = Prism.languages.javascript;