forked from circlecloud/tera
1
0
Fork 0
tera/src/HTML/JS/marked.js

1 line
24 KiB
JavaScript
Raw Normal View History

!function(e) { "use strict"; var k = { newline: /^\n+/, code: /^( {4}[^\n]+\n*)+/, fences: g, hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/, nptable: g, blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, html: "^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))", def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, table: g, lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, text: /^[^\n]+/ }; function a(e) { this.tokens = [], this.tokens.links = Object.create(null), this.options = e || d.defaults, this.rules = k.normal, this.options.pedantic ? this.rules = k.pedantic : this.options.gfm && (this.options.tables ? this.rules = k.tables : this.rules = k.gfm) } k._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/, k._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/, k.def = t(k.def).replace("label", k._label).replace("title", k._title).getRegex(), k.bullet = /(?:[*+-]|\d+\.)/, k.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/, k.item = t(k.item, "gm").replace(/bull/g, k.bullet).getRegex(), k.list = t(k.list).replace(/bull/g, k.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + k.def.source + ")").getRegex(), k._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", k._comment = /<!--(?!-?>)[\s\S]*?-->/, k.html = t(k.html, "i").replace("comment", k._comment).replace("tag", k._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), k.paragraph = t(k.paragraph).replace("hr", k.hr).replace("heading", k.heading).replace("lheading", k.lheading).replace("tag", k._tag).getRegex(), k.blockquote = t(k.blockquote).replace("paragraph", k.paragraph).getRegex(), k.normal = f({}, k), k.gfm = f({}, k.normal, { fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, paragraph: /^/, heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ }), k.gfm.paragraph = t(k.paragraph).replace("(?!", "(?!" + k.gfm.fences.source.replace("\\1", "\\2") + "|" + k.list.source.replace("\\1", "\\3") + "|").getRegex(), k.tables = f({}, k.gfm, { nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ }), k.pedantic = f({}, k.normal, { html: t("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", k._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/ }), a.rules = k, a.lex = function(e, t) { return new a(t).lex(e) }, a.prototype.lex = function(e) { return e = e.replace(/\r\n|\r/g, "\n").replace(/\t/g, " ").replace(/\u00a0/g, " ").replace(/\u2424/g, "\n"), this.token(e, !0) }, a.prototype.token = function(e, t) { var n, r, s, i, l, o, a, h, p, c, u, g, f, d, b, m; for (e = e.replace(/^ +$/gm, ""); e;)if ((s = this.rules.newline.exec(e)) && (e = e.substring(s[0].len