PageSourceSearch

https://rentry.co/static/codemirror/mode/markdown/markdown.min.js?v=1789749960

js rentry.co collected 2026-09-24 08:29:19 UTC 13,594 bytes, 27 lines download raw bytes

1(function(k){"object"==typeof exports&&"object"==typeof module?k(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],k):k(CodeMirror)})(function(k){k.defineMode("markdown",function(A,d){function y(b,a,c){a.f=a.inline=c;return c(b,a)}function B(b){b.linkTitle=!1;b.linkHref=!1;b.linkText=!1;b.em=!1;b.strong=!1;b.strikethrough=!1;b.mark=!1;1<=b.code&&(b.code=0);b.quote=0;b.indentedCode=
2!1;b.f==v&&(b.f=n,b.block=w);b.trailingSpace=0;b.trailingSpaceNewLine=!1;b.prevLine=b.thisLine;b.thisLine={stream:null};return null}function w(b,a){var c=b.column()===a.indentation,e=a.prevLine.stream;var m=!e||!/\S/.test(e.string);var p=a.indentedCode,h=a.prevLine.hr,u=a.prevLine.header,q=!1!==a.list,l=(a.listStack[a.listStack.length-1]||0)+3,G=!m&&!h&&!u;a.indentedCode=!1;e=a.indentation;if(null===a.indentationDiff&&(a.indentationDiff=a.indentation,q)){a.em=!1;a.strong=!1;a.code=!1;a.strikethrough=
3!1;a.mark=!1;for(a.list=null;e<a.listStack[a.listStack.length-1];)a.listStack.pop(),a.listStack.length?a.indentation=a.listStack[a.listStack.length-1]:a.list=!1;!1!==a.list&&(a.indentationDiff=e-a.listStack[a.listStack.length-1])}var H=!m&&!h&&!a.prevLine.header&&(!q||!p)&&!a.prevLine.fencedCodeEnd,z=(!1===a.list||h||m)&&a.indentation<=l&&b.match(I);h=null;if(4<=a.indentationDiff&&(p||a.prevLine.fencedCodeEnd||a.prevLine.header||m))return b.skipToEnd(),a.indentedCode=!0,g.code;if(b.eatSpace())return null;
4if(c&&a.indentation<=l&&(h=b.match(J))&&6>=h[1].length)return a.quote=0,a.header=h[1].length,a.thisLine.header=!0,d.highlightFormatting&&(a.formatting="header"),a.f=a.inline,f(a);if(a.indentation<=l&&b.eat(">"))return 1<=a.code&&(a.code=0),a.quote=c?1:a.quote+1,d.highlightFormatting&&(a.formatting="quote"),b.eatSpace(),f(a);if(!z&&!a.setext&&c&&(m||q||u||G)&&a.indentation<=l&&(h=b.match(K)))return c=h[1]?"ol":"ul",a.indentation=e+b.current().length,a.list=!0,a.quote=0,a.listStack.push(a.indentation),
5d.taskLists&&b.match(C,!1)&&(a.taskList=!0),a.f=a.inline,d.highlightFormatting&&(a.formatting=["list","list-"+c]),f(a);if(c&&a.indentation<=l&&(h=b.match(L,!0))){a.quote=0;a.fencedEndRE=new RegExp(h[1]+"+ *$");if(c=d.fencedCodeBlockHighlighting)c=h[2],k.findModeByName&&(e=k.findModeByName(c))&&(c=e.mime||e.mimes[0]),c=k.getMode(A,c),c="null"==c.name?null:c;a.localMode=c;a.localMode&&(a.localState=k.startState(a.localMode));a.f=a.block=M;d.highlightFormatting&&(a.formatting="code-block");a.code=-1;
6return f(a)}if(a.setext||!(H&&q||a.quote||!1!==a.list||a.code||a.mark||z||N.test(b.string))&&(h=b.lookAhead(1))&&(h=h.match(O)))return a.setext?(a.header=a.setext,a.setext=0,b.skipToEnd(),d.highlightFormatting&&(a.formatting="header")):(a.header="="==h[0].charAt(0)?1:2,a.setext=a.header),a.thisLine.header=!0,a.f=a.inline,f(a);if(z)return b.skipToEnd(),a.hr=!0,a.thisLine.hr=!0,g.hr;if(a.indentation<=l&&b.match(P))a.formatting="admonition";else if("["===b.peek())if(b.match(Q))a.formatting="toc";else return y(b,
7a,R);else a.indentation<=l&&!b.eat(">
7")&&c&&0!==a.quote&&!b.string.startsWith(">")&&(a.quote=0,a.formatting=!1);return y(b,a,a.inline)}function v(b,a){var c=r.token(b,a.htmlState);if(!S){var e=k.innerMode(r,a.htmlState);if("xml"==e.mode.name&&null===e.state.tagStart&&!e.state.context&&e.state.tokenize.isInText||a.md_inside&&-1<b.current().indexOf(">"))a.f=n,a.block=w,a.htmlState=null}return c}function M(b,a){var c=a.listStack[a.listStack.length-1]||0,e=a.indentation<c;if(a.fencedEndRE&&a.indentation<=
8c+3&&(e||b.match(a.fencedEndRE))){d.highlightFormatting&&(a.formatting="code-block");var m;e||(m=f(a));a.localMode=a.localState=null;a.block=w;a.f=n;a.fencedEndRE=null;a.code=0;a.thisLine.fencedCodeEnd=!0;return e?(c=a.block,a.f=a.block=c,c(b,a)):m}if(a.localMode)return a.localMode.token(b,a.localState);b.skipToEnd();return g.code}function f(b){var a=[];if(b.formatting){a.push(g.formatting);"string"===typeof b.formatting&&(b.formatting=[b.formatting]);for(var c=0;c<b.formatting.length;c++)a.push(g.formatting+
9"-"+b.formatting[c]),"header"===b.formatting[c]&&a.push(g.formatting+"-"+b.formatting[c]+"-"+b.header),"quote"===b.formatting[c]&&(!d.maxBlockquoteDepth||d.maxBlockquoteDepth>=b.quote?a.push(g.formatting+"-"+b.formatting[c]+"-"+b.quote):a.push("error"))}if(b.taskOpen)return a.push("meta"),a.length?a.join(" "):null;if(b.taskClosed)return a.push("property"),a.length?a.join(" "):null;b.linkHref?a.push(g.linkHref,"url"):(b.strong&&a.push(g.strong),b.em&&a.push(g.em),b.strikethrough&&a.push(g.strikethrough),
10b.mark&&a.push(g.mark),b.emoji&&a.push(g.emoji),b.linkText&&a.push(g.linkText),b.code&&a.push(g.code),b.image&&a.push(g.image),b.imageAltText&&a.push(g.imageAltText,"link"),b.imageMarker&&a.push(g.imageMarker));b.header&&a.push(g.header,g.header+"-"+b.header);b.quote&&(a.push(g.quote),!d.maxBlockquoteDepth||d.maxBlockquoteDepth>=b.quote?a.push(g.quote+"-"+b.quote):a.push(g.quote+"-"+d.maxBlockquoteDepth));!1!==b.list&&((b.listStack.length-1)%2?a.push(g.list2):a.push(g.list1));b.trailingSpaceNewLine?
11a.push("trailing-space-new-line"):b.trailingSpace&&a.push("trailing-space-"+(b.trailingSpace%2?"a":"b"));return a.length?a.join(" "):null}function T(b,a){if(b.match(U,!0))return f(a)}function n(b,a){var c=a.text(b,a);if("undefined"!==typeof c)return c;if(a.list)return a.list=null,f(a);if(a.taskList)return" "===b.match(C,!0)[1]?a.taskOpen=!0:a.taskClosed=!0,d.highlightFormatting&&(a.formatting="task"),a.taskList=!1,f(a);a.taskOpen=!1;a.taskClosed=!1;if(a.header&&b.match(/^#+$/,!0))return d.highlightFormatting&&
12(a.formatting="header"),f(a);c=b.next();if(a.linkTitle){a.linkTitle=!1;var e=c;"("===c&&(e=")");e=(e+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");if(b.match(new RegExp("^\\s*(?:[^"+e+"\\\\]+|\\\\\\\\|\\\\.)"+e),!0))return g.linkHref}if("`"===c){c=a.formatting;d.highlightFormatting&&(a.formatting="code");b.eatWhile("`");e=b.current().length;if(0!=a.code||a.quote&&1!=e){if(e==a.code)return c=f(a),a.code=0,c;a.formatting=c;return f(a)}a.code=e;return f(a)}if(a.code)return f(a);if("\\"===c&&(b.next(),
13d.highlightFormatting))return c=f(a),e=g.formatting+"-escape",c?c+" "+e:e;if("!"===c&&b.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return a.imageMarker=!0,a.image=!0,d.highlightFormatting&&(a.formatting="image"),f(a);if("["===c&&a.imageMarker&&b.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return a.imageMarker=!1,a.imageAltText=!0,d.highlightFormatting&&(a.formatting="image"),f(a);if("]"===c&&a.imageAltText)return d.highlightFormatting&&(a.formatting="image"),c=f(a),a.imageAltText=!1,a.image=!1,a.inline=a.f=D,
14c;if("["===c&&!a.image){if(a.linkText&&b.match(/^.*?\]/))return f(a);a.linkText=!0;d.highlightFormatting&&(a.formatting="link");return f(a)}if("]"===c&&a.linkText)return d.highlightFormatting&&(a.formatting="link"),c=f(a),a.linkText=!1,a.inline=a.f=b.match(/\(.*?\)| ?\[.*?\]/,!1)?D:n,c;if("<"===c&&b.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return a.f=a.inline=E,d.highlightFormatting&&(a.formatting="link"),c=f(a),(c?c+" ":"")+g.linkInline;if("<"===c&&b.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return a.f=
15a.inline=E,d.highlightFormatting&&(a.formatting="link"),c=f(a),(c?c+" ":"")+g.linkEmail;if(d.xml&&"<"===c&&b.match(/^(!--|[a-z]+(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*>)/i,!1))return c=b.string.indexOf(">",b.pos),-1!=c&&(c=b.string.substring(b.start,c),/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(c)&&(a.md_inside=!0)),b.backUp(1),a.htmlState=k.startState(r),c=v,a.f=a.block=c,c(b,a);if(d.xml&&"<"===c&&b.match(/^\/\w*?>/))return a.md_inside=!1,"tag";if("*"===c||"_"===c){for(var m=1,p=1==b.pos?" ":b.string.charAt(b.pos-
162);3>m&&b.eat(c);)m++;var h=b.peek()||" ",u=!/\s/.test(h)&&(!t.test(h)||/\s/.test(p)||t.test(p)),q=!/\s/.test(p)&&(!t.test(p)||/\s/.test(h)||t.test(h)),l=e=null;m%2&&(a.em||!u||"*"!==c&&q&&!t.test(p)?a.em!=c||!q||"*"!==c&&u&&!t.test(h)||(e=!1):e=!0);1<m&&(a.strong||!u||"*"!==c&&q&&!t.test(p)?a.strong!=c||!q||"*"!==c&&u&&!t.test(h)||(l=!1):l=!0);if(null!=l||null!=e)return d.highlightFormatting&&(a.formatting=null==e?"strong":null==l?"em":"strong em"),!0===e&&(a.em=c),!0===l&&(a.strong=c),c=f(a),!1===
17e&&(a.em=!1),!1===l&&(a.strong=!1),c}else if(" "===c&&(b.eat("*")||b.eat("_"))){if(" "===b.peek())return f(a);b.backUp(1)}if(d.strikethrough)if("~"===c&&b.eatWhile(c)){if(a.strikethrough)return d.highlightFormatting&&(a.formatting="strikethrough"),c=f(a),a.strikethrough=!1,c;if(b.match(/^[^\s]/,!1))return a.strikethrough=!0,d.highlightFormatting&&(a.formatting="strikethrough"),f(a)}else if(" "===c&&b.match(/^~~/,!0)){if(" "===b.peek())return f(a);b.backUp(2)}if(d.mark)if("="===c&&b.eatWhile(c)){if(a.mark)return d.highlightFormatting&&
18(a.formatting="mark"),c=f(a),a.mark=!1,c;if(b.match(/^[^\s]/,!1))return a.mark=!0,d.highlightFormatting&&(a.formatting="mark"),f(a)}else if(" "===c&&b.match(/^==/,!0)){if(" "===b.peek())return f(a);b.backUp(2)}if(d.emoji&&":"===c&&b.match(/^[a-z_\d+-]+:/))return a.emoji=!0,d.highlightFormatting&&(a.formatting="emoji"),c=f(a),a.emoji=!1,c;" "===c&&(b.match(/^ +$/,!1)?a.trailingSpace++:a.trailingSpace&&(a.trailingSpaceNewLine=!0));return f(a)}function E(b,a){if(">"===b.next()){a.f=a.inline=n;d.highlightFormatting&&
19(a.formatting="link");var c=f(a);return(c?c+" ":"")+g.linkInline}b.match(/^[^>]+/,!0);return g.linkInline}function D(b,a){if(b.eatSpace())return null;var c=b.next();return"("===c||"["===c?(a.f=a.inline=V("("===c?")":"]"),d.highlightFormatting&&(a.formatting="link-string"),a.linkHref=!0,f(a)):"error"}
19function V(b){return function(a,c){if(a.next()===b){c.f=c.inline=n;d.highlightFormatting&&(c.formatting="link-string");var e=f(c);c.linkHref=!1;return e}a.match(W[b]);c.linkHref=!0;return f(c)}}function R(b,
20a){return b.match(/^([^\]\\]|\\.)*\]:/,!1)?(a.f=X,b.next(),d.highlightFormatting&&(a.formatting="link"),a.linkText=!0,f(a)):y(b,a,n)}function X(b,a){if(b.match(/^\]:/,!0)){a.f=a.inline=Y;d.highlightFormatting&&(a.formatting="link");var c=f(a);a.linkText=!1;return c}b.match(/^([^\]\\]|\\.)+/,!0);return g.linkText}function Y(b,a){if(b.eatSpace())return null;b.match(/^[^\s]+/,!0);void 0===b.peek()?a.linkTitle=!0:b.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,
21!0);a.f=a.inline=n;return g.linkHref+" url"}var r=k.getMode(A,"text/html"),S="null"==r.name;void 0===d.highlightFormatting&&(d.highlightFormatting=!1);void 0===d.maxBlockquoteDepth&&(d.maxBlockquoteDepth=0);void 0===d.taskLists&&(d.taskLists=!1);void 0===d.strikethrough&&(d.strikethrough=!1);void 0===d.mark&&(d.mark=!1);void 0===d.emoji&&(d.emoji=!1);void 0===d.fencedCodeBlockHighlighting&&(d.fencedCodeBlockHighlighting=!0);void 0===d.xml&&(d.xml=!0);void 0===d.tokenTypeOverrides&&(d.tokenTypeOverrides=
22{});var g={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"keyword",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",mark:"mark",emoji:"builtin"},x;for(x in g)g.hasOwnProperty(x)&&d.tokenTypeOverrides[x]&&(g[x]=d.tokenTypeOverrides[x]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,K=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,
23C=/^\[(x| )\](?=\s)/i,J=d.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ *(?:={1,}|-{1,})\s*$/,U=/^[^#!\[\]*_\\<=>` "'(~:]+/,L=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,N=/^\s*\[[^\]]+?\]:.*$/,t=/[!"#$%&'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~\u2014]/,Q=/^\[TOC[1-6]?\]\s*$/,P=/^!!!/,W={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/},F={startState:function(){return{f:w,prevLine:{stream:null},thisLine:{stream:null},block:w,htmlState:null,
24indentation:0,inline:n,text:T,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,mark:!1,emoji:!1,fencedEndRE:null}},copyState:function(b){return{f:b.f,prevLine:b.prevLine,thisLine:b.thisLine,block:b.block,htmlState:b.htmlState&&k.copyState(r,b.htmlState),indentation:b.indentation,localMode:b.localMode,localState:b.localMode?k.copyState(b.localMode,b.localState):
25null,inline:b.inline,text:b.text,formatting:!1,linkText:b.linkText,linkTitle:b.linkTitle,linkHref:b.linkHref,code:b.code,em:b.em,strong:b.strong,strikethrough:b.strikethrough,mark:b.mark,emoji:b.emoji,header:b.header,setext:b.setext,hr:b.hr,taskList:b.taskList,list:b.list,listStack:b.listStack.slice(0),quote:b.quote,indentedCode:b.indentedCode,trailingSpace:b.trailingSpace,trailingSpaceNewLine:b.trailingSpaceNewLine,md_inside:b.md_inside,fencedEndRE:b.fencedEndRE}},token:function(b,a){a.formatting=
26!1;if(b!=a.thisLine.stream){a.header=0;a.hr=!1;if(b.match(/^\s*$/,!0))return B(a),null;a.prevLine=a.thisLine;a.thisLine={stream:b};a.taskList=!1;a.trailingSpace=0;a.trailingSpaceNewLine=!1;if(!a.localState&&(a.f=a.block,a.f!=v)){var c=b.match(/^\s*/,!0)[0].replace(/\t/g,"    ").length;a.indentation=c;a.indentationDiff=null;if(0<c)return null}}return a.f(b,a)},innerMode:function(b){return b.block==v?{state:b.htmlState,mode:r}:b.localState?{state:b.localState,mode:b.localMode}:{state:b,mode:F}},indent:function(b,
27a,c){return b.block==v&&r.indent?r.indent(b.htmlState,a,c):b.localState&&b.localMode.indent?b.localMode.indent(b.localState,a,c):k.Pass},blankLine:B,getType:f,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return F},"xml");k.defineMIME("text/markdown","markdown");k.defineMIME("text/x-markdown","markdown")});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.