From eaa28f4d0d366bfec7919a412abf59f627fab3d3 Mon Sep 17 00:00:00 2001 From: Ekaitz Zárraga Date: Thu, 9 May 2019 15:20:18 +0200 Subject: Syntax highlighting on client (optional JS) --- themes/elenq/static/css/prism.css | 111 ++++ themes/elenq/static/css/style.css | 26 +- themes/elenq/static/js/prism.js | 1329 +++++++++++++++++++++++++++++++++++++ themes/elenq/templates/base.html | 3 + 4 files changed, 1454 insertions(+), 15 deletions(-) create mode 100644 themes/elenq/static/css/prism.css create mode 100644 themes/elenq/static/js/prism.js (limited to 'themes') diff --git a/themes/elenq/static/css/prism.css b/themes/elenq/static/css/prism.css new file mode 100644 index 0000000..cc87b8d --- /dev/null +++ b/themes/elenq/static/css/prism.css @@ -0,0 +1,111 @@ +/* PrismJS 1.16.0 +https://prismjs.com/download.html#themes=prism&languages=bash+clojure+latex+lisp+lua+makefile+perl+sql+python+scheme+yaml */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + * + * Edited by Ekaitz Zarraga to make it fit in ElenQ Technology style. + */ + +code[class*="language-"], +pre[class*="language-"] { + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/themes/elenq/static/css/style.css b/themes/elenq/static/css/style.css index c8efd73..3b52122 100644 --- a/themes/elenq/static/css/style.css +++ b/themes/elenq/static/css/style.css @@ -96,7 +96,7 @@ hr.short{ z-index: 99; border-top: 1px solid #eee; border-bottom: 1px solid #eee; - margin-bottom: 3ex; + margin-bottom: 6.5rem; } .navbar { width: 100%; @@ -125,22 +125,9 @@ hr.short{ } -/* Large devices everything inline and the header floating fixed on top +/* Large devices everything inline and the header floating */ @media (min-width: 801px) { - .mainheader{ - position: fixed; - height: 6.5rem; - } - - /* Push content down, because the header is floating over it */ - .content:before{ - display: block; - content: " "; - height: 10rem; - visibility: hidden; - } - .link-right { margin-left: 15px; margin-right: 0px; @@ -348,3 +335,12 @@ li{ font-style: normal; } } + + +/* Code rendering + */ +pre > code { + overflow: auto; + border: none; + border-radius: 0; +} diff --git a/themes/elenq/static/js/prism.js b/themes/elenq/static/js/prism.js new file mode 100644 index 0000000..c7c897f --- /dev/null +++ b/themes/elenq/static/js/prism.js @@ -0,0 +1,1329 @@ +/* PrismJS 1.16.0 +https://prismjs.com/download.html#themes=prism&languages=bash+clojure+latex+lisp+lua+makefile+perl+sql+python+scheme+yaml */ +var _self = (typeof window !== 'undefined') + ? window // if in browser + : ( + (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) + ? self // if in worker + : {} // if in node js + ); + +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * MIT license http://www.opensource.org/licenses/mit-license.php/ + * @author Lea Verou http://lea.verou.me + */ + +var Prism = (function (_self){ + +// Private helper vars +var lang = /\blang(?:uage)?-([\w-]+)\b/i; +var uniqueId = 0; + +var _ = { + manual: _self.Prism && _self.Prism.manual, + disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, + util: { + encode: function (tokens) { + if (tokens instanceof Token) { + return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); + } else if (Array.isArray(tokens)) { + return tokens.map(_.util.encode); + } else { + return tokens.replace(/&/g, '&').replace(/ text.length) { + // Something went terribly wrong, ABORT, ABORT! + return; + } + + if (str instanceof Token) { + continue; + } + + if (greedy && i != strarr.length - 1) { + pattern.lastIndex = pos; + var match = pattern.exec(text); + if (!match) { + break; + } + + var from = match.index + (lookbehind ? match[1].length : 0), + to = match.index + match[0].length, + k = i, + p = pos; + + for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { + p += strarr[k].length; + // Move the index i to the element in strarr that is closest to from + if (from >= p) { + ++i; + pos = p; + } + } + + // If strarr[i] is a Token, then the match starts inside another Token, which is invalid + if (strarr[i] instanceof Token) { + continue; + } + + // Number of tokens to delete and replace with the new match + delNum = k - i; + str = text.slice(pos, p); + match.index -= pos; + } else { + pattern.lastIndex = 0; + + var match = pattern.exec(str), + delNum = 1; + } + + if (!match) { + if (oneshot) { + break; + } + + continue; + } + + if(lookbehind) { + lookbehindLength = match[1] ? match[1].length : 0; + } + + var from = match.index + lookbehindLength, + match = match[0].slice(lookbehindLength), + to = from + match.length, + before = str.slice(0, from), + after = str.slice(to); + + var args = [i, delNum]; + + if (before) { + ++i; + pos += before.length; + args.push(before); + } + + var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); + + args.push(wrapped); + + if (after) { + args.push(after); + } + + Array.prototype.splice.apply(strarr, args); + + if (delNum != 1) + _.matchGrammar(text, strarr, grammar, i, pos, true, token); + + if (oneshot) + break; + } + } + } + }, + + tokenize: function(text, grammar) { + var strarr = [text]; + + var rest = grammar.rest; + + if (rest) { + for (var token in rest) { + grammar[token] = rest[token]; + } + + delete grammar.rest; + } + + _.matchGrammar(text, strarr, grammar, 0, 0, false); + + return strarr; + }, + + hooks: { + all: {}, + + add: function (name, callback) { + var hooks = _.hooks.all; + + hooks[name] = hooks[name] || []; + + hooks[name].push(callback); + }, + + run: function (name, env) { + var callbacks = _.hooks.all[name]; + + if (!callbacks || !callbacks.length) { + return; + } + + for (var i=0, callback; callback = callbacks[i++];) { + callback(env); + } + } + }, + + Token: Token +}; + +_self.Prism = _; + +function Token(type, content, alias, matchedStr, greedy) { + this.type = type; + this.content = content; + this.alias = alias; + // Copy of the full string this token was created from + this.length = (matchedStr || "").length|0; + this.greedy = !!greedy; +} + +Token.stringify = function(o, language) { + if (typeof o == 'string') { + return o; + } + + if (Array.isArray(o)) { + return o.map(function(element) { + return Token.stringify(element, language); + }).join(''); + } + + var env = { + type: o.type, + content: Token.stringify(o.content, language), + tag: 'span', + classes: ['token', o.type], + attributes: {}, + language: language + }; + + if (o.alias) { + var aliases = Array.isArray(o.alias) ? o.alias : [o.alias]; + Array.prototype.push.apply(env.classes, aliases); + } + + _.hooks.run('wrap', env); + + var attributes = Object.keys(env.attributes).map(function(name) { + return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; + }).join(' '); + + return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; +}; + +if (!_self.document) { + if (!_self.addEventListener) { + // in Node.js + return _; + } + + if (!_.disableWorkerMessageHandler) { + // In worker + _self.addEventListener('message', function (evt) { + var message = JSON.parse(evt.data), + lang = message.language, + code = message.code, + immediateClose = message.immediateClose; + + _self.postMessage(_.highlight(code, _.languages[lang], lang)); + if (immediateClose) { + _self.close(); + } + }, false); + } + + return _; +} + +//Get current script and highlight +var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); + +if (script) { + _.filename = script.src; + + if (!_.manual && !script.hasAttribute('data-manual')) { + if(document.readyState !== "loading") { + if (window.requestAnimationFrame) { + window.requestAnimationFrame(_.highlightAll); + } else { + window.setTimeout(_.highlightAll, 16); + } + } + else { + document.addEventListener('DOMContentLoaded', _.highlightAll); + } + } +} + +return _; + +})(_self); + +if (typeof module !== 'undefined' && module.exports) { + module.exports = Prism; +} + +// hack for components to work correctly in node.js +if (typeof global !== 'undefined') { + global.Prism = Prism; +} +; +(function(Prism) { + var insideString = { + variable: [ + // Arithmetic Environment + { + pattern: /\$?\(\([\s\S]+?\)\)/, + inside: { + // If there is a $ sign at the beginning highlight $(( and )) as variable + variable: [{ + pattern: /(^\$\(\([\s\S]+)\)\)/, + lookbehind: true + }, + /^\$\(\(/ + ], + number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, + // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic + operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/, + // If there is no $ sign at the beginning highlight (( and )) as punctuation + punctuation: /\(\(?|\)\)?|,|;/ + } + }, + // Command Substitution + { + pattern: /\$\([^)]+\)|`[^`]+`/, + greedy: true, + inside: { + variable: /^\$\(|^`|\)$|`$/ + } + }, + /\$(?:[\w#?*!@]+|\{[^}]+\})/i + ] + }; + + Prism.languages.bash = { + 'shebang': { + pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/, + alias: 'important' + }, + 'comment': { + pattern: /(^|[^"{\\])#.*/, + lookbehind: true + }, + 'string': [ + //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document + { + pattern: /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/, + lookbehind: true, + greedy: true, + inside: insideString + }, + { + pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/, + greedy: true, + inside: insideString + } + ], + 'variable': insideString.variable, + // Originally based on http://ss64.com/bash/ + 'function': { + pattern: /(^|[\s;|&])(?:add|alias|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|hash|head|help|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logout|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tail|tar|tee|test|time|timeout|times|top|touch|tr|traceroute|trap|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zip|zypper)(?=$|[\s;|&])/, + lookbehind: true + }, + 'keyword': { + pattern: /(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/, + lookbehind: true + }, + 'boolean': { + pattern: /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/, + lookbehind: true + }, + 'operator': /&&?|\|\|?|==?|!=?|<<>|<=?|>=?|=~/, + 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/ + }; + + var inside = insideString.variable[1].inside; + inside.string = Prism.languages.bash.string; + inside['function'] = Prism.languages.bash['function']; + inside.keyword = Prism.languages.bash.keyword; + inside['boolean'] = Prism.languages.bash['boolean']; + inside.operator = Prism.languages.bash.operator; + inside.punctuation = Prism.languages.bash.punctuation; + + Prism.languages.shell = Prism.languages.bash; +})(Prism); + +// Copied from https://github.com/jeluard/prism-clojure +Prism.languages.clojure = { + comment: /;+.*/, + string: /"(?:\\.|[^\\"\r\n])*"/, + operator: /(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i, //used for symbols and keywords + keyword: { + pattern: /([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/, + lookbehind: true + }, + boolean: /\b(?:true|false|nil)\b/, + number: /\b[0-9A-Fa-f]+\b/, + punctuation: /[{}\[\](),]/ +}; + +(function(Prism) { + var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i, + insideEqu = { + 'equation-command': { + pattern: funcPattern, + alias: 'regex' + } + }; + + Prism.languages.latex = { + 'comment': /%.*/m, + // the verbatim environment prints whitespace to the document + 'cdata': { + pattern: /(\\begin\{((?:verbatim|lstlisting)\*?)\})[\s\S]*?(?=\\end\{\2\})/, + lookbehind: true + }, + /* + * equations can be between $ $ or \( \) or \[ \] + * (all are multiline) + */ + 'equation': [ + { + pattern: /\$(?:\\[\s\S]|[^\\$])*\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/, + inside: insideEqu, + alias: 'string' + }, + { + pattern: /(\\begin\{((?:equation|math|eqnarray|align|multline|gather)\*?)\})[\s\S]*?(?=\\end\{\2\})/, + lookbehind: true, + inside: insideEqu, + alias: 'string' + } + ], + /* + * arguments which are keywords or references are highlighted + * as keywords + */ + 'keyword': { + pattern: /(\\(?:begin|end|ref|cite|label|usepackage|documentclass)(?:\[[^\]]+\])?\{)[^}]+(?=\})/, + lookbehind: true + }, + 'url': { + pattern: /(\\url\{)[^}]+(?=\})/, + lookbehind: true + }, + /* + * section or chapter headlines are highlighted as bold so that + * they stand out more + */ + 'headline': { + pattern: /(\\(?:part|chapter|section|subsection|frametitle|subsubsection|paragraph|subparagraph|subsubparagraph|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\}(?:\[[^\]]+\])?)/, + lookbehind: true, + alias: 'class-name' + }, + 'function': { + pattern: funcPattern, + alias: 'selector' + }, + 'punctuation': /[[\]{}&]/ + }; +})(Prism); + +(function (Prism) { + // Functions to construct regular expressions + // simple form + // e.g. (interactive ... or (interactive) + function simple_form(name) { + return RegExp('(\\()' + name + '(?=[\\s\\)])'); + } + // booleans and numbers + function primitive(pattern) { + return RegExp('([\\s([])' + pattern + '(?=[\\s)])'); + } + + // Patterns in regular expressions + + // Symbol name. See https://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Type.html + // & and : are excluded as they are usually used for special purposes + var symbol = '[-+*/_~!@$%^=<>{}\\w]+'; + // symbol starting with & used in function arguments + var marker = '&' + symbol; + // Open parenthesis for look-behind + var par = '(\\()'; + var endpar = '(?=\\))'; + // End the pattern with look-ahead space + var space = '(?=\\s)'; + + var language = { + // Three or four semicolons are considered a heading. + // See https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html + heading: { + pattern: /;;;.*/, + alias: ['comment', 'title'] + }, + comment: /;.*/, + string: { + pattern: /"(?:[^"\\]|\\.)*"/, + greedy: true, + inside: { + argument: /[-A-Z]+(?=[.,\s])/, + symbol: RegExp('`' + symbol + "'") + } + }, + 'quoted-symbol': { + pattern: RegExp("#?'" + symbol), + alias: ['variable', 'symbol'] + }, + 'lisp-property': { + pattern: RegExp(':' + symbol), + alias: 'property' + }, + splice: { + pattern: RegExp(',@?' + symbol), + alias: ['symbol', 'variable'] + }, + keyword: [ + { + pattern: RegExp( + par + + '(?:(?:lexical-)?let\\*?|(?:cl-)?letf|if|when|while|unless|cons|cl-loop|and|or|not|cond|setq|error|message|null|require|provide|use-package)' + + space + ), + lookbehind: true + }, + { + pattern: RegExp( + par + '(?:for|do|collect|return|finally|append|concat|in|by)' + space + ), + lookbehind: true + }, + ], + declare: { + pattern: simple_form('declare'), + lookbehind: true, + alias: 'keyword' + }, + interactive: { + pattern: simple_form('interactive'), + lookbehind: true, + alias: 'keyword' + }, + boolean: { + pattern: primitive('(?:t|nil)'), + lookbehind: true + }, + number: { + pattern: primitive('[-+]?\\d+(?:\\.\\d*)?'), + lookbehind: true + }, + defvar: { + pattern: RegExp(par + 'def(?:var|const|custom|group)\\s+' + symbol), + lookbehind: true, + inside: { + keyword: /^def[a-z]+/, + variable: RegExp(symbol) + } + }, + defun: { + pattern: RegExp( + par + + '(?:cl-)?(?:defun\\*?|defmacro)\\s+' + + symbol + + '\\s+\\([\\s\\S]*?\\)' + ), + lookbehind: true, + inside: { + keyword: /^(?:cl-)?def\S+/, + // See below, this property needs to be defined later so that it can + // reference the language object. + arguments: null, + function: { + pattern: RegExp('(^\\s)' + symbol), + lookbehind: true + }, + punctuation: /[()]/ + } + }, + lambda: { + pattern: RegExp(par + 'lambda\\s+\\((?:&?' + symbol + '\\s*)*\\)'), + lookbehind: true, + inside: { + keyword: /^lambda/, + // See below, this property needs to be defined later so that it can + // reference the language object. + arguments: null, + punctuation: /[()]/ + } + }, + car: { + pattern: RegExp(par + symbol), + lookbehind: true + }, + punctuation: [ + // open paren, brackets, and close paren + /(['`,]?\(|[)\[\]])/, + // cons + { + pattern: /(\s)\.(?=\s)/, + lookbehind: true + }, + ] + }; + + var arg = { + 'lisp-marker': RegExp(marker), + rest: { + argument: { + pattern: RegExp(symbol), + alias: 'variable' + }, + varform: { + pattern: RegExp(par + symbol + '\\s+\\S[\\s\\S]*' + endpar), + lookbehind: true, + inside: { + string: language.string, + boolean: language.boolean, + number: language.number, + symbol: language.symbol, + punctuation: /[()]/ + } + } + } + }; + + var forms = '\\S+(?:\\s+\\S+)*'; + + var arglist = { + pattern: RegExp(par + '[\\s\\S]*' + endpar), + lookbehind: true, + inside: { + 'rest-vars': { + pattern: RegExp('&(?:rest|body)\\s+' + forms), + inside: arg + }, + 'other-marker-vars': { + pattern: RegExp('&(?:optional|aux)\\s+' + forms), + inside: arg + }, + keys: { + pattern: RegExp('&key\\s+' + forms + '(?:\\s+&allow-other-keys)?'), + inside: arg + }, + argument: { + pattern: RegExp(symbol), + alias: 'variable' + }, + punctuation: /[()]/ + } + }; + + language['lambda'].inside.arguments = arglist; + language['defun'].inside.arguments = Prism.util.clone(arglist); + language['defun'].inside.arguments.inside.sublist = arglist; + + Prism.languages.lisp = language; + Prism.languages.elisp = language; + Prism.languages.emacs = language; + Prism.languages['emacs-lisp'] = language; +}(Prism)); + +Prism.languages.lua = { + 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m, + // \z may be used to skip the following space + 'string': { + pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[\s\S]))*\1|\[(=*)\[[\s\S]*?\]\2\]/, + greedy: true + }, + 'number': /\b0x[a-f\d]+\.?[a-f\d]*(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|\.?\d*(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i, + 'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/, + 'function': /(?!\d)\w+(?=\s*(?:[({]))/, + 'operator': [ + /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/, + { + // Match ".." but don't break "..." + pattern: /(^|[^.])\.\.(?!\.)/, + lookbehind: true + } + ], + 'punctuation': /[\[\](){},;]|\.+|:+/ +}; +Prism.languages.makefile = { + 'comment': { + pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/, + lookbehind: true + }, + 'string': { + pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, + greedy: true + }, + + // Built-in target names + 'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/, + + // Targets + 'symbol': { + pattern: /^[^:=\r\n]+(?=\s*:(?!=))/m, + inside: { + 'variable': /\$+(?:[^(){}:#=\s]+|(?=[({]))/ + } + }, + 'variable': /\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/, + + 'keyword': [ + // Directives + /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/, + // Functions + { + pattern: /(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/, + lookbehind: true + } + ], + 'operator': /(?:::|[?:+!])?=|[|@]/, + 'punctuation': /[:;(){}]/ +}; +Prism.languages.perl = { + 'comment': [ + { + // POD + pattern: /(^\s*)=\w+[\s\S]*?=cut.*/m, + lookbehind: true + }, + { + pattern: /(^|[^\\$])#.*/, + lookbehind: true + } + ], + // TODO Could be nice to handle Heredoc too. + 'string': [ + // q/.../ + { + pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/, + greedy: true + }, + + // q a...a + { + pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/, + greedy: true + }, + + // q(...) + { + pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/, + greedy: true + }, + + // q{...} + { + pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/, + greedy: true + }, + + // q[...] + { + pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/, + greedy: true + }, + + // q<...> + { + pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/, + greedy: true + }, + + // "...", `...` + { + pattern: /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/, + greedy: true + }, + + // '...' + // FIXME Multi-line single-quoted strings are not supported as they would break variables containing ' + { + pattern: /'(?:[^'\\\r\n]|\\.)*'/, + greedy: true + } + ], + 'regex': [ + // m/.../ + { + pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, + greedy: true + }, + + // m a...a + { + pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, + greedy: true + }, + + // m(...) + { + pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/, + greedy: true + }, + + // m{...} + { + pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/, + greedy: true + }, + + // m[...] + { + pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/, + greedy: true + }, + + // m<...> + { + pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/, + greedy: true + }, + + // The lookbehinds prevent -s from breaking + // FIXME We don't handle change of separator like s(...)[...] + // s/.../.../ + { + pattern: /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/, + lookbehind: true, + greedy: true + }, + + // s a...a...a + { + pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/, + lookbehind: true, + greedy: true + }, + + // s(...)(...) + { + pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/, + lookbehind: true, + greedy: true + }, + + // s{...}{...} + { + pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/, + lookbehind: true, + greedy: true + }, + + // s[...][...] + { + pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/, + lookbehind: true, + greedy: true + }, + + // s<...><...> + { + pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/, + lookbehind: true, + greedy: true + }, + + // /.../ + // The look-ahead tries to prevent two divisions on + // the same line from being highlighted as regex. + // This does not support multi-line regex. + { + pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/, + greedy: true + } + ], + + // FIXME Not sure about the handling of ::, ', and # + 'variable': [ + // ${^POSTMATCH} + /[&*$@%]\{\^[A-Z]+\}/, + // $^V + /[&*$@%]\^[A-Z_]/, + // ${...} + /[&*$@%]#?(?=\{)/, + // $foo + /[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+)+(?:::)*/i, + // $1 + /[&*$@%]\d+/, + // $_, @_, %! + // The negative lookahead prevents from breaking the %= operator + /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/ + ], + 'filehandle': { + // <>, , _ + pattern: /<(?![<=])\S*>|\b_\b/, + alias: 'symbol' + }, + 'vstring': { + // v1.2, 1.2.3 + pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/, + alias: 'string' + }, + 'function': { + pattern: /sub [a-z0-9_]+/i, + inside: { + keyword: /sub/ + } + }, + 'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/, + 'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/, + 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/, + 'punctuation': /[{}[\];(),:]/ +}; + +Prism.languages.sql = { + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, + lookbehind: true + }, + 'variable': [ + { + pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, + greedy: true + }, + /@[\w.$]+/ + ], + 'string': { + pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/, + greedy: true, + lookbehind: true + }, + 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, // Should we highlight user defined functions too? + 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i, + 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i, + 'number': /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i, + 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, + 'punctuation': /[;[\]()`,.]/ +}; + +Prism.languages.python = { + 'comment': { + pattern: /(^|[^\\])#.*/, + lookbehind: true + }, + 'string-interpolation': { + pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i, + greedy: true, + inside: { + 'interpolation': { + // "{" "}" + pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/, + lookbehind: true, + inside: { + 'format-spec': { + pattern: /(:)[^:(){}]+(?=}$)/, + lookbehind: true + }, + 'conversion-option': { + pattern: /![sra](?=[:}]$)/, + alias: 'punctuation' + }, + rest: null + } + }, + 'string': /[\s\S]+/ + } + }, + 'triple-quoted-string': { + pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i, + greedy: true, + alias: 'string' + }, + 'string': { + pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i, + greedy: true + }, + 'function': { + pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g, + lookbehind: true + }, + 'class-name': { + pattern: /(\bclass\s+)\w+/i, + lookbehind: true + }, + 'decorator': { + pattern: /(^\s*)@\w+(?:\.\w+)*/i, + lookbehind: true, + alias: ['annotation', 'punctuation'], + inside: { + 'punctuation': /\./ + } + }, + 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|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(?:True|False|None)\b/, + 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i, + 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/, + 'punctuation': /[{}[\];(),.:]/ +}; + +Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python; + +Prism.languages.py = Prism.languages.python; +Prism.languages.scheme = { + 'comment': /;.*/, + 'string': { + pattern: /"(?:[^"\\]|\\.)*"|'[^()#'\s]+/, + greedy: true + }, + 'character': { + pattern: /#\\(?:[ux][a-fA-F\d]+|[a-zA-Z]+|\S)/, + alias: 'string' + }, + 'keyword': { + pattern: /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)(?=[()\s])/, + lookbehind: true + }, + 'builtin': { + pattern: /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)(?=[()\s])/, + lookbehind: true + }, + 'number': { + pattern: /([\s()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/, + lookbehind: true + }, + 'boolean': /#[tf]/, + 'operator': { + pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)(?=\s|$)/, + lookbehind: true + }, + 'function': { + pattern: /(\()[^()'\s]+(?=[()\s)]|$)/, + lookbehind: true + }, + 'punctuation': /[()']/ +}; + +Prism.languages.yaml = { + 'scalar': { + pattern: /([\-:]\s*(?:![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\2[^\r\n]+)*)/, + lookbehind: true, + alias: 'string' + }, + 'comment': /#.*/, + 'key': { + pattern: /(\s*(?:^|[:\-,[{\r\n?])[ \t]*(?:![^\s]+)?[ \t]*)[^\r\n{[\]},#\s]+?(?=\s*:\s)/, + lookbehind: true, + alias: 'atrule' + }, + 'directive': { + pattern: /(^[ \t]*)%.+/m, + lookbehind: true, + alias: 'important' + }, + 'datetime': { + pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?)(?=[ \t]*(?:$|,|]|}))/m, + lookbehind: true, + alias: 'number' + }, + 'boolean': { + pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:true|false)[ \t]*(?=$|,|]|})/im, + lookbehind: true, + alias: 'important' + }, + 'null': { + pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:null|~)[ \t]*(?=$|,|]|})/im, + lookbehind: true, + alias: 'important' + }, + 'string': { + pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}|\s*#))/m, + lookbehind: true, + greedy: true + }, + 'number': { + pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+\.?\d*|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im, + lookbehind: true + }, + 'tag': /![^\s]+/, + 'important': /[&*][\w]+/, + 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ +}; + +Prism.languages.yml = Prism.languages.yaml; diff --git a/themes/elenq/templates/base.html b/themes/elenq/templates/base.html index 7d64a88..ba621d7 100644 --- a/themes/elenq/templates/base.html +++ b/themes/elenq/templates/base.html @@ -35,6 +35,9 @@ + + + -- cgit v1.2.3