diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
| commit | a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch) | |
| tree | 542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-python.min.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-python.min.js')
| -rw-r--r-- | public/prism/prism-python.min.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/public/prism/prism-python.min.js b/public/prism/prism-python.min.js new file mode 100644 index 0000000..8bd9d17 --- /dev/null +++ b/public/prism/prism-python.min.js @@ -0,0 +1,57 @@ +(Prism.languages.python = { + comment: { pattern: /(^|[^\\])#.*/, lookbehind: !0, greedy: !0 }, + 'string-interpolation': { + pattern: + /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i, + greedy: !0, + inside: { + interpolation: { + pattern: + /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/, + lookbehind: !0, + inside: { + 'format-spec': { pattern: /(:)[^:(){}]+(?=\}$)/, lookbehind: !0 }, + 'conversion-option': { + pattern: //, + alias: 'punctuation', + }, + rest: null, + }, + }, + string: /[\s\S]+/, + }, + }, + 'triple-quoted-string': { + pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i, + greedy: !0, + alias: 'string', + }, + string: { + pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i, + greedy: !0, + }, + function: { + pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g, + lookbehind: !0, + }, + 'class-name': { pattern: /(\bclass\s+)\w+/i, lookbehind: !0 }, + decorator: { + pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m, + lookbehind: !0, + alias: ['annotation', 'punctuation'], + inside: { punctuation: /\./ }, + }, + keyword: + /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/, + builtin: + /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/, + boolean: /\b(?:False|None|True)\b/, + number: + /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i, + operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/, + punctuation: /[{}[\];(),.:]/, +}), + (Prism.languages.python[ + 'string-interpolation' + ].inside.interpolation.inside.rest = Prism.languages.python), + (Prism.languages.py = Prism.languages.python); |
