| @@ -1,4 +1,4 @@ |
| 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+perl+php+python+crystal+rust+scss+sql+typescript */ | 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+nim+perl+php+python+crystal+rust+scss+sql+typescript */ |
| 2 | var _self = (typeof window !== 'undefined') | 2 | var _self = (typeof window !== 'undefined') |
| 3 | ? window // if in browser | 3 | ? window // if in browser |
| 4 | : ( | 4 | : ( |
| @@ -568,6 +568,9 @@ Prism.languages.markup = { · 563 unmodified lines |
| 568 | 'entity': /&#?[\da-z]{1,8};/i | 568 | 'entity': /&#?[\da-z]{1,8};/i |
| 569 | }; | 569 | }; |
| 570 | | 570 | |
| | 571 | Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = |
| | 572 | Prism.languages.markup['entity']; |
| | 573 | |
| 571 | // Plugin to make entity title show the real entity, idea by Roman Komarov | 574 | // Plugin to make entity title show the real entity, idea by Roman Komarov |
| 572 | Prism.hooks.add('wrap', function(env) { | 575 | Prism.hooks.add('wrap', function(env) { |
| 573 | | 576 | |
| @@ -664,7 +667,7 @@ Prism.languages.clike = { · 90 unmodified lines |
| 664 | | 667 | |
| 665 | Prism.languages.javascript = Prism.languages.extend('clike', { | 668 | Prism.languages.javascript = Prism.languages.extend('clike', { |
| 666 | '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/, | 669 | '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/, |
| 667 | 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/, | 670 | 'number': /\b-?(0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/, |
| 668 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) | 671 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) |
| 669 | 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i, | 672 | 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i, |
| 670 | 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ | 673 | 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ |
| @@ -672,7 +675,7 @@ Prism.languages.javascript = Prism.languages.extend('clike', { · 1 unmodified line |
| 672 | | 675 | |
| 673 | Prism.languages.insertBefore('javascript', 'keyword', { | 676 | Prism.languages.insertBefore('javascript', 'keyword', { |
| 674 | 'regex': { | 677 | 'regex': { |
| 675 | pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, | 678 | pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, |
| 676 | lookbehind: true, | 679 | lookbehind: true, |
| 677 | greedy: true | 680 | greedy: true |
| 678 | } | 681 | } |
| @@ -710,6 +713,7 @@ if (Prism.languages.markup) { · 31 unmodified lines |
| 710 | } | 713 | } |
| 711 | | 714 | |
| 712 | Prism.languages.js = Prism.languages.javascript; | 715 | Prism.languages.js = Prism.languages.javascript; |
| | 716 | |
| 713 | Prism.languages.c = Prism.languages.extend('clike', { | 717 | Prism.languages.c = Prism.languages.extend('clike', { |
| 714 | 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/, | 718 | 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/, |
| 715 | 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/, | 719 | 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/, |
| @@ -1245,6 +1249,39 @@ Prism.languages.nginx = Prism.languages.extend('clike', { · 529 unmodified lines |
| 1245 | Prism.languages.insertBefore('nginx', 'keyword', { | 1249 | Prism.languages.insertBefore('nginx', 'keyword', { |
| 1246 | 'variable': /\$[a-z_]+/i | 1250 | 'variable': /\$[a-z_]+/i |
| 1247 | }); | 1251 | }); |
| | 1252 | Prism.languages.nim = { |
| | 1253 | 'comment': /#.*/, |
| | 1254 | // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals) |
| | 1255 | // Character literals are handled specifically to prevent issues with numeric type suffixes |
| | 1256 | 'string': { |
| | 1257 | pattern: /(?:(?:\b(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")|'(?:\\(?:\d+|x[\da-fA-F]{2}|.)|[^'])')/, |
| | 1258 | greedy: true |
| | 1259 | }, |
| | 1260 | // The negative look ahead prevents wrong highlighting of the .. operator |
| | 1261 | 'number': /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/, |
| | 1262 | 'keyword': /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/, |
| | 1263 | 'function': { |
| | 1264 | pattern: /(?:(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/, |
| | 1265 | inside: { |
| | 1266 | 'operator': /\*$/ |
| | 1267 | } |
| | 1268 | }, |
| | 1269 | // We don't want to highlight operators inside backticks |
| | 1270 | 'ignore': { |
| | 1271 | pattern: /`[^`\r\n]+`/, |
| | 1272 | inside: { |
| | 1273 | 'punctuation': /`/ |
| | 1274 | } |
| | 1275 | }, |
| | 1276 | 'operator': { |
| | 1277 | // Look behind and look ahead prevent wrong highlighting of punctuations [. .] {. .} (. .) |
| | 1278 | // but allow the slice operator .. to take precedence over them |
| | 1279 | // One can define his own operators in Nim so all combination of operators might be an operator. |
| | 1280 | pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|of|or|in|is|isnot|mod|not|notin|shl|shr|xor)\b)/m, |
| | 1281 | lookbehind: true |
| | 1282 | }, |
| | 1283 | 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/ |
| | 1284 | }; |
| 1248 | Prism.languages.perl = { | 1285 | Prism.languages.perl = { |
| 1249 | 'comment': [ | 1286 | 'comment': [ |
| 1250 | { | 1287 | { |