From 3cd9aadac2eb23939aa2d642bd8d1ef2f6616361 Mon Sep 17 00:00:00 2001 From: Matheus Teixeira Date: Wed, 15 Nov 2017 10:26:23 -0200 Subject: [PATCH] added syntax highlighting for markdown codes (#716) * added syntax highlighting for markdown codes * Added highlight to markdown renderer * Markdown code change test * Logging marked errors * Using sanitize * highlight styles * Removed unsed consoles * Using monokai as highlight theme * Using monokai for all markdown code, syntax highlight working on detail page * Surounded with pre code tags * Disable hljs and using rouge for builds * fied broken detail page * Added minified highlight.js with common languages * Fixed build script * Fixed build script to use yarn * Using spreading * Fixed build script to use yarn * Removed submodule * Using hightlight statically * Using built highlight.js * Static highlight.js * removed unnecessary changes * style(markdown): simplify css config --- _layouts/default.html | 1 - _layouts/pages/install.html | 3 +- _sass/_code.scss | 147 +++-- _sass/_highlight.scss | 76 +++ css/main.scss | 1 + js/src/lib/Details/Markdown.js | 27 +- js/src/lib/highlight.pack.js | 968 +++++++++++++++++++++++++++++++++ yarn.lock | 148 +---- 8 files changed, 1156 insertions(+), 215 deletions(-) create mode 100644 _sass/_highlight.scss create mode 100644 js/src/lib/highlight.pack.js diff --git a/_layouts/default.html b/_layouts/default.html index 507069a1a..82fd19458 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -27,7 +27,6 @@ - diff --git a/_layouts/pages/install.html b/_layouts/pages/install.html index 601d7c259..9b2d5b495 100644 --- a/_layouts/pages/install.html +++ b/_layouts/pages/install.html @@ -44,7 +44,8 @@ {% highlight sh %} {% endhighlight %} -
yarn --version
+
+
yarn --version

{{i18n.docs_nightly}}

diff --git a/_sass/_code.scss b/_sass/_code.scss index cbfdb5a1d..4bc3ac77d 100644 --- a/_sass/_code.scss +++ b/_sass/_code.scss @@ -1,72 +1,74 @@ -.rougeHighlight, pre { background-color: $code-bg; color: darken(#93a1a1, 15%) } -.rougeHighlight .c { color: #586e75 } /* Comment */ -.rougeHighlight .err { color: darken(#93a1a1, 15%) } /* Error */ -.rougeHighlight .g { color: darken(#93a1a1, 15%) } /* Generic */ -.rougeHighlight .k { color: #859900 } /* Keyword */ -.rougeHighlight .l { color: darken(#93a1a1, 15%) } /* Literal */ -.rougeHighlight .n { color: darken(#93a1a1, 15%) } /* Name */ -.rougeHighlight .o { color: #859900 } /* Operator */ -.rougeHighlight .x { color: #cb4b16 } /* Other */ -.rougeHighlight .p { color: darken(#93a1a1, 15%) } /* Punctuation */ -.rougeHighlight .cm { color: #586e75 } /* Comment.Multiline */ -.rougeHighlight .cp { color: #859900 } /* Comment.Preproc */ -.rougeHighlight .c1 { color: #72c02c; } /* Comment.Single */ -.rougeHighlight .cs { color: #859900 } /* Comment.Special */ -.rougeHighlight .gd { color: #2aa198 } /* Generic.Deleted */ -.rougeHighlight .ge { color: darken(#93a1a1, 15%); font-style: italic } /* Generic.Emph */ -.rougeHighlight .gr { color: #dc322f } /* Generic.Error */ -.rougeHighlight .gh { color: #cb4b16 } /* Generic.Heading */ -.rougeHighlight .gi { color: #859900 } /* Generic.Inserted */ -.rougeHighlight .go { color: darken(#93a1a1, 15%) } /* Generic.Output */ -.rougeHighlight .gp { color: darken(#93a1a1, 15%) } /* Generic.Prompt */ -.rougeHighlight .gs { color: darken(#93a1a1, 15%); font-weight: bold } /* Generic.Strong */ -.rougeHighlight .gu { color: #cb4b16 } /* Generic.Subheading */ -.rougeHighlight .gt { color: darken(#93a1a1, 15%) } /* Generic.Traceback */ -.rougeHighlight .kc { color: #cb4b16 } /* Keyword.Constant */ -.rougeHighlight .kd { color: #268bd2 } /* Keyword.Declaration */ -.rougeHighlight .kn { color: #859900 } /* Keyword.Namespace */ -.rougeHighlight .kp { color: #859900 } /* Keyword.Pseudo */ -.rougeHighlight .kr { color: #268bd2 } /* Keyword.Reserved */ -.rougeHighlight .kt { color: #dc322f } /* Keyword.Type */ -.rougeHighlight .ld { color: darken(#93a1a1, 15%) } /* Literal.Date */ -.rougeHighlight .m { color: #2aa198 } /* Literal.Number */ -.rougeHighlight .s { color: #2aa198 } /* Literal.String */ -.rougeHighlight .na { color: darken(#93a1a1, 15%) } /* Name.Attribute */ -.rougeHighlight .nb { color: #B58900 } /* Name.Builtin */ -.rougeHighlight .nc { color: #268bd2 } /* Name.Class */ -.rougeHighlight .no { color: #cb4b16 } /* Name.Constant */ -.rougeHighlight .nd { color: #268bd2 } /* Name.Decorator */ -.rougeHighlight .ni { color: #cb4b16 } /* Name.Entity */ -.rougeHighlight .ne { color: #cb4b16 } /* Name.Exception */ -.rougeHighlight .nf { color: #268bd2 } /* Name.Function */ -.rougeHighlight .nl { color: darken(#93a1a1, 15%) } /* Name.Label */ -.rougeHighlight .nn { color: darken(#93a1a1, 15%) } /* Name.Namespace */ -.rougeHighlight .nx { color: darken(#93a1a1, 15%) } /* Name.Other */ -.rougeHighlight .py { color: darken(#93a1a1, 15%) } /* Name.Property */ -.rougeHighlight .nt { color: #268bd2 } /* Name.Tag */ -.rougeHighlight .nv { color: #268bd2 } /* Name.Variable */ -.rougeHighlight .ow { color: #859900 } /* Operator.Word */ -.rougeHighlight .w { color: darken(#93a1a1, 15%) } /* Text.Whitespace */ -.rougeHighlight .mf { color: #2aa198 } /* Literal.Number.Float */ -.rougeHighlight .mh { color: #2aa198 } /* Literal.Number.Hex */ -.rougeHighlight .mi { color: #2aa198 } /* Literal.Number.Integer */ -.rougeHighlight .mo { color: #2aa198 } /* Literal.Number.Oct */ -.rougeHighlight .sb { color: #586e75 } /* Literal.String.Backtick */ -.rougeHighlight .sc { color: #2aa198 } /* Literal.String.Char */ -.rougeHighlight .sd { color: darken(#93a1a1, 15%) } /* Literal.String.Doc */ -.rougeHighlight .s2 { color: #2aa198 } /* Literal.String.Double */ -.rougeHighlight .se { color: #cb4b16 } /* Literal.String.Escape */ -.rougeHighlight .sh { color: darken(#93a1a1, 15%) } /* Literal.String.Heredoc */ -.rougeHighlight .si { color: #2aa198 } /* Literal.String.Interpol */ -.rougeHighlight .sx { color: #2aa198 } /* Literal.String.Other */ -.rougeHighlight .sr { color: #dc322f } /* Literal.String.Regex */ -.rougeHighlight .s1 { color: #2aa198 } /* Literal.String.Single */ -.rougeHighlight .ss { color: #2aa198 } /* Literal.String.Symbol */ -.rougeHighlight .bp { color: #268bd2 } /* Name.Builtin.Pseudo */ -.rougeHighlight .vc { color: #268bd2 } /* Name.Variable.Class */ -.rougeHighlight .vg { color: #268bd2 } /* Name.Variable.Global */ -.rougeHighlight .vi { color: #268bd2 } /* Name.Variable.Instance */ -.rougeHighlight .il { color: #2aa198 } /* Literal.Number.Integer.Long */ +.rougeHighlight pre, +.rougeHighlight, pre { + + background: $gray-dark; + -webkit-font-smoothing: antialiased; + border-left: 4px solid $yarn-blue; + color: #ddd; + } +.rougeHighlight .hll { background-color: #272822; } +.rougeHighlight .c { color: #75715e } /* Comment */ +.rougeHighlight .err { color: #960050; background-color: #1e0010 } /* Error */ +.rougeHighlight .k { color: #66d9ef } /* Keyword */ +.rougeHighlight .l { color: #ae81ff } /* Literal */ +.rougeHighlight .n { color: #f8f8f2 } /* Name */ +.rougeHighlight .o { color: #f92672 } /* Operator */ +.rougeHighlight .p { color: #f8f8f2 } /* Punctuation */ +.rougeHighlight .cm { color: #75715e } /* Comment.Multiline */ +.rougeHighlight .cp { color: #75715e } /* Comment.Preproc */ +.rougeHighlight .c1 { color: #75715e } /* Comment.Single */ +.rougeHighlight .cs { color: #75715e } /* Comment.Special */ +.rougeHighlight .ge { font-style: italic } /* Generic.Emph */ +.rougeHighlight .gs { font-weight: bold } /* Generic.Strong */ +.rougeHighlight .kc { color: #66d9ef } /* Keyword.Constant */ +.rougeHighlight .kd { color: #66d9ef } /* Keyword.Declaration */ +.rougeHighlight .kn { color: #f92672 } /* Keyword.Namespace */ +.rougeHighlight .kp { color: #66d9ef } /* Keyword.Pseudo */ +.rougeHighlight .kr { color: #66d9ef } /* Keyword.Reserved */ +.rougeHighlight .kt { color: #66d9ef } /* Keyword.Type */ +.rougeHighlight .ld { color: #e6db74 } /* Literal.Date */ +.rougeHighlight .m { color: #ae81ff } /* Literal.Number */ +.rougeHighlight .s { color: #e6db74 } /* Literal.String */ +.rougeHighlight .na { color: #a6e22e } /* Name.Attribute */ +.rougeHighlight .nb { color: #f8f8f2 } /* Name.Builtin */ +.rougeHighlight .nc { color: #a6e22e } /* Name.Class */ +.rougeHighlight .no { color: #66d9ef } /* Name.Constant */ +.rougeHighlight .nd { color: #a6e22e } /* Name.Decorator */ +.rougeHighlight .ni { color: #f8f8f2 } /* Name.Entity */ +.rougeHighlight .ne { color: #a6e22e } /* Name.Exception */ +.rougeHighlight .nf { color: #a6e22e } /* Name.Function */ +.rougeHighlight .nl { color: #f8f8f2 } /* Name.Label */ +.rougeHighlight .nn { color: #f8f8f2 } /* Name.Namespace */ +.rougeHighlight .nx { color: #a6e22e } /* Name.Other */ +.rougeHighlight .py { color: #f8f8f2 } /* Name.Property */ +.rougeHighlight .nt { color: #f92672 } /* Name.Tag */ +.rougeHighlight .nv { color: #f8f8f2 } /* Name.Variable */ +.rougeHighlight .ow { color: #f92672 } /* Operator.Word */ +.rougeHighlight .w { color: #f8f8f2 } /* Text.Whitespace */ +.rougeHighlight .mf { color: #ae81ff } /* Literal.Number.Float */ +.rougeHighlight .mh { color: #ae81ff } /* Literal.Number.Hex */ +.rougeHighlight .mi { color: #ae81ff } /* Literal.Number.Integer */ +.rougeHighlight .mo { color: #ae81ff } /* Literal.Number.Oct */ +.rougeHighlight .sb { color: #e6db74 } /* Literal.String.Backtick */ +.rougeHighlight .sc { color: #e6db74 } /* Literal.String.Char */ +.rougeHighlight .sd { color: #e6db74 } /* Literal.String.Doc */ +.rougeHighlight .s2 { color: #e6db74 } /* Literal.String.Double */ +.rougeHighlight .se { color: #ae81ff } /* Literal.String.Escape */ +.rougeHighlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ +.rougeHighlight .si { color: #e6db74 } /* Literal.String.Interpol */ +.rougeHighlight .sx { color: #e6db74 } /* Literal.String.Other */ +.rougeHighlight .sr { color: #e6db74 } /* Literal.String.Regex */ +.rougeHighlight .s1 { color: #e6db74 } /* Literal.String.Single */ +.rougeHighlight .ss { color: #e6db74 } /* Literal.String.Symbol */ +.rougeHighlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ +.rougeHighlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ +.rougeHighlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ +.rougeHighlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ +.rougeHighlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ + +.rougeHighlight .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */ +.rougeHighlight .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */ +.rougeHighlight .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */ .language-diff .gi { color: $brand-success; @@ -80,13 +82,6 @@ display: block; } -.language-sh pre { - background: $gray-dark; - color: white; - -webkit-font-smoothing: antialiased; - border-left: 4px solid $yarn-blue; -} - pre { max-width: 100%; margin-bottom: 1.2rem; diff --git a/_sass/_highlight.scss b/_sass/_highlight.scss new file mode 100644 index 000000000..76847a2f4 --- /dev/null +++ b/_sass/_highlight.scss @@ -0,0 +1,76 @@ +/* +Monokai style - ported by Luigi Maselli - http://grigio.org +*/ + +.hljs { + background: #292b2c; + -webkit-font-smoothing: antialiased; + border-left: 4px solid #2C8EBB; + color: #ddd; + max-width: 100%; + margin-bottom: 1.2rem; + border-radius: 3px; + padding: .6rem 1.2rem; + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} + +.hljs-tag, +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-strong, +.hljs-name { + color: #f92672; +} + +.hljs-code { + color: #66d9ef; +} + +.hljs-class .hljs-title { + color: white; +} + +.hljs-attribute, +.hljs-symbol, +.hljs-regexp, +.hljs-link { + color: #bf79db; +} + +.hljs-string, +.hljs-bullet, +.hljs-subst, +.hljs-title, +.hljs-section, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #a6e22e; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-selector-id { + font-weight: bold; +} diff --git a/css/main.scss b/css/main.scss index d6dbec022..f396ab40b 100644 --- a/css/main.scss +++ b/css/main.scss @@ -45,6 +45,7 @@ $npm-red: #C12127; @import "_details.scss"; @import "_readmore.scss"; @import "_copyable.scss"; +@import "_highlight.scss"; // should come from bootstrap but it doesn't .justify-items-between { diff --git a/js/src/lib/Details/Markdown.js b/js/src/lib/Details/Markdown.js index 446d926a0..615afa83b 100644 --- a/js/src/lib/Details/Markdown.js +++ b/js/src/lib/Details/Markdown.js @@ -1,6 +1,7 @@ import React from 'react'; import marked from 'marked'; import xss from 'xss'; +import hljs from '../../../../js/src/lib/highlight.pack'; import { prefixURL } from '../util'; @@ -69,9 +70,29 @@ const renderAndEscapeMarkdown = ({ source, githubRepo }) => { }; } - const html = marked(source, { renderer, mangle: false }); - const escaped = xss(html); - return escaped; + renderer.code = function(code, lang) { + if (lang && hljs.getLanguage(lang)) { + try { + const prepared = hljs.highlight(lang, code); + return `
${prepared.value}
`; + } catch (err) {} + } + + try { + const prepared = hljs.highlightAuto(code); + return `
${prepared.value}
`; + } catch (err) {} + + return `
${code}
`; + }; + + return xss(marked(source, { renderer, mangle: false }), { + whiteList: { + ...xss.getDefaultWhiteList(), + code: ['class'], + span: ['class'], + }, + }); }; const Markdown = ({ source, githubRepo }) => ( diff --git a/js/src/lib/highlight.pack.js b/js/src/lib/highlight.pack.js new file mode 100644 index 000000000..7baf41852 --- /dev/null +++ b/js/src/lib/highlight.pack.js @@ -0,0 +1,968 @@ +/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */ +!(function(e) { + var t = + ('object' == typeof window && window) || ('object' == typeof self && self); + 'undefined' != typeof exports + ? e(exports) + : t && + ((t.hljs = e({})), + 'function' == typeof define && + define.amd && + define([], function() { + return t.hljs; + })); +})(function(e) { + function t(e) { + return e + .replace(/&/g, '&') + .replace(//g, '>'); + } + function r(e) { + return e.nodeName.toLowerCase(); + } + function n(e, t) { + var r = e && e.exec(t); + return r && 0 === r.index; + } + function a(e) { + return M.test(e); + } + function i(e) { + var t, + r, + n, + i, + o = e.className + ' '; + if (((o += e.parentNode ? e.parentNode.className : ''), (r = R.exec(o)))) + return N(r[1]) ? r[1] : 'no-highlight'; + for (o = o.split(/\s+/), t = 0, n = o.length; n > t; t++) + if (((i = o[t]), a(i) || N(i))) return i; + } + function o(e) { + var t, + r = {}, + n = Array.prototype.slice.call(arguments, 1); + for (t in e) r[t] = e[t]; + return ( + n.forEach(function(e) { + for (t in e) r[t] = e[t]; + }), + r + ); + } + function s(e) { + var t = []; + return ( + (function n(e, a) { + for (var i = e.firstChild; i; i = i.nextSibling) + 3 === i.nodeType + ? (a += i.nodeValue.length) + : 1 === i.nodeType && + (t.push({ event: 'start', offset: a, node: i }), + (a = n(i, a)), + r(i).match(/br|hr|img|input/) || + t.push({ event: 'stop', offset: a, node: i })); + return a; + })(e, 0), + t + ); + } + function c(e, n, a) { + function i() { + return e.length && n.length + ? e[0].offset !== n[0].offset + ? e[0].offset < n[0].offset ? e : n + : 'start' === n[0].event ? e : n + : e.length ? e : n; + } + function o(e) { + function n(e) { + return ( + ' ' + e.nodeName + '="' + t(e.value).replace('"', '"') + '"' + ); + } + u += '<' + r(e) + k.map.call(e.attributes, n).join('') + '>'; + } + function s(e) { + u += ''; + } + function c(e) { + ('start' === e.event ? o : s)(e.node); + } + for (var l = 0, u = '', b = []; e.length || n.length; ) { + var d = i(); + if (((u += t(a.substring(l, d[0].offset))), (l = d[0].offset), d === e)) { + b.reverse().forEach(s); + do c(d.splice(0, 1)[0]), (d = i()); + while (d === e && d.length && d[0].offset === l); + b.reverse().forEach(o); + } else + 'start' === d[0].event ? b.push(d[0].node) : b.pop(), + c(d.splice(0, 1)[0]); + } + return u + t(a.substr(l)); + } + function l(e) { + return ( + e.v && + !e.cached_variants && + (e.cached_variants = e.v.map(function(t) { + return o(e, { v: null }, t); + })), + e.cached_variants || (e.eW && [o(e)]) || [e] + ); + } + function u(e) { + function t(e) { + return (e && e.source) || e; + } + function r(r, n) { + return new RegExp(t(r), 'm' + (e.cI ? 'i' : '') + (n ? 'g' : '')); + } + function n(a, i) { + if (!a.compiled) { + if (((a.compiled = !0), (a.k = a.k || a.bK), a.k)) { + var o = {}, + s = function(t, r) { + e.cI && (r = r.toLowerCase()), + r.split(' ').forEach(function(e) { + var r = e.split('|'); + o[r[0]] = [t, r[1] ? Number(r[1]) : 1]; + }); + }; + 'string' == typeof a.k + ? s('keyword', a.k) + : x(a.k).forEach(function(e) { + s(e, a.k[e]); + }), + (a.k = o); + } + (a.lR = r(a.l || /\w+/, !0)), + i && + (a.bK && (a.b = '\\b(' + a.bK.split(' ').join('|') + ')\\b'), + a.b || (a.b = /\B|\b/), + (a.bR = r(a.b)), + a.e || a.eW || (a.e = /\B|\b/), + a.e && (a.eR = r(a.e)), + (a.tE = t(a.e) || ''), + a.eW && i.tE && (a.tE += (a.e ? '|' : '') + i.tE)), + a.i && (a.iR = r(a.i)), + null == a.r && (a.r = 1), + a.c || (a.c = []), + (a.c = Array.prototype.concat.apply( + [], + a.c.map(function(e) { + return l('self' === e ? a : e); + }) + )), + a.c.forEach(function(e) { + n(e, a); + }), + a.starts && n(a.starts, i); + var c = a.c + .map(function(e) { + return e.bK ? '\\.?(' + e.b + ')\\.?' : e.b; + }) + .concat([a.tE, a.i]) + .map(t) + .filter(Boolean); + a.t = c.length + ? r(c.join('|'), !0) + : { + exec: function() { + return null; + }, + }; + } + } + n(e); + } + function b(e, r, a, i) { + function o(e, t) { + var r, a; + for (r = 0, a = t.c.length; a > r; r++) + if (n(t.c[r].bR, e)) return t.c[r]; + } + function s(e, t) { + if (n(e.eR, t)) { + for (; e.endsParent && e.parent; ) e = e.parent; + return e; + } + return e.eW ? s(e.parent, t) : void 0; + } + function c(e, t) { + return !a && n(t.iR, e); + } + function l(e, t) { + var r = w.cI ? t[0].toLowerCase() : t[0]; + return e.k.hasOwnProperty(r) && e.k[r]; + } + function p(e, t, r, n) { + var a = n ? '' : z.classPrefix, + i = ''), i + t + o; + } + function f() { + var e, r, n, a; + if (!k.k) return t(M); + for (a = '', r = 0, k.lR.lastIndex = 0, n = k.lR.exec(M); n; ) + (a += t(M.substring(r, n.index))), + (e = l(k, n)), + e ? ((R += e[1]), (a += p(e[0], t(n[0])))) : (a += t(n[0])), + (r = k.lR.lastIndex), + (n = k.lR.exec(M)); + return a + t(M.substr(r)); + } + function g() { + var e = 'string' == typeof k.sL; + if (e && !E[k.sL]) return t(M); + var r = e ? b(k.sL, M, !0, x[k.sL]) : d(M, k.sL.length ? k.sL : void 0); + return ( + k.r > 0 && (R += r.r), + e && (x[k.sL] = r.top), + p(r.language, r.value, !1, !0) + ); + } + function m() { + (C += null != k.sL ? g() : f()), (M = ''); + } + function h(e) { + (C += e.cN ? p(e.cN, '', !0) : ''), + (k = Object.create(e, { parent: { value: k } })); + } + function v(e, t) { + if (((M += e), null == t)) return m(), 0; + var r = o(t, k); + if (r) + return ( + r.skip ? (M += t) : (r.eB && (M += t), m(), r.rB || r.eB || (M = t)), + h(r, t), + r.rB ? 0 : t.length + ); + var n = s(k, t); + if (n) { + var a = k; + a.skip ? (M += t) : (a.rE || a.eE || (M += t), m(), a.eE && (M = t)); + do k.cN && (C += B), k.skip || k.sL || (R += k.r), (k = k.parent); + while (k !== n.parent); + return n.starts && h(n.starts, ''), a.rE ? 0 : t.length; + } + if (c(t, k)) + throw new Error( + 'Illegal lexeme "' + t + '" for mode "' + (k.cN || '') + '"' + ); + return (M += t), t.length || 1; + } + var w = N(e); + if (!w) throw new Error('Unknown language: "' + e + '"'); + u(w); + var y, + k = i || w, + x = {}, + C = ''; + for (y = k; y !== w; y = y.parent) y.cN && (C = p(y.cN, '', !0) + C); + var M = '', + R = 0; + try { + for (var A, S, L = 0; ; ) { + if (((k.t.lastIndex = L), (A = k.t.exec(r)), !A)) break; + (S = v(r.substring(L, A.index), A[0])), (L = A.index + S); + } + for (v(r.substr(L)), y = k; y.parent; y = y.parent) y.cN && (C += B); + return { r: R, value: C, language: e, top: k }; + } catch (I) { + if (I.message && -1 !== I.message.indexOf('Illegal')) + return { r: 0, value: t(r) }; + throw I; + } + } + function d(e, r) { + r = r || z.languages || x(E); + var n = { r: 0, value: t(e) }, + a = n; + return ( + r.filter(N).forEach(function(t) { + var r = b(t, e, !1); + (r.language = t), r.r > a.r && (a = r), r.r > n.r && ((a = n), (n = r)); + }), + a.language && (n.second_best = a), + n + ); + } + function p(e) { + return z.tabReplace || z.useBR + ? e.replace(A, function(e, t) { + return z.useBR && '\n' === e + ? '
' + : z.tabReplace ? t.replace(/\t/g, z.tabReplace) : ''; + }) + : e; + } + function f(e, t, r) { + var n = t ? C[t] : r, + a = [e.trim()]; + return ( + e.match(/\bhljs\b/) || a.push('hljs'), + -1 === e.indexOf(n) && a.push(n), + a.join(' ').trim() + ); + } + function g(e) { + var t, + r, + n, + o, + l, + u = i(e); + a(u) || + (z.useBR + ? ((t = document.createElementNS( + 'http://www.w3.org/1999/xhtml', + 'div' + )), + (t.innerHTML = e.innerHTML + .replace(/\n/g, '') + .replace(//g, '\n'))) + : (t = e), + (l = t.textContent), + (n = u ? b(u, l, !0) : d(l)), + (r = s(t)), + r.length && + ((o = document.createElementNS('http://www.w3.org/1999/xhtml', 'div')), + (o.innerHTML = n.value), + (n.value = c(r, s(o), l))), + (n.value = p(n.value)), + (e.innerHTML = n.value), + (e.className = f(e.className, u, n.language)), + (e.result = { language: n.language, re: n.r }), + n.second_best && + (e.second_best = { + language: n.second_best.language, + re: n.second_best.r, + })); + } + function m(e) { + z = o(z, e); + } + function h() { + if (!h.called) { + h.called = !0; + var e = document.querySelectorAll('pre code'); + k.forEach.call(e, g); + } + } + function v() { + addEventListener('DOMContentLoaded', h, !1), + addEventListener('load', h, !1); + } + function w(t, r) { + var n = (E[t] = r(e)); + n.aliases && + n.aliases.forEach(function(e) { + C[e] = t; + }); + } + function y() { + return x(E); + } + function N(e) { + return (e = (e || '').toLowerCase()), E[e] || E[C[e]]; + } + var k = [], + x = Object.keys, + E = {}, + C = {}, + M = /^(no-?highlight|plain|text)$/i, + R = /\blang(?:uage)?-([\w-]+)\b/i, + A = /((^(<[^>]+>|\t|)+|(?:\n)))/gm, + B = '
', + z = { + classPrefix: 'hljs-', + tabReplace: null, + useBR: !1, + languages: void 0, + }; + return ( + (e.highlight = b), + (e.highlightAuto = d), + (e.fixMarkup = p), + (e.highlightBlock = g), + (e.configure = m), + (e.initHighlighting = h), + (e.initHighlightingOnLoad = v), + (e.registerLanguage = w), + (e.listLanguages = y), + (e.getLanguage = N), + (e.inherit = o), + (e.IR = '[a-zA-Z]\\w*'), + (e.UIR = '[a-zA-Z_]\\w*'), + (e.NR = '\\b\\d+(\\.\\d+)?'), + (e.CNR = + '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'), + (e.BNR = '\\b(0b[01]+)'), + (e.RSR = + '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'), + (e.BE = { b: '\\\\[\\s\\S]', r: 0 }), + (e.ASM = { cN: 'string', b: "'", e: "'", i: '\\n', c: [e.BE] }), + (e.QSM = { cN: 'string', b: '"', e: '"', i: '\\n', c: [e.BE] }), + (e.PWM = { + b: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/, + }), + (e.C = function(t, r, n) { + var a = e.inherit({ cN: 'comment', b: t, e: r, c: [] }, n || {}); + return ( + a.c.push(e.PWM), + a.c.push({ cN: 'doctag', b: '(?:TODO|FIXME|NOTE|BUG|XXX):', r: 0 }), + a + ); + }), + (e.CLCM = e.C('//', '$')), + (e.CBCM = e.C('/\\*', '\\*/')), + (e.HCM = e.C('#', '$')), + (e.NM = { cN: 'number', b: e.NR, r: 0 }), + (e.CNM = { cN: 'number', b: e.CNR, r: 0 }), + (e.BNM = { cN: 'number', b: e.BNR, r: 0 }), + (e.CSSNM = { + cN: 'number', + b: + e.NR + + '(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?', + r: 0, + }), + (e.RM = { + cN: 'regexp', + b: /\//, + e: /\/[gimuy]*/, + i: /\n/, + c: [e.BE, { b: /\[/, e: /\]/, r: 0, c: [e.BE] }], + }), + (e.TM = { cN: 'title', b: e.IR, r: 0 }), + (e.UTM = { cN: 'title', b: e.UIR, r: 0 }), + (e.METHOD_GUARD = { b: '\\.\\s*' + e.UIR, r: 0 }), + e.registerLanguage('bash', function(e) { + var t = { + cN: 'variable', + v: [{ b: /\$[\w\d#@][\w\d_]*/ }, { b: /\$\{(.*?)}/ }], + }, + r = { + cN: 'string', + b: /"/, + e: /"/, + c: [e.BE, t, { cN: 'variable', b: /\$\(/, e: /\)/, c: [e.BE] }], + }, + n = { cN: 'string', b: /'/, e: /'/ }; + return { + aliases: ['sh', 'zsh'], + l: /\b-?[a-z\._]+\b/, + k: { + keyword: + 'if then else elif fi for while in do done case esac function', + literal: 'true false', + built_in: + 'break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp', + _: '-ne -eq -lt -gt -f -d -e -s -l -a', + }, + c: [ + { cN: 'meta', b: /^#![^\n]+sh\s*$/, r: 10 }, + { + cN: 'function', + b: /\w[\w\d_]*\s*\(\s*\)\s*\{/, + rB: !0, + c: [e.inherit(e.TM, { b: /\w[\w\d_]*/ })], + r: 0, + }, + e.HCM, + r, + n, + t, + ], + }; + }), + e.registerLanguage('css', function(e) { + var t = '[a-zA-Z-][a-zA-Z0-9_-]*', + r = { + b: /[A-Z\_\.\-]+\s*:/, + rB: !0, + e: ';', + eW: !0, + c: [ + { + cN: 'attribute', + b: /\S/, + e: ':', + eE: !0, + starts: { + eW: !0, + eE: !0, + c: [ + { + b: /[\w-]+\(/, + rB: !0, + c: [ + { cN: 'built_in', b: /[\w-]+/ }, + { b: /\(/, e: /\)/, c: [e.ASM, e.QSM] }, + ], + }, + e.CSSNM, + e.QSM, + e.ASM, + e.CBCM, + { cN: 'number', b: '#[0-9A-Fa-f]+' }, + { cN: 'meta', b: '!important' }, + ], + }, + }, + ], + }; + return { + cI: !0, + i: /[=\/|'\$]/, + c: [ + e.CBCM, + { cN: 'selector-id', b: /#[A-Za-z0-9_-]+/ }, + { cN: 'selector-class', b: /\.[A-Za-z0-9_-]+/ }, + { cN: 'selector-attr', b: /\[/, e: /\]/, i: '$' }, + { cN: 'selector-pseudo', b: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/ }, + { b: '@(font-face|page)', l: '[a-z-]+', k: 'font-face page' }, + { + b: '@', + e: '[{;]', + i: /:/, + c: [ + { cN: 'keyword', b: /\w+/ }, + { b: /\s/, eW: !0, eE: !0, r: 0, c: [e.ASM, e.QSM, e.CSSNM] }, + ], + }, + { cN: 'selector-tag', b: t, r: 0 }, + { b: '{', e: '}', i: /\S/, c: [e.CBCM, r] }, + ], + }; + }), + e.registerLanguage('javascript', function(e) { + var t = '[A-Za-z$_][0-9A-Za-z$_]*', + r = { + keyword: + 'in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as', + literal: 'true false null undefined NaN Infinity', + built_in: + 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise', + }, + n = { + cN: 'number', + v: [ + { b: '\\b(0[bB][01]+)' }, + { b: '\\b(0[oO][0-7]+)' }, + { b: e.CNR }, + ], + r: 0, + }, + a = { cN: 'subst', b: '\\$\\{', e: '\\}', k: r, c: [] }, + i = { cN: 'string', b: '`', e: '`', c: [e.BE, a] }; + a.c = [e.ASM, e.QSM, i, n, e.RM]; + var o = a.c.concat([e.CBCM, e.CLCM]); + return { + aliases: ['js', 'jsx'], + k: r, + c: [ + { cN: 'meta', r: 10, b: /^\s*['"]use (strict|asm)['"]/ }, + { cN: 'meta', b: /^#!/, e: /$/ }, + e.ASM, + e.QSM, + i, + e.CLCM, + e.CBCM, + n, + { + b: /[{,]\s*/, + r: 0, + c: [ + { b: t + '\\s*:', rB: !0, r: 0, c: [{ cN: 'attr', b: t, r: 0 }] }, + ], + }, + { + b: '(' + e.RSR + '|\\b(case|return|throw)\\b)\\s*', + k: 'return throw case', + c: [ + e.CLCM, + e.CBCM, + e.RM, + { + cN: 'function', + b: '(\\(.*?\\)|' + t + ')\\s*=>', + rB: !0, + e: '\\s*=>', + c: [ + { + cN: 'params', + v: [ + { b: t }, + { b: /\(\s*\)/ }, + { b: /\(/, e: /\)/, eB: !0, eE: !0, k: r, c: o }, + ], + }, + ], + }, + { + b: //, + sL: 'xml', + c: [ + { b: /<\w+\s*\/>/, skip: !0 }, + { + b: /<\w+/, + e: /(\/\w+|\w+\/)>/, + skip: !0, + c: [{ b: /<\w+\s*\/>/, skip: !0 }, 'self'], + }, + ], + }, + ], + r: 0, + }, + { + cN: 'function', + bK: 'function', + e: /\{/, + eE: !0, + c: [ + e.inherit(e.TM, { b: t }), + { cN: 'params', b: /\(/, e: /\)/, eB: !0, eE: !0, c: o }, + ], + i: /\[|%/, + }, + { b: /\$[(.]/ }, + e.METHOD_GUARD, + { + cN: 'class', + bK: 'class', + e: /[{;=]/, + eE: !0, + i: /[:"\[\]]/, + c: [{ bK: 'extends' }, e.UTM], + }, + { bK: 'constructor', e: /\{/, eE: !0 }, + ], + i: /#(?!!)/, + }; + }), + e.registerLanguage('xml', function(e) { + var t = '[A-Za-z0-9\\._:-]+', + r = { + eW: !0, + i: /`]+/ }, + ], + }, + ], + }, + ], + }; + return { + aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist'], + cI: !0, + c: [ + { + cN: 'meta', + b: '', + r: 10, + c: [{ b: '\\[', e: '\\]' }], + }, + e.C('', { r: 10 }), + { b: '<\\!\\[CDATA\\[', e: '\\]\\]>', r: 10 }, + { cN: 'meta', b: /<\?xml/, e: /\?>/, r: 10 }, + { + b: /<\?(php)?/, + e: /\?>/, + sL: 'php', + c: [{ b: '/\\*', e: '\\*/', skip: !0 }], + }, + { + cN: 'tag', + b: '|$)', + e: '>', + k: { name: 'style' }, + c: [r], + starts: { e: '', rE: !0, sL: ['css', 'xml'] }, + }, + { + cN: 'tag', + b: '|$)', + e: '>', + k: { name: 'script' }, + c: [r], + starts: { + e: '', + rE: !0, + sL: ['actionscript', 'javascript', 'handlebars', 'xml'], + }, + }, + { + cN: 'tag', + b: '', + c: [{ cN: 'name', b: /[^\/><\s]+/, r: 0 }, r], + }, + ], + }; + }), + e.registerLanguage('markdown', function(e) { + return { + aliases: ['md', 'mkdown', 'mkd'], + c: [ + { + cN: 'section', + v: [{ b: '^#{1,6}', e: '$' }, { b: '^.+?\\n[=-]{2,}$' }], + }, + { b: '<', e: '>', sL: 'xml', r: 0 }, + { cN: 'bullet', b: '^([*+-]|(\\d+\\.))\\s+' }, + { cN: 'strong', b: '[*_]{2}.+?[*_]{2}' }, + { cN: 'emphasis', v: [{ b: '\\*.+?\\*' }, { b: '_.+?_', r: 0 }] }, + { cN: 'quote', b: '^>\\s+', e: '$' }, + { + cN: 'code', + v: [ + { b: '^```w*s*$', e: '^```s*$' }, + { b: '`.+?`' }, + { b: '^( {4}| )', e: '$', r: 0 }, + ], + }, + { b: '^[-\\*]{3,}', e: '$' }, + { + b: '\\[.+?\\][\\(\\[].*?[\\)\\]]', + rB: !0, + c: [ + { cN: 'string', b: '\\[', e: '\\]', eB: !0, rE: !0, r: 0 }, + { cN: 'link', b: '\\]\\(', e: '\\)', eB: !0, eE: !0 }, + { cN: 'symbol', b: '\\]\\[', e: '\\]', eB: !0, eE: !0 }, + ], + r: 10, + }, + { + b: /^\[[^\n]+\]:/, + rB: !0, + c: [ + { cN: 'symbol', b: /\[/, e: /\]/, eB: !0, eE: !0 }, + { cN: 'link', b: /:\s*/, e: /$/, eB: !0 }, + ], + }, + ], + }; + }), + e.registerLanguage('scss', function(e) { + var t = '[a-zA-Z-][a-zA-Z0-9_-]*', + r = { cN: 'variable', b: '(\\$' + t + ')\\b' }, + n = { cN: 'number', b: '#[0-9A-Fa-f]+' }; + ({ + cN: 'attribute', + b: '[A-Z\\_\\.\\-]+', + e: ':', + eE: !0, + i: '[^\\s]', + starts: { + eW: !0, + eE: !0, + c: [ + n, + e.CSSNM, + e.QSM, + e.ASM, + e.CBCM, + { cN: 'meta', b: '!important' }, + ], + }, + }); + return { + cI: !0, + i: "[=/|']", + c: [ + e.CLCM, + e.CBCM, + { cN: 'selector-id', b: '\\#[A-Za-z0-9_-]+', r: 0 }, + { cN: 'selector-class', b: '\\.[A-Za-z0-9_-]+', r: 0 }, + { cN: 'selector-attr', b: '\\[', e: '\\]', i: '$' }, + { + cN: 'selector-tag', + b: + '\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b', + r: 0, + }, + { + b: + ':(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)', + }, + { + b: + '::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)', + }, + r, + { + cN: 'attribute', + b: + '\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b', + i: '[^\\s]', + }, + { + b: + '\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b', + }, + { + b: ':', + e: ';', + c: [r, n, e.CSSNM, e.QSM, e.ASM, { cN: 'meta', b: '!important' }], + }, + { + b: '@', + e: '[{;]', + k: + 'mixin include extend for if else each while charset import debug media page content font-face namespace warn', + c: [r, e.QSM, e.ASM, n, e.CSSNM, { b: '\\s[A-Za-z0-9_.-]+', r: 0 }], + }, + ], + }; + }), + e.registerLanguage('shell', function(e) { + return { + aliases: ['console'], + c: [ + { + cN: 'meta', + b: '^\\s{0,3}[\\w\\d\\[\\]()@-]*[>%$#]', + starts: { e: '$', sL: 'bash' }, + }, + ], + }; + }), + e.registerLanguage('typescript', function(e) { + var t = { + keyword: + 'in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private protected get set super static implements enum export import declare type namespace abstract as from extends async await', + literal: 'true false null undefined NaN Infinity', + built_in: + 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void Promise', + }; + return { + aliases: ['ts'], + k: t, + c: [ + { cN: 'meta', b: /^\s*['"]use strict['"]/ }, + e.ASM, + e.QSM, + { + cN: 'string', + b: '`', + e: '`', + c: [e.BE, { cN: 'subst', b: '\\$\\{', e: '\\}' }], + }, + e.CLCM, + e.CBCM, + { + cN: 'number', + v: [ + { b: '\\b(0[bB][01]+)' }, + { b: '\\b(0[oO][0-7]+)' }, + { b: e.CNR }, + ], + r: 0, + }, + { + b: '(' + e.RSR + '|\\b(case|return|throw)\\b)\\s*', + k: 'return throw case', + c: [ + e.CLCM, + e.CBCM, + e.RM, + { + cN: 'function', + b: '(\\(.*?\\)|' + e.IR + ')\\s*=>', + rB: !0, + e: '\\s*=>', + c: [ + { + cN: 'params', + v: [ + { b: e.IR }, + { b: /\(\s*\)/ }, + { + b: /\(/, + e: /\)/, + eB: !0, + eE: !0, + k: t, + c: ['self', e.CLCM, e.CBCM], + }, + ], + }, + ], + }, + ], + r: 0, + }, + { + cN: 'function', + b: 'function', + e: /[\{;]/, + eE: !0, + k: t, + c: [ + 'self', + e.inherit(e.TM, { b: /[A-Za-z$_][0-9A-Za-z$_]*/ }), + { + cN: 'params', + b: /\(/, + e: /\)/, + eB: !0, + eE: !0, + k: t, + c: [e.CLCM, e.CBCM], + i: /["'\(]/, + }, + ], + i: /%/, + r: 0, + }, + { + bK: 'constructor', + e: /\{/, + eE: !0, + c: [ + 'self', + { + cN: 'params', + b: /\(/, + e: /\)/, + eB: !0, + eE: !0, + k: t, + c: [e.CLCM, e.CBCM], + i: /["'\(]/, + }, + ], + }, + { b: /module\./, k: { built_in: 'module' }, r: 0 }, + { bK: 'module', e: /\{/, eE: !0 }, + { bK: 'interface', e: /\{/, eE: !0, k: 'interface extends' }, + { b: /\$[(.]/ }, + { b: '\\.' + e.IR, r: 0 }, + { cN: 'meta', b: '@[A-Za-z]+' }, + ], + }; + }), + e + ); +}); diff --git a/yarn.lock b/yarn.lock index 71668a78b..5d961ea61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -67,27 +67,7 @@ algoliasearch-helper@^2.21.0: qs "^6.2.1" util "^0.10.3" -algoliasearch@^3.22.1: - version "3.24.0" - resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.24.0.tgz#d0a6ac2963b781d2fb059a3a853fe18765673346" - dependencies: - agentkeepalive "^2.2.0" - debug "^2.6.8" - envify "^4.0.0" - es6-promise "^4.1.0" - events "^1.1.0" - foreach "^2.0.5" - global "^4.3.2" - inherits "^2.0.1" - isarray "^2.0.1" - load-script "^1.0.0" - object-keys "^1.0.11" - querystring-es3 "^0.2.1" - reduce "^1.0.1" - semver "^5.1.0" - tunnel-agent "^0.6.0" - -algoliasearch@^3.22.2, algoliasearch@^3.24.0, algoliasearch@^3.24.3: +algoliasearch@^3.22.1, algoliasearch@^3.22.2, algoliasearch@^3.24.0, algoliasearch@^3.24.3: version "3.24.5" resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.24.5.tgz#15d1e6c6a059b8b357d7d40122d9841829acfd20" dependencies: @@ -241,14 +221,6 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -599,7 +571,7 @@ babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015 babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-plugin-transform-es2015-modules-commonjs@^6.23.0: +babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz#0d8394029b7dc6abe1a97ef181e00758dd2e5d8a" dependencies: @@ -608,15 +580,6 @@ babel-plugin-transform-es2015-modules-commonjs@^6.23.0: babel-template "^6.26.0" babel-types "^6.26.0" -babel-plugin-transform-es2015-modules-commonjs@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz#d3e310b40ef664a36622200097c6d440298f2bfe" - dependencies: - babel-plugin-transform-strict-mode "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-types "^6.24.1" - babel-plugin-transform-es2015-modules-systemjs@^6.23.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23" @@ -850,31 +813,14 @@ babel-register@^6.26.0: mkdirp "^0.5.1" source-map-support "^0.4.15" -babel-runtime@^6.18.0, babel-runtime@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - -babel-runtime@^6.26.0: +babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" dependencies: core-js "^2.4.0" regenerator-runtime "^0.11.0" -babel-template@^6.24.1: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.25.0.tgz#665241166b7c2aa4c619d71e192969552b10c071" - dependencies: - babel-runtime "^6.22.0" - babel-traverse "^6.25.0" - babel-types "^6.25.0" - babylon "^6.17.2" - lodash "^4.2.0" - -babel-template@^6.26.0: +babel-template@^6.24.1, babel-template@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" dependencies: @@ -884,21 +830,7 @@ babel-template@^6.26.0: babylon "^6.18.0" lodash "^4.17.4" -babel-traverse@^6.24.1, babel-traverse@^6.25.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" - dependencies: - babel-code-frame "^6.22.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.25.0" - babylon "^6.17.2" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-traverse@^6.26.0: +babel-traverse@^6.24.1, babel-traverse@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" dependencies: @@ -912,16 +844,7 @@ babel-traverse@^6.26.0: invariant "^2.2.2" lodash "^4.17.4" -babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.25.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - -babel-types@^6.26.0: +babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" dependencies: @@ -930,10 +853,6 @@ babel-types@^6.26.0: lodash "^4.17.4" to-fast-properties "^1.0.3" -babylon@^6.17.2: - version "6.17.4" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" - babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" @@ -1112,7 +1031,7 @@ chain-function@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.0.tgz#0d4ab37e7e18ead0bdc47b920764118ce58733dc" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -1255,11 +1174,7 @@ core-js@^1.0.0: version "1.2.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" -core-js@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" - -core-js@^2.5.0: +core-js@^2.4.0, core-js@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.0.tgz#569c050918be6486b3837552028ae0466b717086" @@ -1676,18 +1591,6 @@ fbjs@^0.8.16: setimmediate "^1.0.5" ua-parser-js "^0.7.9" -fbjs@^0.8.9: - version "0.8.12" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -1849,7 +1752,7 @@ global@^4.3.2: min-document "^2.19.0" process "~0.5.1" -globals@^9.0.0, globals@^9.18.0: +globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -2011,7 +1914,7 @@ interpret@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" -invariant@^2.2.0, invariant@^2.2.2: +invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -2865,7 +2768,7 @@ promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@^15.5.10, prop-types@^15.6.0: +prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.6.0: version "15.6.0" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856" dependencies: @@ -2873,13 +2776,6 @@ prop-types@^15.5.10, prop-types@^15.6.0: loose-envify "^1.3.1" object-assign "^4.1.1" -prop-types@^15.5.6: - version "15.5.10" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154" - dependencies: - fbjs "^0.8.9" - loose-envify "^1.3.1" - prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -3028,10 +2924,6 @@ regenerate@^1.2.1: version "1.3.2" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" -regenerator-runtime@^0.10.0: - version "0.10.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" - regenerator-runtime@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" @@ -3138,13 +3030,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -rimraf@^2.2.8: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: @@ -3422,7 +3308,7 @@ to-factory@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/to-factory/-/to-factory-1.0.0.tgz#8738af8bd97120ad1d4047972ada5563bf9479b1" -to-fast-properties@^1.0.1, to-fast-properties@^1.0.3: +to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" @@ -3600,18 +3486,12 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@1.2.x: +which@1.2.x, which@^1.2.10, which@^1.2.9: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" dependencies: isexe "^2.0.0" -which@^1.2.10, which@^1.2.9: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" - dependencies: - isexe "^2.0.0" - wide-align@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710"