diff options
Diffstat (limited to 'public/prism/prism-markdown.min.js')
| -rw-r--r-- | public/prism/prism-markdown.min.js | 149 |
1 files changed, 71 insertions, 78 deletions
diff --git a/public/prism/prism-markdown.min.js b/public/prism/prism-markdown.min.js index ba1b36f..32436d7 100644 --- a/public/prism/prism-markdown.min.js +++ b/public/prism/prism-markdown.min.js @@ -1,5 +1,5 @@ -!(function (s) { - function n(n) { +!(function (n) { + function e(n) { return ( (n = n.replace(/<inner>/g, function () { return '(?:\\\\.|[^\\\\\n\r]|(?:\n|\r\n?)(?![\r\n]))'; @@ -7,17 +7,17 @@ RegExp('((?:^|[^\\\\])(?:\\\\{2})*)(?:' + n + ')') ); } - var e = '(?:\\\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\\\|\r\n`])+', - t = '\\|?__(?:\\|__)+\\|?(?:(?:\n|\r\n?)|(?![^]))'.replace( + var t = '(?:\\\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\\\|\r\n`])+', + a = '\\|?__(?:\\|__)+\\|?(?:(?:\n|\r\n?)|(?![^]))'.replace( /__/g, function () { - return e; + return t; } ), - a = + i = '\\|?[ \t]*:?-{3,}:?[ \t]*(?:\\|[ \t]*:?-{3,}:?[ \t]*)+\\|?(?:\n|\r\n?)'; - (s.languages.markdown = s.languages.extend('markup', {})), - s.languages.insertBefore('markdown', 'prolog', { + (n.languages.markdown = n.languages.extend('markup', {})), + n.languages.insertBefore('markdown', 'prolog', { 'front-matter-block': { pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/, lookbehind: !0, @@ -27,37 +27,37 @@ 'front-matter': { pattern: /\S+(?:\s+\S+)*/, alias: ['yaml', 'language-yaml'], - inside: s.languages.yaml, + inside: n.languages.yaml, }, }, }, blockquote: { pattern: /^>(?:[\t ]*>)*/m, alias: 'punctuation' }, table: { - pattern: RegExp('^' + t + a + '(?:' + t + ')*', 'm'), + pattern: RegExp('^' + a + i + '(?:' + a + ')*', 'm'), inside: { 'table-data-rows': { - pattern: RegExp('^(' + t + a + ')(?:' + t + ')*$'), + pattern: RegExp('^(' + a + i + ')(?:' + a + ')*$'), lookbehind: !0, inside: { 'table-data': { - pattern: RegExp(e), - inside: s.languages.markdown, + pattern: RegExp(t), + inside: n.languages.markdown, }, punctuation: /\|/, }, }, 'table-line': { - pattern: RegExp('^(' + t + ')' + a + '$'), + pattern: RegExp('^(' + a + ')' + i + '$'), lookbehind: !0, inside: { punctuation: /\||:?-{3,}:?/ }, }, 'table-header-row': { - pattern: RegExp('^' + t + '$'), + pattern: RegExp('^' + a + '$'), inside: { 'table-header': { - pattern: RegExp(e), + pattern: RegExp(t), alias: 'important', - inside: s.languages.markdown, + inside: n.languages.markdown, }, punctuation: /\|/, }, @@ -119,7 +119,7 @@ alias: 'url', }, bold: { - pattern: n( + pattern: e( '\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*' ), lookbehind: !0, @@ -134,7 +134,7 @@ }, }, italic: { - pattern: n( + pattern: e( '\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*' ), lookbehind: !0, @@ -145,7 +145,7 @@ }, }, strike: { - pattern: n('(~~?)(?:(?!~)<inner>)+\\2'), + pattern: e('(~~?)(?:(?!~)<inner>)+\\2'), lookbehind: !0, greedy: !0, inside: { @@ -165,7 +165,7 @@ alias: ['code', 'keyword'], }, url: { - pattern: n( + pattern: e( '!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \t]?\\[(?:(?!\\])<inner>)+\\])' ), lookbehind: !0, @@ -183,29 +183,29 @@ }, }), ['url', 'bold', 'italic', 'strike'].forEach(function (e) { - ['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (n) { - e !== n && - (s.languages.markdown[e].inside.content.inside[n] = - s.languages.markdown[n]); + ['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (t) { + e !== t && + (n.languages.markdown[e].inside.content.inside[t] = + n.languages.markdown[t]); }); }), - s.hooks.add('after-tokenize', function (n) { + n.hooks.add('after-tokenize', function (n) { ('markdown' !== n.language && 'md' !== n.language) || - !(function n(e) { + (function n(e) { if (e && 'string' != typeof e) for (var t = 0, a = e.length; t < a; t++) { - var r = e[t]; - if ('code' === r.type) { - var i = r.content[1], - o = r.content[3]; + var i = e[t]; + if ('code' === i.type) { + var r = i.content[1], + o = i.content[3]; if ( - i && + r && o && - 'code-language' === i.type && + 'code-language' === r.type && 'code-block' === o.type && - 'string' == typeof i.content + 'string' == typeof r.content ) { - var l = i.content + var l = r.content .replace(/\b#/g, 'sharp') .replace(/\b\+\+/g, 'pp'), s = @@ -217,62 +217,55 @@ : o.alias.push(s) : (o.alias = [s]); } - } else n(r.content); + } else n(i.content); } })(n.tokens); }), - s.hooks.add('wrap', function (n) { - if ('code-block' === n.type) { - for (var e = '', t = 0, a = n.classes.length; t < a; t++) { - var r = n.classes[t], - i = /language-(.+)/.exec(r); - if (i) { - e = i[1]; + n.hooks.add('wrap', function (e) { + if ('code-block' === e.type) { + for (var t = '', a = 0, i = e.classes.length; a < i; a++) { + var s = e.classes[a], + d = /language-(.+)/.exec(s); + if (d) { + t = d[1]; break; } } - var o = s.languages[e]; - if (o) - n.content = s.highlight( - (function (n) { - var e = n.replace(d, ''); - return (e = e.replace( - /&(\w{1,8}|#x?[\da-f]{1,8});/gi, - function (n, e) { - var t; - if ('#' === (e = e.toLowerCase())[0]) - return ( - (t = - 'x' === e[1] - ? parseInt(e.slice(2), 16) - : Number(e.slice(1))), - u(t) - ); - var a = p[e]; - return a || n; - } - )); - })(n.content), - o, - e + var p = n.languages[t]; + if (p) + e.content = n.highlight( + e.content + .replace(r, '') + .replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function (n, e) { + var t; + return '#' === (e = e.toLowerCase())[0] + ? ((t = + 'x' === e[1] + ? parseInt(e.slice(2), 16) + : Number(e.slice(1))), + l(t)) + : o[e] || n; + }), + p, + t ); - else if (e && 'none' !== e && s.plugins.autoloader) { - var l = + else if (t && 'none' !== t && n.plugins.autoloader) { + var u = 'md-' + new Date().valueOf() + '-' + Math.floor(1e16 * Math.random()); - (n.attributes.id = l), - s.plugins.autoloader.loadLanguages(e, function () { - var n = document.getElementById(l); - n && - (n.innerHTML = s.highlight(n.textContent, s.languages[e], e)); + (e.attributes.id = u), + n.plugins.autoloader.loadLanguages(t, function () { + var e = document.getElementById(u); + e && + (e.innerHTML = n.highlight(e.textContent, n.languages[t], t)); }); } } }); - var d = RegExp(s.languages.markup.tag.pattern.source, 'gi'), - p = { amp: '&', lt: '<', gt: '>', quot: '"' }, - u = String.fromCodePoint || String.fromCharCode; - s.languages.md = s.languages.markdown; + var r = RegExp(n.languages.markup.tag.pattern.source, 'gi'), + o = { amp: '&', lt: '<', gt: '>', quot: '"' }, + l = String.fromCodePoint || String.fromCharCode; + n.languages.md = n.languages.markdown; })(Prism); |
