12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447 |
- /* PrismJS 1.14.0
- http://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+c+bash+cpp+csharp+diff+markup-templating+git+go+graphql+http+hpkp+hsts+java+json+less+markdown+nginx+php+php-extras+sql+python+sass+scss+scala+plsql+vim&plugins=line-numbers+autolinker+wpd+command-line */
- 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(){
- // Private helper vars
- var lang = /\blang(?:uage)?-([\w-]+)\b/i;
- var uniqueId = 0;
- var _ = _self.Prism = {
- 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 (_.util.type(tokens) === 'Array') {
- return tokens.map(_.util.encode);
- } else {
- return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
- }
- },
- type: function (o) {
- return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
- },
- objId: function (obj) {
- if (!obj['__id']) {
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
- }
- return obj['__id'];
- },
- // Deep clone a language definition (e.g. to extend it)
- clone: function (o, visited) {
- var type = _.util.type(o);
- visited = visited || {};
- switch (type) {
- case 'Object':
- if (visited[_.util.objId(o)]) {
- return visited[_.util.objId(o)];
- }
- var clone = {};
- visited[_.util.objId(o)] = clone;
- for (var key in o) {
- if (o.hasOwnProperty(key)) {
- clone[key] = _.util.clone(o[key], visited);
- }
- }
- return clone;
- case 'Array':
- if (visited[_.util.objId(o)]) {
- return visited[_.util.objId(o)];
- }
- var clone = [];
- visited[_.util.objId(o)] = clone;
- o.forEach(function (v, i) {
- clone[i] = _.util.clone(v, visited);
- });
- return clone;
- }
- return o;
- }
- },
- languages: {
- extend: function (id, redef) {
- var lang = _.util.clone(_.languages[id]);
- for (var key in redef) {
- lang[key] = redef[key];
- }
- return lang;
- },
- /**
- * Insert a token before another token in a language literal
- * As this needs to recreate the object (we cannot actually insert before keys in object literals),
- * we cannot just provide an object, we need anobject and a key.
- * @param inside The key (or language id) of the parent
- * @param before The key to insert before. If not provided, the function appends instead.
- * @param insert Object with the key/value pairs to insert
- * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
- */
- insertBefore: function (inside, before, insert, root) {
- root = root || _.languages;
- var grammar = root[inside];
- if (arguments.length == 2) {
- insert = arguments[1];
- for (var newToken in insert) {
- if (insert.hasOwnProperty(newToken)) {
- grammar[newToken] = insert[newToken];
- }
- }
- return grammar;
- }
- var ret = {};
- for (var token in grammar) {
- if (grammar.hasOwnProperty(token)) {
- if (token == before) {
- for (var newToken in insert) {
- if (insert.hasOwnProperty(newToken)) {
- ret[newToken] = insert[newToken];
- }
- }
- }
- ret[token] = grammar[token];
- }
- }
- // Update references in other language definitions
- _.languages.DFS(_.languages, function(key, value) {
- if (value === root[inside] && key != inside) {
- this[key] = ret;
- }
- });
- return root[inside] = ret;
- },
- // Traverse a language definition with Depth First Search
- DFS: function(o, callback, type, visited) {
- visited = visited || {};
- for (var i in o) {
- if (o.hasOwnProperty(i)) {
- callback.call(o, i, o[i], type || i);
- if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
- visited[_.util.objId(o[i])] = true;
- _.languages.DFS(o[i], callback, null, visited);
- }
- else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
- visited[_.util.objId(o[i])] = true;
- _.languages.DFS(o[i], callback, i, visited);
- }
- }
- }
- }
- },
- plugins: {},
- highlightAll: function(async, callback) {
- _.highlightAllUnder(document, async, callback);
- },
- highlightAllUnder: function(container, async, callback) {
- var env = {
- callback: callback,
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
- };
- _.hooks.run("before-highlightall", env);
- var elements = env.elements || container.querySelectorAll(env.selector);
- for (var i=0, element; element = elements[i++];) {
- _.highlightElement(element, async === true, env.callback);
- }
- },
- highlightElement: function(element, async, callback) {
- // Find language
- var language, grammar, parent = element;
- while (parent && !lang.test(parent.className)) {
- parent = parent.parentNode;
- }
- if (parent) {
- language = (parent.className.match(lang) || [,''])[1].toLowerCase();
- grammar = _.languages[language];
- }
- // Set language on the element, if not present
- element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
- if (element.parentNode) {
- // Set language on the parent, for styling
- parent = element.parentNode;
- if (/pre/i.test(parent.nodeName)) {
- parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
- }
- }
- var code = element.textContent;
- var env = {
- element: element,
- language: language,
- grammar: grammar,
- code: code
- };
- _.hooks.run('before-sanity-check', env);
- if (!env.code || !env.grammar) {
- if (env.code) {
- _.hooks.run('before-highlight', env);
- env.element.textContent = env.code;
- _.hooks.run('after-highlight', env);
- }
- _.hooks.run('complete', env);
- return;
- }
- _.hooks.run('before-highlight', env);
- if (async && _self.Worker) {
- var worker = new Worker(_.filename);
- worker.onmessage = function(evt) {
- env.highlightedCode = evt.data;
- _.hooks.run('before-insert', env);
- env.element.innerHTML = env.highlightedCode;
- callback && callback.call(env.element);
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
- };
- worker.postMessage(JSON.stringify({
- language: env.language,
- code: env.code,
- immediateClose: true
- }));
- }
- else {
- env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
- _.hooks.run('before-insert', env);
- env.element.innerHTML = env.highlightedCode;
- callback && callback.call(element);
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
- }
- },
- highlight: function (text, grammar, language) {
- var env = {
- code: text,
- grammar: grammar,
- language: language
- };
- _.hooks.run('before-tokenize', env);
- env.tokens = _.tokenize(env.code, env.grammar);
- _.hooks.run('after-tokenize', env);
- return Token.stringify(_.util.encode(env.tokens), env.language);
- },
- matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
- var Token = _.Token;
- for (var token in grammar) {
- if(!grammar.hasOwnProperty(token) || !grammar[token]) {
- continue;
- }
- if (token == target) {
- return;
- }
- var patterns = grammar[token];
- patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
- for (var j = 0; j < patterns.length; ++j) {
- var pattern = patterns[j],
- inside = pattern.inside,
- lookbehind = !!pattern.lookbehind,
- greedy = !!pattern.greedy,
- lookbehindLength = 0,
- alias = pattern.alias;
- if (greedy && !pattern.pattern.global) {
- // Without the global flag, lastIndex won't work
- var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
- pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
- }
- pattern = pattern.pattern || pattern;
- // Don’t cache length as it changes during the loop
- for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
- var str = strarr[i];
- if (strarr.length > 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, language) {
- 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);
- }
- }
- }
- };
- var Token = _.Token = function(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, parent) {
- if (typeof o == 'string') {
- return o;
- }
- if (_.util.type(o) === 'Array') {
- return o.map(function(element) {
- return Token.stringify(element, language, o);
- }).join('');
- }
- var env = {
- type: o.type,
- content: Token.stringify(o.content, language, parent),
- tag: 'span',
- classes: ['token', o.type],
- attributes: {},
- language: language,
- parent: parent
- };
- if (o.alias) {
- var aliases = _.util.type(o.alias) === 'Array' ? 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 + '</' + env.tag + '>';
- };
- if (!_self.document) {
- if (!_self.addEventListener) {
- // in Node.js
- return _self.Prism;
- }
- 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 _self.Prism;
- }
- //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.Prism;
- })();
- 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;
- }
- ;
- Prism.languages.markup = {
- 'comment': /<!--[\s\S]*?-->/,
- 'prolog': /<\?[\s\S]+?\?>/,
- 'doctype': /<!DOCTYPE[\s\S]+?>/i,
- 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
- 'tag': {
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
- greedy: true,
- inside: {
- 'tag': {
- pattern: /^<\/?[^\s>\/]+/i,
- inside: {
- 'punctuation': /^<\/?/,
- 'namespace': /^[^\s>\/:]+:/
- }
- },
- 'attr-value': {
- pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
- inside: {
- 'punctuation': [
- /^=/,
- {
- pattern: /(^|[^\\])["']/,
- lookbehind: true
- }
- ]
- }
- },
- 'punctuation': /\/?>/,
- 'attr-name': {
- pattern: /[^\s>\/]+/,
- inside: {
- 'namespace': /^[^\s>\/:]+:/
- }
- }
- }
- },
- 'entity': /&#?[\da-z]{1,8};/i
- };
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
- Prism.languages.markup['entity'];
- // Plugin to make entity title show the real entity, idea by Roman Komarov
- Prism.hooks.add('wrap', function(env) {
- if (env.type === 'entity') {
- env.attributes['title'] = env.content.replace(/&/, '&');
- }
- });
- Prism.languages.xml = Prism.languages.markup;
- Prism.languages.html = Prism.languages.markup;
- Prism.languages.mathml = Prism.languages.markup;
- Prism.languages.svg = Prism.languages.markup;
- Prism.languages.css = {
- 'comment': /\/\*[\s\S]*?\*\//,
- 'atrule': {
- pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
- inside: {
- 'rule': /@[\w-]+/
- // See rest below
- }
- },
- 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
- 'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
- 'string': {
- pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
- 'important': /\B!important\b/i,
- 'function': /[-a-z0-9]+(?=\()/i,
- 'punctuation': /[(){};:]/
- };
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
- if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'style': {
- pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
- lookbehind: true,
- inside: Prism.languages.css,
- alias: 'language-css',
- greedy: true
- }
- });
- Prism.languages.insertBefore('inside', 'attr-value', {
- 'style-attr': {
- pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
- inside: {
- 'attr-name': {
- pattern: /^\s*style/i,
- inside: Prism.languages.markup.tag.inside
- },
- 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
- 'attr-value': {
- pattern: /.+/i,
- inside: Prism.languages.css
- }
- },
- alias: 'language-css'
- }
- }, Prism.languages.markup.tag);
- };
- Prism.languages.clike = {
- 'comment': [
- {
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
- lookbehind: true
- },
- {
- pattern: /(^|[^\\:])\/\/.*/,
- lookbehind: true,
- greedy: true
- }
- ],
- 'string': {
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'class-name': {
- pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
- lookbehind: true,
- inside: {
- punctuation: /[.\\]/
- }
- },
- 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
- 'boolean': /\b(?:true|false)\b/,
- 'function': /[a-z0-9_]+(?=\()/i,
- 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
- 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
- 'punctuation': /[{}[\];(),.:]/
- };
- 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;
- Prism.languages.c = Prism.languages.extend('clike', {
- 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|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/,
- 'operator': /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/,
- 'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
- });
- Prism.languages.insertBefore('c', 'string', {
- 'macro': {
- // allow for multiline macro definitions
- // spaces after the # character compile fine with gcc
- pattern: /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,
- lookbehind: true,
- alias: 'property',
- inside: {
- // highlight the path of the include statement as a string
- 'string': {
- pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,
- lookbehind: true
- },
- // highlight macro directives as keywords
- 'directive': {
- pattern: /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
- lookbehind: true,
- alias: 'keyword'
- }
- }
- },
- // highlight predefined macros as constants
- 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
- });
- delete Prism.languages.c['class-name'];
- delete Prism.languages.c['boolean'];
- (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;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|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|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\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);
- Prism.languages.cpp = Prism.languages.extend('c', {
- 'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
- 'boolean': /\b(?:true|false)\b/,
- 'operator': /--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
- });
- Prism.languages.insertBefore('cpp', 'keyword', {
- 'class-name': {
- pattern: /(class\s+)\w+/i,
- lookbehind: true
- }
- });
- Prism.languages.insertBefore('cpp', 'string', {
- 'raw-string': {
- pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
- alias: 'string',
- greedy: true
- }
- });
- Prism.languages.csharp = Prism.languages.extend('clike', {
- 'keyword': /\b(?:abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/,
- 'string': [
- {
- pattern: /@("|')(?:\1\1|\\[\s\S]|(?!\1)[^\\])*\1/,
- greedy: true
- },
- {
- pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*?\1/,
- greedy: true
- }
- ],
- 'class-name': [
- {
- // (Foo bar, Bar baz)
- pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=\s+\w+)/,
- inside: {
- punctuation: /\./
- }
- },
- {
- // [Foo]
- pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/,
- lookbehind: true,
- inside: {
- punctuation: /\./
- }
- },
- {
- // class Foo : Bar
- pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,
- lookbehind: true,
- inside: {
- punctuation: /\./
- }
- },
- {
- // class Foo
- pattern: /((?:\b(?:class|interface|new)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,
- lookbehind: true,
- inside: {
- punctuation: /\./
- }
- }
- ],
- 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i
- });
- Prism.languages.insertBefore('csharp', 'class-name', {
- 'generic-method': {
- pattern: /\w+\s*<[^>\r\n]+?>\s*(?=\()/,
- inside: {
- function: /^\w+/,
- 'class-name': {
- pattern: /\b[A-Z]\w*(?:\.\w+)*\b/,
- inside: {
- punctuation: /\./
- }
- },
- keyword: Prism.languages.csharp.keyword,
- punctuation: /[<>(),.:]/
- }
- },
- 'preprocessor': {
- pattern: /(^\s*)#.*/m,
- lookbehind: true,
- alias: 'property',
- inside: {
- // highlight preprocessor directives as keywords
- 'directive': {
- pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,
- lookbehind: true,
- alias: 'keyword'
- }
- }
- }
- });
- Prism.languages.dotnet = Prism.languages.csharp;
- Prism.languages.diff = {
- 'coord': [
- // Match all kinds of coord lines (prefixed by "+++", "---" or "***").
- /^(?:\*{3}|-{3}|\+{3}).*$/m,
- // Match "@@ ... @@" coord lines in unified diff.
- /^@@.*@@$/m,
- // Match coord lines in normal diff (starts with a number).
- /^\d+.*$/m
- ],
- // Match inserted and deleted lines. Support both +/- and >/< styles.
- 'deleted': /^[-<].*$/m,
- 'inserted': /^[+>].*$/m,
- // Match "different" lines (prefixed with "!") in context diff.
- 'diff': {
- 'pattern': /^!(?!!).+$/m,
- 'alias': 'important'
- }
- };
- Prism.languages['markup-templating'] = {};
- Object.defineProperties(Prism.languages['markup-templating'], {
- buildPlaceholders: {
- // Tokenize all inline templating expressions matching placeholderPattern
- // If the replaceFilter function is provided, it will be called with every match.
- // If it returns false, the match will not be replaced.
- value: function (env, language, placeholderPattern, replaceFilter) {
- if (env.language !== language) {
- return;
- }
- env.tokenStack = [];
- env.code = env.code.replace(placeholderPattern, function(match) {
- if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
- return match;
- }
- var i = env.tokenStack.length;
- // Check for existing strings
- while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1)
- ++i;
- // Create a sparse array
- env.tokenStack[i] = match;
- return '___' + language.toUpperCase() + i + '___';
- });
- // Switch the grammar to markup
- env.grammar = Prism.languages.markup;
- }
- },
- tokenizePlaceholders: {
- // Replace placeholders with proper tokens after tokenizing
- value: function (env, language) {
- if (env.language !== language || !env.tokenStack) {
- return;
- }
- // Switch the grammar back
- env.grammar = Prism.languages[language];
- var j = 0;
- var keys = Object.keys(env.tokenStack);
- var walkTokens = function (tokens) {
- if (j >= keys.length) {
- return;
- }
- for (var i = 0; i < tokens.length; i++) {
- var token = tokens[i];
- if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
- var k = keys[j];
- var t = env.tokenStack[k];
- var s = typeof token === 'string' ? token : token.content;
- var index = s.indexOf('___' + language.toUpperCase() + k + '___');
- if (index > -1) {
- ++j;
- var before = s.substring(0, index);
- var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t);
- var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length);
- var replacement;
- if (before || after) {
- replacement = [before, middle, after].filter(function (v) { return !!v; });
- walkTokens(replacement);
- } else {
- replacement = middle;
- }
- if (typeof token === 'string') {
- Array.prototype.splice.apply(tokens, [i, 1].concat(replacement));
- } else {
- token.content = replacement;
- }
- if (j >= keys.length) {
- break;
- }
- }
- } else if (token.content && typeof token.content !== 'string') {
- walkTokens(token.content);
- }
- }
- };
- walkTokens(env.tokens);
- }
- }
- });
- Prism.languages.git = {
- /*
- * A simple one line comment like in a git status command
- * For instance:
- * $ git status
- * # On branch infinite-scroll
- * # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
- * # and have 1 and 2 different commits each, respectively.
- * nothing to commit (working directory clean)
- */
- 'comment': /^#.*/m,
- /*
- * Regexp to match the changed lines in a git diff output. Check the example below.
- */
- 'deleted': /^[-–].*/m,
- 'inserted': /^\+.*/m,
- /*
- * a string (double and simple quote)
- */
- 'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m,
- /*
- * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
- * For instance:
- * $ git add file.txt
- */
- 'command': {
- pattern: /^.*\$ git .*$/m,
- inside: {
- /*
- * A git command can contain a parameter starting by a single or a double dash followed by a string
- * For instance:
- * $ git diff --cached
- * $ git log -p
- */
- 'parameter': /\s--?\w+/m
- }
- },
- /*
- * Coordinates displayed in a git diff command
- * For instance:
- * $ git diff
- * diff --git file.txt file.txt
- * index 6214953..1d54a52 100644
- * --- file.txt
- * +++ file.txt
- * @@ -1 +1,2 @@
- * -Here's my tetx file
- * +Here's my text file
- * +And this is the second line
- */
- 'coord': /^@@.*@@$/m,
- /*
- * Match a "commit [SHA1]" line in a git log output.
- * For instance:
- * $ git log
- * commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
- * Author: lgiraudel
- * Date: Mon Feb 17 11:18:34 2014 +0100
- *
- * Add of a new line
- */
- 'commit_sha1': /^commit \w{40}$/m
- };
- Prism.languages.go = Prism.languages.extend('clike', {
- 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
- 'builtin': /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,
- 'boolean': /\b(?:_|iota|nil|true|false)\b/,
- 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
- 'number': /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,
- 'string': {
- pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/,
- greedy: true
- }
- });
- delete Prism.languages.go['class-name'];
- Prism.languages.graphql = {
- 'comment': /#.*/,
- 'string': {
- pattern: /"(?:\\.|[^\\"\r\n])*"/,
- greedy: true
- },
- 'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
- 'boolean': /\b(?:true|false)\b/,
- 'variable': /\$[a-z_]\w*/i,
- 'directive': {
- pattern: /@[a-z_]\w*/i,
- alias: 'function'
- },
- 'attr-name': /[a-z_]\w*(?=\s*:)/i,
- 'keyword': [
- {
- pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/,
- lookbehind: true
- },
- /\b(?:query|fragment|mutation)\b/
- ],
- 'operator': /!|=|\.{3}/,
- 'punctuation': /[!(){}\[\]:=,]/
- };
- Prism.languages.http = {
- 'request-line': {
- pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S+\sHTTP\/[0-9.]+/m,
- inside: {
- // HTTP Verb
- property: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
- // Path or query argument
- 'attr-name': /:\w+/
- }
- },
- 'response-status': {
- pattern: /^HTTP\/1.[01] \d+.*/m,
- inside: {
- // Status, e.g. 200 OK
- property: {
- pattern: /(^HTTP\/1.[01] )\d+.*/i,
- lookbehind: true
- }
- }
- },
- // HTTP header name
- 'header-name': {
- pattern: /^[\w-]+:(?=.)/m,
- alias: 'keyword'
- }
- };
- // Create a mapping of Content-Type headers to language definitions
- var httpLanguages = {
- 'application/json': Prism.languages.javascript,
- 'application/xml': Prism.languages.markup,
- 'text/xml': Prism.languages.markup,
- 'text/html': Prism.languages.markup
- };
- // Insert each content type parser that has its associated language
- // currently loaded.
- for (var contentType in httpLanguages) {
- if (httpLanguages[contentType]) {
- var options = {};
- options[contentType] = {
- pattern: new RegExp('(content-type:\\s*' + contentType + '[\\w\\W]*?)(?:\\r?\\n|\\r){2}[\\w\\W]*', 'i'),
- lookbehind: true,
- inside: {
- rest: httpLanguages[contentType]
- }
- };
- Prism.languages.insertBefore('http', 'header-name', options);
- }
- }
- ;
- /**
- * Original by Scott Helme.
- *
- * Reference: https://scotthelme.co.uk/hpkp-cheat-sheet/
- */
- Prism.languages.hpkp = {
- 'directive': {
- pattern: /\b(?:(?:includeSubDomains|preload|strict)(?: |;)|pin-sha256="[a-zA-Z\d+=/]+"|(?:max-age|report-uri)=|report-to )/,
- alias: 'keyword'
- },
- 'safe': {
- pattern: /\d{7,}/,
- alias: 'selector'
- },
- 'unsafe': {
- pattern: /\d{0,6}/,
- alias: 'function'
- }
- };
- /**
- * Original by Scott Helme.
- *
- * Reference: https://scotthelme.co.uk/hsts-cheat-sheet/
- */
- Prism.languages.hsts = {
- 'directive': {
- pattern: /\b(?:max-age=|includeSubDomains|preload)/,
- alias: 'keyword'
- },
- 'safe': {
- pattern: /\d{8,}/,
- alias: 'selector'
- },
- 'unsafe': {
- pattern: /\d{0,7}/,
- alias: 'function'
- }
- };
- Prism.languages.java = Prism.languages.extend('clike', {
- 'keyword': /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
- 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp-]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?[df]?/i,
- 'operator': {
- pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
- lookbehind: true
- }
- });
- Prism.languages.insertBefore('java','function', {
- 'annotation': {
- alias: 'punctuation',
- pattern: /(^|[^.])@\w+/,
- lookbehind: true
- }
- });
- Prism.languages.insertBefore('java', 'class-name', {
- 'generics': {
- pattern: /<\s*\w+(?:\.\w+)?(?:\s*,\s*\w+(?:\.\w+)?)*>/i,
- alias: 'function',
- inside: {
- keyword: Prism.languages.java.keyword,
- punctuation: /[<>(),.:]/
- }
- }
- });
- Prism.languages.json = {
- 'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,
- 'string': {
- pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
- greedy: true
- },
- 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
- 'punctuation': /[{}[\]);,]/,
- 'operator': /:/g,
- 'boolean': /\b(?:true|false)\b/i,
- 'null': /\bnull\b/i
- };
- Prism.languages.jsonp = Prism.languages.json;
- /* FIXME :
- :extend() is not handled specifically : its highlighting is buggy.
- Mixin usage must be inside a ruleset to be highlighted.
- At-rules (e.g. import) containing interpolations are buggy.
- Detached rulesets are highlighted as at-rules.
- A comment before a mixin usage prevents the latter to be properly highlighted.
- */
- Prism.languages.less = Prism.languages.extend('css', {
- 'comment': [
- /\/\*[\s\S]*?\*\//,
- {
- pattern: /(^|[^\\])\/\/.*/,
- lookbehind: true
- }
- ],
- 'atrule': {
- pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i,
- inside: {
- 'punctuation': /[:()]/
- }
- },
- // selectors and mixins are considered the same
- 'selector': {
- pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/,
- inside: {
- // mixin parameters
- 'variable': /@+[\w-]+/
- }
- },
- 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
- 'punctuation': /[{}();:,]/,
- 'operator': /[+\-*\/]/
- });
- // Invert function and punctuation positions
- Prism.languages.insertBefore('less', 'punctuation', {
- 'function': Prism.languages.less.function
- });
- Prism.languages.insertBefore('less', 'property', {
- 'variable': [
- // Variable declaration (the colon must be consumed!)
- {
- pattern: /@[\w-]+\s*:/,
- inside: {
- "punctuation": /:/
- }
- },
- // Variable usage
- /@@?[\w-]+/
- ],
- 'mixin-usage': {
- pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,
- lookbehind: true,
- alias: 'function'
- }
- });
- Prism.languages.markdown = Prism.languages.extend('markup', {});
- Prism.languages.insertBefore('markdown', 'prolog', {
- 'blockquote': {
- // > ...
- pattern: /^>(?:[\t ]*>)*/m,
- alias: 'punctuation'
- },
- 'code': [
- {
- // Prefixed by 4 spaces or 1 tab
- pattern: /^(?: {4}|\t).+/m,
- alias: 'keyword'
- },
- {
- // `code`
- // ``code``
- pattern: /``.+?``|`[^`\n]+`/,
- alias: 'keyword'
- }
- ],
- 'title': [
- {
- // title 1
- // =======
- // title 2
- // -------
- pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/,
- alias: 'important',
- inside: {
- punctuation: /==+$|--+$/
- }
- },
- {
- // # title 1
- // ###### title 6
- pattern: /(^\s*)#+.+/m,
- lookbehind: true,
- alias: 'important',
- inside: {
- punctuation: /^#+|#+$/
- }
- }
- ],
- 'hr': {
- // ***
- // ---
- // * * *
- // -----------
- pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'list': {
- // * item
- // + item
- // - item
- // 1. item
- pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'url-reference': {
- // [id]: http://example.com "Optional title"
- // [id]: http://example.com 'Optional title'
- // [id]: http://example.com (Optional title)
- // [id]: <http://example.com> "Optional title"
- pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
- inside: {
- 'variable': {
- pattern: /^(!?\[)[^\]]+/,
- lookbehind: true
- },
- 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
- 'punctuation': /^[\[\]!:]|[<>]/
- },
- alias: 'url'
- },
- 'bold': {
- // **strong**
- // __strong__
- // Allow only one line break
- pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
- lookbehind: true,
- inside: {
- 'punctuation': /^\*\*|^__|\*\*$|__$/
- }
- },
- 'italic': {
- // *em*
- // _em_
- // Allow only one line break
- pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
- lookbehind: true,
- inside: {
- 'punctuation': /^[*_]|[*_]$/
- }
- },
- 'url': {
- // [example](http://example.com "Optional title")
- // [example] [id]
- pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,
- inside: {
- 'variable': {
- pattern: /(!?\[)[^\]]+(?=\]$)/,
- lookbehind: true
- },
- 'string': {
- pattern: /"(?:\\.|[^"\\])*"(?=\)$)/
- }
- }
- }
- });
- Prism.languages.markdown['bold'].inside['url'] = Prism.languages.markdown['url'];
- Prism.languages.markdown['italic'].inside['url'] = Prism.languages.markdown['url'];
- Prism.languages.markdown['bold'].inside['italic'] = Prism.languages.markdown['italic'];
- Prism.languages.markdown['italic'].inside['bold'] = Prism.languages.markdown['bold'];
- Prism.languages.nginx = Prism.languages.extend('clike', {
- 'comment': {
- pattern: /(^|[^"{\\])#.*/,
- lookbehind: true
- },
- 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types)\b/i
- });
- Prism.languages.insertBefore('nginx', 'keyword', {
- 'variable': /\$[a-z_]+/i
- });
- /**
- * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
- * Modified by Miles Johnson: http://milesj.me
- *
- * Supports the following:
- * - Extends clike syntax
- * - Support for PHP 5.3+ (namespaces, traits, generators, etc)
- * - Smarter constant and function matching
- *
- * Adds the following new token classes:
- * constant, delimiter, variable, function, package
- */
- (function (Prism) {
- Prism.languages.php = Prism.languages.extend('clike', {
- 'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
- 'constant': /\b[A-Z0-9_]{2,}\b/,
- 'comment': {
- pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
- lookbehind: true
- }
- });
- Prism.languages.insertBefore('php', 'string', {
- 'shell-comment': {
- pattern: /(^|[^\\])#.*/,
- lookbehind: true,
- alias: 'comment'
- }
- });
- Prism.languages.insertBefore('php', 'keyword', {
- 'delimiter': {
- pattern: /\?>|<\?(?:php|=)?/i,
- alias: 'important'
- },
- 'variable': /\$+(?:\w+\b|(?={))/i,
- 'package': {
- pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
- lookbehind: true,
- inside: {
- punctuation: /\\/
- }
- }
- });
- // Must be defined after the function pattern
- Prism.languages.insertBefore('php', 'operator', {
- 'property': {
- pattern: /(->)[\w]+/,
- lookbehind: true
- }
- });
- Prism.languages.insertBefore('php', 'string', {
- 'nowdoc-string': {
- pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,
- greedy: true,
- alias: 'string',
- inside: {
- 'delimiter': {
- pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
- alias: 'symbol',
- inside: {
- 'punctuation': /^<<<'?|[';]$/
- }
- }
- }
- },
- 'heredoc-string': {
- pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,
- greedy: true,
- alias: 'string',
- inside: {
- 'delimiter': {
- pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
- alias: 'symbol',
- inside: {
- 'punctuation': /^<<<"?|[";]$/
- }
- },
- 'interpolation': null // See below
- }
- },
- 'single-quoted-string': {
- pattern: /'(?:\\[\s\S]|[^\\'])*'/,
- greedy: true,
- alias: 'string'
- },
- 'double-quoted-string': {
- pattern: /"(?:\\[\s\S]|[^\\"])*"/,
- greedy: true,
- alias: 'string',
- inside: {
- 'interpolation': null // See below
- }
- }
- });
- // The different types of PHP strings "replace" the C-like standard string
- delete Prism.languages.php['string'];
- var string_interpolation = {
- pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,
- lookbehind: true,
- inside: {
- rest: Prism.languages.php
- }
- };
- Prism.languages.php['heredoc-string'].inside['interpolation'] = string_interpolation;
- Prism.languages.php['double-quoted-string'].inside['interpolation'] = string_interpolation;
- Prism.hooks.add('before-tokenize', function(env) {
- if (!/(?:<\?php|<\?)/ig.test(env.code)) {
- return;
- }
- var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig;
- Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
- });
- Prism.hooks.add('after-tokenize', function(env) {
- Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
- });
- }(Prism));
- Prism.languages.insertBefore('php', 'variable', {
- 'this': /\$this\b/,
- 'global': /\$(?:_(?:SERVER|GET|POST|FILES|REQUEST|SESSION|ENV|COOKIE)|GLOBALS|HTTP_RAW_POST_DATA|argc|argv|php_errormsg|http_response_header)\b/,
- 'scope': {
- pattern: /\b[\w\\]+::/,
- inside: {
- keyword: /static|self|parent/,
- punctuation: /::|\\/
- }
- }
- });
- Prism.languages.sql= {
- 'comment': {
- pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
- lookbehind: true
- },
- 'string' : {
- pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\])*\2/,
- greedy: true,
- lookbehind: true
- },
- 'variable': /@[\w.$]+|@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
- '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
- },
- 'triple-quoted-string': {
- pattern: /("""|''')[\s\S]+?\1/,
- greedy: true,
- alias: 'string'
- },
- 'string': {
- pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'function': {
- pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
- lookbehind: true
- },
- 'class-name': {
- pattern: /(\bclass\s+)\w+/i,
- lookbehind: true
- },
- 'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|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': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
- 'punctuation': /[{}[\];(),.:]/
- };
- (function(Prism) {
- Prism.languages.sass = Prism.languages.extend('css', {
- // Sass comments don't need to be closed, only indented
- 'comment': {
- pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m,
- lookbehind: true
- }
- });
- Prism.languages.insertBefore('sass', 'atrule', {
- // We want to consume the whole line
- 'atrule-line': {
- // Includes support for = and + shortcuts
- pattern: /^(?:[ \t]*)[@+=].+/m,
- inside: {
- 'atrule': /(?:@[\w-]+|[+=])/m
- }
- }
- });
- delete Prism.languages.sass.atrule;
- var variable = /\$[-\w]+|#\{\$[-\w]+\}/;
- var operator = [
- /[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,
- {
- pattern: /(\s+)-(?=\s)/,
- lookbehind: true
- }
- ];
- Prism.languages.insertBefore('sass', 'property', {
- // We want to consume the whole line
- 'variable-line': {
- pattern: /^[ \t]*\$.+/m,
- inside: {
- 'punctuation': /:/,
- 'variable': variable,
- 'operator': operator
- }
- },
- // We want to consume the whole line
- 'property-line': {
- pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,
- inside: {
- 'property': [
- /[^:\s]+(?=\s*:)/,
- {
- pattern: /(:)[^:\s]+/,
- lookbehind: true
- }
- ],
- 'punctuation': /:/,
- 'variable': variable,
- 'operator': operator,
- 'important': Prism.languages.sass.important
- }
- }
- });
- delete Prism.languages.sass.property;
- delete Prism.languages.sass.important;
- // Now that whole lines for other patterns are consumed,
- // what's left should be selectors
- delete Prism.languages.sass.selector;
- Prism.languages.insertBefore('sass', 'punctuation', {
- 'selector': {
- pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
- lookbehind: true
- }
- });
- }(Prism));
- Prism.languages.scss = Prism.languages.extend('css', {
- 'comment': {
- pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
- lookbehind: true
- },
- 'atrule': {
- pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,
- inside: {
- 'rule': /@[\w-]+/
- // See rest below
- }
- },
- // url, compassified
- 'url': /(?:[-a-z]+-)*url(?=\()/i,
- // CSS selector regex is not appropriate for Sass
- // since there can be lot more things (var, @ directive, nesting..)
- // a selector must start at the end of a property or after a brace (end of other rules or nesting)
- // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
- // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
- // can "pass" as a selector- e.g: proper#{$erty})
- // this one was hard to do, so please be careful if you edit this one :)
- 'selector': {
- // Initial look-ahead is used to prevent matching of blank selectors
- pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|&|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m,
- inside: {
- 'parent': {
- pattern: /&/,
- alias: 'important'
- },
- 'placeholder': /%[-\w]+/,
- 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
- }
- }
- });
- Prism.languages.insertBefore('scss', 'atrule', {
- 'keyword': [
- /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,
- {
- pattern: /( +)(?:from|through)(?= )/,
- lookbehind: true
- }
- ]
- });
- Prism.languages.scss.property = {
- pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/i,
- inside: {
- 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
- }
- };
- Prism.languages.insertBefore('scss', 'important', {
- // var and interpolated vars
- 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
- });
- Prism.languages.insertBefore('scss', 'function', {
- 'placeholder': {
- pattern: /%[-\w]+/,
- alias: 'selector'
- },
- 'statement': {
- pattern: /\B!(?:default|optional)\b/i,
- alias: 'keyword'
- },
- 'boolean': /\b(?:true|false)\b/,
- 'null': /\bnull\b/,
- 'operator': {
- pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
- lookbehind: true
- }
- });
- Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;
- Prism.languages.scala = Prism.languages.extend('java', {
- 'keyword': /<-|=>|\b(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/,
- 'string': [
- {
- pattern: /"""[\s\S]*?"""/,
- greedy: true
- },
- {
- pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- }
- ],
- 'builtin': /\b(?:String|Int|Long|Short|Byte|Boolean|Double|Float|Char|Any|AnyRef|AnyVal|Unit|Nothing)\b/,
- 'number': /\b0x[\da-f]*\.?[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e\d+)?[dfl]?/i,
- 'symbol': /'[^\d\s\\]\w*/
- });
- delete Prism.languages.scala['class-name'];
- delete Prism.languages.scala['function'];
- Prism.languages.plsql = Prism.languages.extend('sql', {
- 'comment': [
- /\/\*[\s\S]*?\*\//,
- /--.*/
- ]
- });
- if (Prism.util.type(Prism.languages.plsql['keyword']) !== 'Array') {
- Prism.languages.plsql['keyword'] = [Prism.languages.plsql['keyword']];
- }
- Prism.languages.plsql['keyword'].unshift(
- /\b(?:ACCESS|AGENT|AGGREGATE|ARRAY|ARROW|AT|ATTRIBUTE|AUDIT|AUTHID|BFILE_BASE|BLOB_BASE|BLOCK|BODY|BOTH|BOUND|BYTE|CALLING|CHAR_BASE|CHARSET(?:FORM|ID)|CLOB_BASE|COLAUTH|COLLECT|CLUSTERS?|COMPILED|COMPRESS|CONSTANT|CONSTRUCTOR|CONTEXT|CRASH|CUSTOMDATUM|DANGLING|DATE_BASE|DEFINE|DETERMINISTIC|DURATION|ELEMENT|EMPTY|EXCEPTIONS?|EXCLUSIVE|EXTERNAL|FINAL|FORALL|FORM|FOUND|GENERAL|HEAP|HIDDEN|IDENTIFIED|IMMEDIATE|INCLUDING|INCREMENT|INDICATOR|INDEXES|INDICES|INFINITE|INITIAL|ISOPEN|INSTANTIABLE|INTERFACE|INVALIDATE|JAVA|LARGE|LEADING|LENGTH|LIBRARY|LIKE[24C]|LIMITED|LONG|LOOP|MAP|MAXEXTENTS|MAXLEN|MEMBER|MINUS|MLSLABEL|MULTISET|NAME|NAN|NATIVE|NEW|NOAUDIT|NOCOMPRESS|NOCOPY|NOTFOUND|NOWAIT|NUMBER(?:_BASE)?|OBJECT|OCI(?:COLL|DATE|DATETIME|DURATION|INTERVAL|LOBLOCATOR|NUMBER|RAW|REF|REFCURSOR|ROWID|STRING|TYPE)|OFFLINE|ONLINE|ONLY|OPAQUE|OPERATOR|ORACLE|ORADATA|ORGANIZATION|ORL(?:ANY|VARY)|OTHERS|OVERLAPS|OVERRIDING|PACKAGE|PARALLEL_ENABLE|PARAMETERS?|PASCAL|PCTFREE|PIPE(?:LINED)?|PRAGMA|PRIOR|PRIVATE|RAISE|RANGE|RAW|RECORD|REF|REFERENCE|REM|REMAINDER|RESULT|RESOURCE|RETURNING|REVERSE|ROW(?:ID|NUM|TYPE)|SAMPLE|SB[124]|SEGMENT|SELF|SEPARATE|SEQUENCE|SHORT|SIZE(?:_T)?|SPARSE|SQL(?:CODE|DATA|NAME|STATE)|STANDARD|STATIC|STDDEV|STORED|STRING|STRUCT|STYLE|SUBMULTISET|SUBPARTITION|SUBSTITUTABLE|SUBTYPE|SUCCESSFUL|SYNONYM|SYSDATE|TABAUTH|TDO|THE|TIMEZONE_(?:ABBR|HOUR|MINUTE|REGION)|TRAILING|TRANSAC(?:TIONAL)?|TRUSTED|UB[124]|UID|UNDER|UNTRUSTED|VALIDATE|VALIST|VARCHAR2|VARIABLE|VARIANCE|VARRAY|VIEWS|VOID|WHENEVER|WRAPPED|ZONE)\b/i
- );
- if (Prism.util.type(Prism.languages.plsql['operator']) !== 'Array') {
- Prism.languages.plsql['operator'] = [Prism.languages.plsql['operator']];
- }
- Prism.languages.plsql['operator'].unshift(
- /:=/
- );
- Prism.languages.vim = {
- 'string': /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,
- 'comment': /".*/,
- 'function': /\w+(?=\()/,
- 'keyword': /\b(?:ab|abbreviate|abc|abclear|abo|aboveleft|al|all|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|ar|args|argu|argument|as|ascii|bad|badd|ba|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bN|bNext|bo|botright|bp|bprevious|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|br|brewind|bro|browse|bufdo|b|buffer|buffers|bun|bunload|bw|bwipeout|ca|cabbrev|cabc|cabclear|caddb|caddbuffer|cad|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cgetb|cgetbuffer|cgete|cgetexpr|cg|cgetfile|c|change|changes|chd|chdir|che|checkpath|checkt|checktime|cla|clast|cl|clist|clo|close|cmapc|cmapclear|cnew|cnewer|cn|cnext|cN|cNext|cnf|cnfile|cNfcNfile|cnorea|cnoreabbrev|col|colder|colo|colorscheme|comc|comclear|comp|compiler|conf|confirm|con|continue|cope|copen|co|copy|cpf|cpfile|cp|cprevious|cq|cquit|cr|crewind|cuna|cunabbrev|cu|cunmap|cw|cwindow|debugg|debuggreedy|delc|delcommand|d|delete|delf|delfunction|delm|delmarks|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|di|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|earlier|echoe|echoerr|echom|echomsg|echon|e|edit|el|else|elsei|elseif|em|emenu|endfo|endfor|endf|endfunction|endfun|en|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fina|finally|fin|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|folddoc|folddoclosed|foldd|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|ha|hardcopy|h|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iuna|iunabbrev|iu|iunmap|j|join|ju|jumps|k|keepalt|keepj|keepjumps|kee|keepmarks|laddb|laddbuffer|lad|laddexpr|laddf|laddfile|lan|language|la|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|let|left|lefta|leftabove|lex|lexpr|lf|lfile|lfir|lfirst|lgetb|lgetbuffer|lgete|lgetexpr|lg|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|l|list|ll|lla|llast|lli|llist|lmak|lmake|lm|lmap|lmapc|lmapclear|lnew|lnewer|lne|lnext|lN|lNext|lnf|lnfile|lNf|lNfile|ln|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lpf|lpfile|lp|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|mak|make|ma|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkvie|mkview|mkv|mkvimrc|mod|mode|m|move|mzf|mzfile|mz|mzscheme|nbkey|new|n|next|N|Next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|omapc|omapclear|on|only|o|open|opt|options|ou|ounmap|pc|pclose|ped|pedit|pe|perl|perld|perldo|po|pop|popu|popup|pp|ppop|pre|preserve|prev|previous|p|print|P|Print|profd|profdel|prof|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptN|ptNext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|pyf|pyfile|py|python|qa|qall|q|quit|quita|quitall|r|read|rec|recover|redi|redir|red|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|rub|ruby|rubyd|rubydo|rubyf|rubyfile|ru|runtime|rv|rviminfo|sal|sall|san|sandbox|sa|sargument|sav|saveas|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbN|sbNext|sbp|sbprevious|sbr|sbrewind|sb|sbuffer|scripte|scriptencoding|scrip|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sla|slast|sl|sleep|sm|smagic|sm|smap|smapc|smapclear|sme|smenu|sn|snext|sN|sNext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|sor|sort|so|source|spelld|spelldump|spe|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|sp|split|spr|sprevious|sre|srewind|sta|stag|startg|startgreplace|star|startinsert|startr|startreplace|stj|stjump|st|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tab|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabnew|tabn|tabnext|tabN|tabNext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|ta|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tm|tmenu|tn|tnext|tN|tNext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tu|tunmenu|una|unabbreviate|u|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|verb|verbose|ve|version|vert|vertical|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|vi|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|wa|wall|wh|while|winc|wincmd|windo|winp|winpos|win|winsize|wn|wnext|wN|wNext|wp|wprevious|wq|wqa|wqall|w|write|ws|wsverb|wv|wviminfo|X|xa|xall|x|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|XMLent|XMLns|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,
- 'builtin': /\b(?:autocmd|acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|t_AB|t_AF|t_al|t_AL|t_bc|t_cd|t_ce|t_Ce|t_cl|t_cm|t_Co|t_cs|t_Cs|t_CS|t_CV|t_da|t_db|t_dl|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_fs|t_IE|t_IS|t_k1|t_K1|t_k2|t_k3|t_K3|t_k4|t_K4|t_k5|t_K5|t_k6|t_K6|t_k7|t_K7|t_k8|t_K8|t_k9|t_K9|t_KA|t_kb|t_kB|t_KB|t_KC|t_kd|t_kD|t_KD|t_ke|t_KE|t_KF|t_KG|t_kh|t_KH|t_kI|t_KI|t_KJ|t_KK|t_kl|t_KL|t_kN|t_kP|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_RI|t_RV|t_Sb|t_se|t_Sf|t_SI|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_WP|t_WS|t_xs|t_ZH|t_ZR)\b/,
- 'number': /\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,
- 'operator': /\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,
- 'punctuation': /[{}[\](),;:]/
- };
- (function () {
- if (typeof self === 'undefined' || !self.Prism || !self.document) {
- return;
- }
- /**
- * Plugin name which is used as a class name for <pre> which is activating the plugin
- * @type {String}
- */
- var PLUGIN_NAME = 'line-numbers';
-
- /**
- * Regular expression used for determining line breaks
- * @type {RegExp}
- */
- var NEW_LINE_EXP = /\n(?!$)/g;
- /**
- * Resizes line numbers spans according to height of line of code
- * @param {Element} element <pre> element
- */
- var _resizeElement = function (element) {
- var codeStyles = getStyles(element);
- var whiteSpace = codeStyles['white-space'];
- if (whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line') {
- var codeElement = element.querySelector('code');
- var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
- var lineNumberSizer = element.querySelector('.line-numbers-sizer');
- var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
- if (!lineNumberSizer) {
- lineNumberSizer = document.createElement('span');
- lineNumberSizer.className = 'line-numbers-sizer';
- codeElement.appendChild(lineNumberSizer);
- }
- lineNumberSizer.style.display = 'block';
- codeLines.forEach(function (line, lineNumber) {
- lineNumberSizer.textContent = line || '\n';
- var lineSize = lineNumberSizer.getBoundingClientRect().height;
- lineNumbersWrapper.children[lineNumber].style.height = lineSize + 'px';
- });
- lineNumberSizer.textContent = '';
- lineNumberSizer.style.display = 'none';
- }
- };
- /**
- * Returns style declarations for the element
- * @param {Element} element
- */
- var getStyles = function (element) {
- if (!element) {
- return null;
- }
- return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
- };
- window.addEventListener('resize', function () {
- Array.prototype.forEach.call(document.querySelectorAll('pre.' + PLUGIN_NAME), _resizeElement);
- });
- Prism.hooks.add('complete', function (env) {
- if (!env.code) {
- return;
- }
- // works only for <code> wrapped inside <pre> (not inline)
- var pre = env.element.parentNode;
- var clsReg = /\s*\bline-numbers\b\s*/;
- if (
- !pre || !/pre/i.test(pre.nodeName) ||
- // Abort only if nor the <pre> nor the <code> have the class
- (!clsReg.test(pre.className) && !clsReg.test(env.element.className))
- ) {
- return;
- }
- if (env.element.querySelector('.line-numbers-rows')) {
- // Abort if line numbers already exists
- return;
- }
- if (clsReg.test(env.element.className)) {
- // Remove the class 'line-numbers' from the <code>
- env.element.className = env.element.className.replace(clsReg, ' ');
- }
- if (!clsReg.test(pre.className)) {
- // Add the class 'line-numbers' to the <pre>
- pre.className += ' line-numbers';
- }
- var match = env.code.match(NEW_LINE_EXP);
- var linesNum = match ? match.length + 1 : 1;
- var lineNumbersWrapper;
- var lines = new Array(linesNum + 1);
- lines = lines.join('<span></span>');
- lineNumbersWrapper = document.createElement('span');
- lineNumbersWrapper.setAttribute('aria-hidden', 'true');
- lineNumbersWrapper.className = 'line-numbers-rows';
- lineNumbersWrapper.innerHTML = lines;
- if (pre.hasAttribute('data-start')) {
- pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
- }
- env.element.appendChild(lineNumbersWrapper);
- _resizeElement(pre);
- Prism.hooks.run('line-numbers', env);
- });
- Prism.hooks.add('line-numbers', function (env) {
- env.plugins = env.plugins || {};
- env.plugins.lineNumbers = true;
- });
-
- /**
- * Global exports
- */
- Prism.plugins.lineNumbers = {
- /**
- * Get node for provided line number
- * @param {Element} element pre element
- * @param {Number} number line number
- * @return {Element|undefined}
- */
- getLine: function (element, number) {
- if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
- return;
- }
- var lineNumberRows = element.querySelector('.line-numbers-rows');
- var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
- var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
- if (number < lineNumberStart) {
- number = lineNumberStart;
- }
- if (number > lineNumberEnd) {
- number = lineNumberEnd;
- }
- var lineIndex = number - lineNumberStart;
- return lineNumberRows.children[lineIndex];
- }
- };
- }());
- (function(){
- if (
- typeof self !== 'undefined' && !self.Prism ||
- typeof global !== 'undefined' && !global.Prism
- ) {
- return;
- }
- var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&]+(?:\?[\w\-+%~/.:#=?&!$'()*,;]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;]*)?/,
- email = /\b\S+@[\w.]+[a-z]{2}/,
- linkMd = /\[([^\]]+)]\(([^)]+)\)/,
-
- // Tokens that may contain URLs and emails
- candidates = ['comment', 'url', 'attr-value', 'string'];
- Prism.plugins.autolinker = {
- processGrammar: function (grammar) {
- // Abort if grammar has already been processed
- if (!grammar || grammar['url-link']) {
- return;
- }
- Prism.languages.DFS(grammar, function (key, def, type) {
- if (candidates.indexOf(type) > -1 && Prism.util.type(def) !== 'Array') {
- if (!def.pattern) {
- def = this[key] = {
- pattern: def
- };
- }
- def.inside = def.inside || {};
- if (type == 'comment') {
- def.inside['md-link'] = linkMd;
- }
- if (type == 'attr-value') {
- Prism.languages.insertBefore('inside', 'punctuation', { 'url-link': url }, def);
- }
- else {
- def.inside['url-link'] = url;
- }
- def.inside['email-link'] = email;
- }
- });
- grammar['url-link'] = url;
- grammar['email-link'] = email;
- }
- };
- Prism.hooks.add('before-highlight', function(env) {
- Prism.plugins.autolinker.processGrammar(env.grammar);
- });
- Prism.hooks.add('wrap', function(env) {
- if (/-link$/.test(env.type)) {
- env.tag = 'a';
-
- var href = env.content;
-
- if (env.type == 'email-link' && href.indexOf('mailto:') != 0) {
- href = 'mailto:' + href;
- }
- else if (env.type == 'md-link') {
- // Markdown
- var match = env.content.match(linkMd);
-
- href = match[2];
- env.content = match[1];
- }
-
- env.attributes.href = href;
- }
- // Silently catch any error thrown by decodeURIComponent (#1186)
- try {
- env.content = decodeURIComponent(env.content);
- } catch(e) {}
- });
- })();
- (function(){
- if (
- typeof self !== 'undefined' && !self.Prism ||
- typeof global !== 'undefined' && !global.Prism
- ) {
- return;
- }
- if (Prism.languages.css) {
- // check whether the selector is an advanced pattern before extending it
- if (Prism.languages.css.selector.pattern)
- {
- Prism.languages.css.selector.inside['pseudo-class'] = /:[\w-]+/;
- Prism.languages.css.selector.inside['pseudo-element'] = /::[\w-]+/;
- }
- else
- {
- Prism.languages.css.selector = {
- pattern: Prism.languages.css.selector,
- inside: {
- 'pseudo-class': /:[\w-]+/,
- 'pseudo-element': /::[\w-]+/
- }
- };
- }
- }
- if (Prism.languages.markup) {
- Prism.languages.markup.tag.inside.tag.inside['tag-id'] = /[\w-]+/;
-
- var Tags = {
- HTML: {
- 'a': 1, 'abbr': 1, 'acronym': 1, 'b': 1, 'basefont': 1, 'bdo': 1, 'big': 1, 'blink': 1, 'cite': 1, 'code': 1, 'dfn': 1, 'em': 1, 'kbd': 1, 'i': 1,
- 'rp': 1, 'rt': 1, 'ruby': 1, 's': 1, 'samp': 1, 'small': 1, 'spacer': 1, 'strike': 1, 'strong': 1, 'sub': 1, 'sup': 1, 'time': 1, 'tt': 1, 'u': 1,
- 'var': 1, 'wbr': 1, 'noframes': 1, 'summary': 1, 'command': 1, 'dt': 1, 'dd': 1, 'figure': 1, 'figcaption': 1, 'center': 1, 'section': 1, 'nav': 1,
- 'article': 1, 'aside': 1, 'hgroup': 1, 'header': 1, 'footer': 1, 'address': 1, 'noscript': 1, 'isIndex': 1, 'main': 1, 'mark': 1, 'marquee': 1,
- 'meter': 1, 'menu': 1
- },
- SVG: {
- 'animateColor': 1, 'animateMotion': 1, 'animateTransform': 1, 'glyph': 1, 'feBlend': 1, 'feColorMatrix': 1, 'feComponentTransfer': 1,
- 'feFuncR': 1, 'feFuncG': 1, 'feFuncB': 1, 'feFuncA': 1, 'feComposite': 1, 'feConvolveMatrix': 1, 'feDiffuseLighting': 1, 'feDisplacementMap': 1,
- 'feFlood': 1, 'feGaussianBlur': 1, 'feImage': 1, 'feMerge': 1, 'feMergeNode': 1, 'feMorphology': 1, 'feOffset': 1, 'feSpecularLighting': 1,
- 'feTile': 1, 'feTurbulence': 1, 'feDistantLight': 1, 'fePointLight': 1, 'feSpotLight': 1, 'linearGradient': 1, 'radialGradient': 1, 'altGlyph': 1,
- 'textPath': 1, 'tref': 1, 'altglyph': 1, 'textpath': 1, 'altglyphdef': 1, 'altglyphitem': 1, 'clipPath': 1, 'color-profile': 1, 'cursor': 1,
- 'font-face': 1, 'font-face-format': 1, 'font-face-name': 1, 'font-face-src': 1, 'font-face-uri': 1, 'foreignObject': 1, 'glyphRef': 1,
- 'hkern': 1, 'vkern': 1
- },
- MathML: {}
- }
- }
- var language;
- Prism.hooks.add('wrap', function(env) {
- if ((env.type == 'tag-id'
- || (env.type == 'property' && env.content.indexOf('-') != 0)
- || (env.type == 'rule'&& env.content.indexOf('@-') != 0)
- || (env.type == 'pseudo-class'&& env.content.indexOf(':-') != 0)
- || (env.type == 'pseudo-element'&& env.content.indexOf('::-') != 0)
- || (env.type == 'attr-name' && env.content.indexOf('data-') != 0)
- ) && env.content.indexOf('<') === -1
- ) {
- if (env.language == 'css'
- || env.language == 'scss'
- || env.language == 'markup'
- ) {
- var href = 'https://webplatform.github.io/docs/';
- var content = env.content;
- if (env.language == 'css' || env.language == 'scss') {
- href += 'css/';
- if (env.type == 'property') {
- href += 'properties/';
- }
- else if (env.type == 'rule') {
- href += 'atrules/';
- content = content.substring(1);
- }
- else if (env.type == 'pseudo-class') {
- href += 'selectors/pseudo-classes/';
- content = content.substring(1);
- }
- else if (env.type == 'pseudo-element') {
- href += 'selectors/pseudo-elements/';
- content = content.substring(2);
- }
- }
- else if (env.language == 'markup') {
- if (env.type == 'tag-id') {
- // Check language
- language = getLanguage(env.content) || language;
- if (language) {
- href += language + '/elements/';
- }
- else {
- return; // Abort
- }
- }
- else if (env.type == 'attr-name') {
- if (language) {
- href += language + '/attributes/';
- }
- else {
- return; // Abort
- }
- }
- }
- href += content;
- env.tag = 'a';
- env.attributes.href = href;
- env.attributes.target = '_blank';
- }
- }
- });
- function getLanguage(tag) {
- var tagL = tag.toLowerCase();
-
- if (Tags.HTML[tagL]) {
- return 'html';
- }
- else if (Tags.SVG[tag]) {
- return 'svg';
- }
- else if (Tags.MathML[tag]) {
- return 'mathml';
- }
-
- // Not in dictionary, perform check
- if (Tags.HTML[tagL] !== 0 && typeof document !== 'undefined') {
- var htmlInterface = (document.createElement(tag).toString().match(/\[object HTML(.+)Element\]/) || [])[1];
-
- if (htmlInterface && htmlInterface != 'Unknown') {
- Tags.HTML[tagL] = 1;
- return 'html';
- }
- }
-
- Tags.HTML[tagL] = 0;
-
- if (Tags.SVG[tag] !== 0 && typeof document !== 'undefined') {
- var svgInterface = (document.createElementNS('http://www.w3.org/2000/svg', tag).toString().match(/\[object SVG(.+)Element\]/) || [])[1];
-
- if (svgInterface && svgInterface != 'Unknown') {
- Tags.SVG[tag] = 1;
- return 'svg';
- }
- }
-
- Tags.SVG[tag] = 0;
-
- // Lame way to detect MathML, but browsers don’t expose interface names there :(
- if (Tags.MathML[tag] !== 0) {
- if (tag.indexOf('m') === 0) {
- Tags.MathML[tag] = 1;
- return 'mathml';
- }
- }
-
- Tags.MathML[tag] = 0;
-
- return null;
- }
- })();
- (function() {
- if (typeof self === 'undefined' || !self.Prism || !self.document) {
- return;
- }
- var clsReg = /\s*\bcommand-line\b\s*/;
- Prism.hooks.add('before-highlight', function (env) {
- env.vars = env.vars || {};
- env.vars['command-line'] = env.vars['command-line'] || {};
- if (env.vars['command-line'].complete || !env.code) {
- env.vars['command-line'].complete = true;
- return;
- }
- // Works only for <code> wrapped inside <pre> (not inline).
- var pre = env.element.parentNode;
- if (!pre || !/pre/i.test(pre.nodeName) || // Abort only if neither the <pre> nor the <code> have the class
- (!clsReg.test(pre.className) && !clsReg.test(env.element.className))) {
- env.vars['command-line'].complete = true;
- return;
- }
- if (env.element.querySelector('.command-line-prompt')) { // Abort if prompt already exists.
- env.vars['command-line'].complete = true;
- return;
- }
- var codeLines = env.code.split('\n');
- env.vars['command-line'].numberOfLines = codeLines.length;
- env.vars['command-line'].outputLines = [];
- var outputSections = pre.getAttribute('data-output');
- var outputFilter = pre.getAttribute('data-filter-output');
- if (outputSections || outputSections === '') { // The user specified the output lines. -- cwells
- outputSections = outputSections.split(',');
- for (var i = 0; i < outputSections.length; i++) { // Parse the output sections into start/end ranges. -- cwells
- var range = outputSections[i].split('-');
- var outputStart = parseInt(range[0], 10);
- var outputEnd = (range.length === 2 ? parseInt(range[1], 10) : outputStart);
- if (!isNaN(outputStart) && !isNaN(outputEnd)) {
- if (outputStart < 1) {
- outputStart = 1;
- }
- if (outputEnd > codeLines.length) {
- outputEnd = codeLines.length;
- }
- // Convert start and end to 0-based to simplify the arrays. -- cwells
- outputStart--;
- outputEnd--;
- // Save the output line in an array and clear it in the code so it's not highlighted. -- cwells
- for (var j = outputStart; j <= outputEnd; j++) {
- env.vars['command-line'].outputLines[j] = codeLines[j];
- codeLines[j] = '';
- }
- }
- }
- } else if (outputFilter) { // Treat lines beginning with this string as output. -- cwells
- for (var i = 0; i < codeLines.length; i++) {
- if (codeLines[i].indexOf(outputFilter) === 0) { // This line is output. -- cwells
- env.vars['command-line'].outputLines[i] = codeLines[i].slice(outputFilter.length);
- codeLines[i] = '';
- }
- }
- }
- env.code = codeLines.join('\n');
- });
- Prism.hooks.add('before-insert', function (env) {
- env.vars = env.vars || {};
- env.vars['command-line'] = env.vars['command-line'] || {};
- if (env.vars['command-line'].complete) {
- return;
- }
- // Reinsert the output lines into the highlighted code. -- cwells
- var codeLines = env.highlightedCode.split('\n');
- for (var i = 0; i < env.vars['command-line'].outputLines.length; i++) {
- if (env.vars['command-line'].outputLines.hasOwnProperty(i)) {
- codeLines[i] = env.vars['command-line'].outputLines[i];
- }
- }
- env.highlightedCode = codeLines.join('\n');
- });
- Prism.hooks.add('complete', function (env) {
- env.vars = env.vars || {};
- env.vars['command-line'] = env.vars['command-line'] || {};
- if (env.vars['command-line'].complete) {
- return;
- }
- var pre = env.element.parentNode;
- if (clsReg.test(env.element.className)) { // Remove the class "command-line" from the <code>
- env.element.className = env.element.className.replace(clsReg, ' ');
- }
- if (!clsReg.test(pre.className)) { // Add the class "command-line" to the <pre>
- pre.className += ' command-line';
- }
- var getAttribute = function(key, defaultValue) {
- return (pre.getAttribute(key) || defaultValue).replace(/"/g, '"');
- };
- // Create the "rows" that will become the command-line prompts. -- cwells
- var promptLines = new Array(env.vars['command-line'].numberOfLines + 1);
- var promptText = getAttribute('data-prompt', '');
- if (promptText !== '') {
- promptLines = promptLines.join('<span data-prompt="' + promptText + '"></span>');
- } else {
- var user = getAttribute('data-user', 'user');
- var host = getAttribute('data-host', 'localhost');
- promptLines = promptLines.join('<span data-user="' + user + '" data-host="' + host + '"></span>');
- }
- // Create the wrapper element. -- cwells
- var prompt = document.createElement('span');
- prompt.className = 'command-line-prompt';
- prompt.innerHTML = promptLines;
- // Remove the prompt from the output lines. -- cwells
- for (var i = 0; i < env.vars['command-line'].outputLines.length; i++) {
- if (env.vars['command-line'].outputLines.hasOwnProperty(i)) {
- var node = prompt.children[i];
- node.removeAttribute('data-user');
- node.removeAttribute('data-host');
- node.removeAttribute('data-prompt');
- }
- }
- env.element.insertBefore(prompt, env.element.firstChild);
- env.vars['command-line'].complete = true;
- });
- }());
|