From f9d43046182bdd1fb14b8e99ff53deab52267728 Mon Sep 17 00:00:00 2001 From: Dave Star Date: Mon, 21 Jun 2021 14:51:09 +0100 Subject: [PATCH 1/6] housekeeping --- .gitignore | 3 - compiler/.gitignore | 1 + compiler/dist/index.js | 11108 ----------------------------- compiler/dist/template/main.css | 218 - compiler/dist/template/main.js | 7 - compiler/src/r-markdown/knitr.ts | 11 +- compiler/src/utils/utils.ts | 5 +- dev.ts | 2 +- fixtures/.gitignore | 2 + template/.gitignore | 1 + 10 files changed, 11 insertions(+), 11347 deletions(-) create mode 100644 compiler/.gitignore delete mode 100644 compiler/dist/index.js delete mode 100644 compiler/dist/template/main.css delete mode 100644 compiler/dist/template/main.js create mode 100644 fixtures/.gitignore create mode 100644 template/.gitignore diff --git a/.gitignore b/.gitignore index 5f108701..a61c608a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -build/ -cache/ yarn-error.log node_modules .RData .RDataTmp -Rplots.pdf diff --git a/compiler/.gitignore b/compiler/.gitignore new file mode 100644 index 00000000..567609b1 --- /dev/null +++ b/compiler/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/compiler/dist/index.js b/compiler/dist/index.js deleted file mode 100644 index 73ef91fd..00000000 --- a/compiler/dist/index.js +++ /dev/null @@ -1,11108 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 6209: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -/** - * @licstart The following is the entire license notice for the - * Javascript code in this page - * - * Copyright 2020 Mozilla Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @licend The above is the entire license notice for the - * Javascript code in this page - */ - - -function xmlEncode(s) { - var i = 0, - ch; - s = String(s); - - while (i < s.length && (ch = s[i]) !== "&" && ch !== "<" && ch !== '"' && ch !== "\n" && ch !== "\r" && ch !== "\t") { - i++; - } - - if (i >= s.length) { - return s; - } - - var buf = s.substring(0, i); - - while (i < s.length) { - ch = s[i++]; - - switch (ch) { - case "&": - buf += "&"; - break; - - case "<": - buf += "<"; - break; - - case '"': - buf += """; - break; - - case "\n": - buf += " "; - break; - - case "\r": - buf += " "; - break; - - case "\t": - buf += " "; - break; - - default: - buf += ch; - break; - } - } - - return buf; -} - -function DOMElement(name) { - this.nodeName = name; - this.childNodes = []; - this.attributes = {}; - this.textContent = ""; - - if (name === "style") { - this.sheet = { - cssRules: [], - insertRule: function (rule) { - this.cssRules.push(rule); - } - }; - } -} - -DOMElement.prototype = { - getAttribute: function DOMElement_getAttribute(name) { - if (name in this.attributes) { - return this.attributes[name]; - } - - return null; - }, - getAttributeNS: function DOMElement_getAttributeNS(NS, name) { - if (name in this.attributes) { - return this.attributes[name]; - } - - if (NS) { - var suffix = ":" + name; - - for (var fullName in this.attributes) { - if (fullName.slice(-suffix.length) === suffix) { - return this.attributes[fullName]; - } - } - } - - return null; - }, - setAttribute: function DOMElement_setAttribute(name, value) { - value = value || ""; - value = xmlEncode(value); - this.attributes[name] = value; - }, - setAttributeNS: function DOMElement_setAttributeNS(NS, name, value) { - this.setAttribute(name, value); - }, - appendChild: function DOMElement_appendChild(element) { - var childNodes = this.childNodes; - - if (!childNodes.includes(element)) { - childNodes.push(element); - } - }, - hasChildNodes: function DOMElement_hasChildNodes() { - return this.childNodes.length !== 0; - }, - cloneNode: function DOMElement_cloneNode() { - var newNode = new DOMElement(this.nodeName); - newNode.childNodes = this.childNodes; - newNode.attributes = this.attributes; - newNode.textContent = this.textContent; - return newNode; - }, - toString: function DOMElement_toString() { - var buf = []; - var serializer = this.getSerializer(); - var chunk; - - while ((chunk = serializer.getNext()) !== null) { - buf.push(chunk); - } - - return buf.join(""); - }, - getSerializer: function DOMElement_getSerializer() { - return new DOMElementSerializer(this); - } -}; - -function DOMElementSerializer(node) { - this._node = node; - this._state = 0; - this._loopIndex = 0; - this._attributeKeys = null; - this._childSerializer = null; -} - -DOMElementSerializer.prototype = { - getNext: function DOMElementSerializer_getNext() { - var node = this._node; - - switch (this._state) { - case 0: - ++this._state; - return "<" + node.nodeName; - - case 1: - ++this._state; - - if (node.nodeName === "svg:svg") { - return ' xmlns:xlink="http://www.w3.org/1999/xlink"' + ' xmlns:svg="http://www.w3.org/2000/svg"'; - } - - case 2: - ++this._state; - this._loopIndex = 0; - this._attributeKeys = Object.keys(node.attributes); - - case 3: - if (this._loopIndex < this._attributeKeys.length) { - var name = this._attributeKeys[this._loopIndex++]; - return " " + name + '="' + xmlEncode(node.attributes[name]) + '"'; - } - - ++this._state; - return ">"; - - case 4: - if (node.nodeName === "svg:tspan" || node.nodeName === "svg:style") { - this._state = 6; - return xmlEncode(node.textContent); - } - - ++this._state; - this._loopIndex = 0; - - case 5: - var value; - - while (true) { - value = this._childSerializer && this._childSerializer.getNext(); - - if (value !== null) { - return value; - } - - var nextChild = node.childNodes[this._loopIndex++]; - - if (nextChild) { - this._childSerializer = new DOMElementSerializer(nextChild); - } else { - this._childSerializer = null; - ++this._state; - break; - } - } - - case 6: - ++this._state; - return ""; - - case 7: - return null; - - default: - throw new Error("Unexpected serialization state: " + this._state); - } - } -}; -const document = { - childNodes: [], - - get currentScript() { - return { - src: "" - }; - }, - - get documentElement() { - return this; - }, - - createElementNS: function (NS, element) { - var elObject = new DOMElement(element); - return elObject; - }, - createElement: function (element) { - return this.createElementNS("", element); - }, - getElementsByTagName: function (element) { - if (element === "head") { - return [this.head || (this.head = new DOMElement("head"))]; - } - - return []; - } -}; - -function Image() { - this._src = null; - this.onload = null; -} - -Image.prototype = { - get src() { - return this._src; - }, - - set src(value) { - this._src = value; - - if (this.onload) { - this.onload(); - } - } - -}; -exports.document = document; -exports.Image = Image; -exports.Element = DOMElement; -var exported_symbols = Object.keys(exports); - -exports.setStubs = function (namespace) { - exported_symbols.forEach(function (key) { - console.assert(!(key in namespace), "property should not be set: " + key); - namespace[key] = exports[key]; - }); -}; - -exports.unsetStubs = function (namespace) { - exported_symbols.forEach(function (key) { - console.assert(key in namespace, "property should be set: " + key); - delete namespace[key]; - }); -}; - - -/***/ }), - -/***/ 1527: -/***/ ((module) => { - -"use strict"; - - -module.exports = bail - -function bail(err) { - if (err) { - throw err - } -} - - -/***/ }), - -/***/ 3423: -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse('{"AEli":"Æ","AElig":"Æ","AM":"&","AMP":"&","Aacut":"Á","Aacute":"Á","Abreve":"Ă","Acir":"Â","Acirc":"Â","Acy":"А","Afr":"𝔄","Agrav":"À","Agrave":"À","Alpha":"Α","Amacr":"Ā","And":"⩓","Aogon":"Ą","Aopf":"𝔸","ApplyFunction":"⁡","Arin":"Å","Aring":"Å","Ascr":"𝒜","Assign":"≔","Atild":"Ã","Atilde":"Ã","Aum":"Ä","Auml":"Ä","Backslash":"∖","Barv":"⫧","Barwed":"⌆","Bcy":"Б","Because":"∵","Bernoullis":"ℬ","Beta":"Β","Bfr":"𝔅","Bopf":"𝔹","Breve":"˘","Bscr":"ℬ","Bumpeq":"≎","CHcy":"Ч","COP":"©","COPY":"©","Cacute":"Ć","Cap":"⋒","CapitalDifferentialD":"ⅅ","Cayleys":"ℭ","Ccaron":"Č","Ccedi":"Ç","Ccedil":"Ç","Ccirc":"Ĉ","Cconint":"∰","Cdot":"Ċ","Cedilla":"¸","CenterDot":"·","Cfr":"ℭ","Chi":"Χ","CircleDot":"⊙","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","Colon":"∷","Colone":"⩴","Congruent":"≡","Conint":"∯","ContourIntegral":"∮","Copf":"ℂ","Coproduct":"∐","CounterClockwiseContourIntegral":"∳","Cross":"⨯","Cscr":"𝒞","Cup":"⋓","CupCap":"≍","DD":"ⅅ","DDotrahd":"⤑","DJcy":"Ђ","DScy":"Ѕ","DZcy":"Џ","Dagger":"‡","Darr":"↡","Dashv":"⫤","Dcaron":"Ď","Dcy":"Д","Del":"∇","Delta":"Δ","Dfr":"𝔇","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","Diamond":"⋄","DifferentialD":"ⅆ","Dopf":"𝔻","Dot":"¨","DotDot":"⃜","DotEqual":"≐","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrow":"↓","DownArrowBar":"⤓","DownArrowUpArrow":"⇵","DownBreve":"̑","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVector":"↽","DownLeftVectorBar":"⥖","DownRightTeeVector":"⥟","DownRightVector":"⇁","DownRightVectorBar":"⥗","DownTee":"⊤","DownTeeArrow":"↧","Downarrow":"⇓","Dscr":"𝒟","Dstrok":"Đ","ENG":"Ŋ","ET":"Ð","ETH":"Ð","Eacut":"É","Eacute":"É","Ecaron":"Ě","Ecir":"Ê","Ecirc":"Ê","Ecy":"Э","Edot":"Ė","Efr":"𝔈","Egrav":"È","Egrave":"È","Element":"∈","Emacr":"Ē","EmptySmallSquare":"◻","EmptyVerySmallSquare":"▫","Eogon":"Ę","Eopf":"𝔼","Epsilon":"Ε","Equal":"⩵","EqualTilde":"≂","Equilibrium":"⇌","Escr":"ℰ","Esim":"⩳","Eta":"Η","Eum":"Ë","Euml":"Ë","Exists":"∃","ExponentialE":"ⅇ","Fcy":"Ф","Ffr":"𝔉","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","Fopf":"𝔽","ForAll":"∀","Fouriertrf":"ℱ","Fscr":"ℱ","GJcy":"Ѓ","G":">","GT":">","Gamma":"Γ","Gammad":"Ϝ","Gbreve":"Ğ","Gcedil":"Ģ","Gcirc":"Ĝ","Gcy":"Г","Gdot":"Ġ","Gfr":"𝔊","Gg":"⋙","Gopf":"𝔾","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","Gt":"≫","HARDcy":"Ъ","Hacek":"ˇ","Hat":"^","Hcirc":"Ĥ","Hfr":"ℌ","HilbertSpace":"ℋ","Hopf":"ℍ","HorizontalLine":"─","Hscr":"ℋ","Hstrok":"Ħ","HumpDownHump":"≎","HumpEqual":"≏","IEcy":"Е","IJlig":"IJ","IOcy":"Ё","Iacut":"Í","Iacute":"Í","Icir":"Î","Icirc":"Î","Icy":"И","Idot":"İ","Ifr":"ℑ","Igrav":"Ì","Igrave":"Ì","Im":"ℑ","Imacr":"Ī","ImaginaryI":"ⅈ","Implies":"⇒","Int":"∬","Integral":"∫","Intersection":"⋂","InvisibleComma":"⁣","InvisibleTimes":"⁢","Iogon":"Į","Iopf":"𝕀","Iota":"Ι","Iscr":"ℐ","Itilde":"Ĩ","Iukcy":"І","Ium":"Ï","Iuml":"Ï","Jcirc":"Ĵ","Jcy":"Й","Jfr":"𝔍","Jopf":"𝕁","Jscr":"𝒥","Jsercy":"Ј","Jukcy":"Є","KHcy":"Х","KJcy":"Ќ","Kappa":"Κ","Kcedil":"Ķ","Kcy":"К","Kfr":"𝔎","Kopf":"𝕂","Kscr":"𝒦","LJcy":"Љ","L":"<","LT":"<","Lacute":"Ĺ","Lambda":"Λ","Lang":"⟪","Laplacetrf":"ℒ","Larr":"↞","Lcaron":"Ľ","Lcedil":"Ļ","Lcy":"Л","LeftAngleBracket":"⟨","LeftArrow":"←","LeftArrowBar":"⇤","LeftArrowRightArrow":"⇆","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVector":"⇃","LeftDownVectorBar":"⥙","LeftFloor":"⌊","LeftRightArrow":"↔","LeftRightVector":"⥎","LeftTee":"⊣","LeftTeeArrow":"↤","LeftTeeVector":"⥚","LeftTriangle":"⊲","LeftTriangleBar":"⧏","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVector":"↿","LeftUpVectorBar":"⥘","LeftVector":"↼","LeftVectorBar":"⥒","Leftarrow":"⇐","Leftrightarrow":"⇔","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","LessLess":"⪡","LessSlantEqual":"⩽","LessTilde":"≲","Lfr":"𝔏","Ll":"⋘","Lleftarrow":"⇚","Lmidot":"Ŀ","LongLeftArrow":"⟵","LongLeftRightArrow":"⟷","LongRightArrow":"⟶","Longleftarrow":"⟸","Longleftrightarrow":"⟺","Longrightarrow":"⟹","Lopf":"𝕃","LowerLeftArrow":"↙","LowerRightArrow":"↘","Lscr":"ℒ","Lsh":"↰","Lstrok":"Ł","Lt":"≪","Map":"⤅","Mcy":"М","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","MinusPlus":"∓","Mopf":"𝕄","Mscr":"ℳ","Mu":"Μ","NJcy":"Њ","Nacute":"Ń","Ncaron":"Ň","Ncedil":"Ņ","Ncy":"Н","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","Nfr":"𝔑","NoBreak":"⁠","NonBreakingSpace":" ","Nopf":"ℕ","Not":"⫬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","NotLeftTriangle":"⋪","NotLeftTriangleBar":"⧏̸","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangle":"⋫","NotRightTriangleBar":"⧐̸","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","Nscr":"𝒩","Ntild":"Ñ","Ntilde":"Ñ","Nu":"Ν","OElig":"Œ","Oacut":"Ó","Oacute":"Ó","Ocir":"Ô","Ocirc":"Ô","Ocy":"О","Odblac":"Ő","Ofr":"𝔒","Ograv":"Ò","Ograve":"Ò","Omacr":"Ō","Omega":"Ω","Omicron":"Ο","Oopf":"𝕆","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","Or":"⩔","Oscr":"𝒪","Oslas":"Ø","Oslash":"Ø","Otild":"Õ","Otilde":"Õ","Otimes":"⨷","Oum":"Ö","Ouml":"Ö","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","PartialD":"∂","Pcy":"П","Pfr":"𝔓","Phi":"Φ","Pi":"Π","PlusMinus":"±","Poincareplane":"ℌ","Popf":"ℙ","Pr":"⪻","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","Prime":"″","Product":"∏","Proportion":"∷","Proportional":"∝","Pscr":"𝒫","Psi":"Ψ","QUO":"\\"","QUOT":"\\"","Qfr":"𝔔","Qopf":"ℚ","Qscr":"𝒬","RBarr":"⤐","RE":"®","REG":"®","Racute":"Ŕ","Rang":"⟫","Rarr":"↠","Rarrtl":"⤖","Rcaron":"Ř","Rcedil":"Ŗ","Rcy":"Р","Re":"ℜ","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","Rfr":"ℜ","Rho":"Ρ","RightAngleBracket":"⟩","RightArrow":"→","RightArrowBar":"⇥","RightArrowLeftArrow":"⇄","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVector":"⇂","RightDownVectorBar":"⥕","RightFloor":"⌋","RightTee":"⊢","RightTeeArrow":"↦","RightTeeVector":"⥛","RightTriangle":"⊳","RightTriangleBar":"⧐","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVector":"↾","RightUpVectorBar":"⥔","RightVector":"⇀","RightVectorBar":"⥓","Rightarrow":"⇒","Ropf":"ℝ","RoundImplies":"⥰","Rrightarrow":"⇛","Rscr":"ℛ","Rsh":"↱","RuleDelayed":"⧴","SHCHcy":"Щ","SHcy":"Ш","SOFTcy":"Ь","Sacute":"Ś","Sc":"⪼","Scaron":"Š","Scedil":"Ş","Scirc":"Ŝ","Scy":"С","Sfr":"𝔖","ShortDownArrow":"↓","ShortLeftArrow":"←","ShortRightArrow":"→","ShortUpArrow":"↑","Sigma":"Σ","SmallCircle":"∘","Sopf":"𝕊","Sqrt":"√","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","Sscr":"𝒮","Star":"⋆","Sub":"⋐","Subset":"⋐","SubsetEqual":"⊆","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","SuchThat":"∋","Sum":"∑","Sup":"⋑","Superset":"⊃","SupersetEqual":"⊇","Supset":"⋑","THOR":"Þ","THORN":"Þ","TRADE":"™","TSHcy":"Ћ","TScy":"Ц","Tab":"\\t","Tau":"Τ","Tcaron":"Ť","Tcedil":"Ţ","Tcy":"Т","Tfr":"𝔗","Therefore":"∴","Theta":"Θ","ThickSpace":"  ","ThinSpace":" ","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","Topf":"𝕋","TripleDot":"⃛","Tscr":"𝒯","Tstrok":"Ŧ","Uacut":"Ú","Uacute":"Ú","Uarr":"↟","Uarrocir":"⥉","Ubrcy":"Ў","Ubreve":"Ŭ","Ucir":"Û","Ucirc":"Û","Ucy":"У","Udblac":"Ű","Ufr":"𝔘","Ugrav":"Ù","Ugrave":"Ù","Umacr":"Ū","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","Uopf":"𝕌","UpArrow":"↑","UpArrowBar":"⤒","UpArrowDownArrow":"⇅","UpDownArrow":"↕","UpEquilibrium":"⥮","UpTee":"⊥","UpTeeArrow":"↥","Uparrow":"⇑","Updownarrow":"⇕","UpperLeftArrow":"↖","UpperRightArrow":"↗","Upsi":"ϒ","Upsilon":"Υ","Uring":"Ů","Uscr":"𝒰","Utilde":"Ũ","Uum":"Ü","Uuml":"Ü","VDash":"⊫","Vbar":"⫫","Vcy":"В","Vdash":"⊩","Vdashl":"⫦","Vee":"⋁","Verbar":"‖","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","Vopf":"𝕍","Vscr":"𝒱","Vvdash":"⊪","Wcirc":"Ŵ","Wedge":"⋀","Wfr":"𝔚","Wopf":"𝕎","Wscr":"𝒲","Xfr":"𝔛","Xi":"Ξ","Xopf":"𝕏","Xscr":"𝒳","YAcy":"Я","YIcy":"Ї","YUcy":"Ю","Yacut":"Ý","Yacute":"Ý","Ycirc":"Ŷ","Ycy":"Ы","Yfr":"𝔜","Yopf":"𝕐","Yscr":"𝒴","Yuml":"Ÿ","ZHcy":"Ж","Zacute":"Ź","Zcaron":"Ž","Zcy":"З","Zdot":"Ż","ZeroWidthSpace":"​","Zeta":"Ζ","Zfr":"ℨ","Zopf":"ℤ","Zscr":"𝒵","aacut":"á","aacute":"á","abreve":"ă","ac":"∾","acE":"∾̳","acd":"∿","acir":"â","acirc":"â","acut":"´","acute":"´","acy":"а","aeli":"æ","aelig":"æ","af":"⁡","afr":"𝔞","agrav":"à","agrave":"à","alefsym":"ℵ","aleph":"ℵ","alpha":"α","amacr":"ā","amalg":"⨿","am":"&","amp":"&","and":"∧","andand":"⩕","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsd":"∡","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","aogon":"ą","aopf":"𝕒","ap":"≈","apE":"⩰","apacir":"⩯","ape":"≊","apid":"≋","apos":"\'","approx":"≈","approxeq":"≊","arin":"å","aring":"å","ascr":"𝒶","ast":"*","asymp":"≈","asympeq":"≍","atild":"ã","atilde":"ã","aum":"ä","auml":"ä","awconint":"∳","awint":"⨑","bNot":"⫭","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","barvee":"⊽","barwed":"⌅","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","beta":"β","beth":"ℶ","between":"≬","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bnot":"⌐","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxDL":"╗","boxDR":"╔","boxDl":"╖","boxDr":"╓","boxH":"═","boxHD":"╦","boxHU":"╩","boxHd":"╤","boxHu":"╧","boxUL":"╝","boxUR":"╚","boxUl":"╜","boxUr":"╙","boxV":"║","boxVH":"╬","boxVL":"╣","boxVR":"╠","boxVh":"╫","boxVl":"╢","boxVr":"╟","boxbox":"⧉","boxdL":"╕","boxdR":"╒","boxdl":"┐","boxdr":"┌","boxh":"─","boxhD":"╥","boxhU":"╨","boxhd":"┬","boxhu":"┴","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxuL":"╛","boxuR":"╘","boxul":"┘","boxur":"└","boxv":"│","boxvH":"╪","boxvL":"╡","boxvR":"╞","boxvh":"┼","boxvl":"┤","boxvr":"├","bprime":"‵","breve":"˘","brvba":"¦","brvbar":"¦","bscr":"𝒷","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsol":"\\\\","bsolb":"⧅","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","bumpeq":"≏","cacute":"ć","cap":"∩","capand":"⩄","capbrcup":"⩉","capcap":"⩋","capcup":"⩇","capdot":"⩀","caps":"∩︀","caret":"⁁","caron":"ˇ","ccaps":"⩍","ccaron":"č","ccedi":"ç","ccedil":"ç","ccirc":"ĉ","ccups":"⩌","ccupssm":"⩐","cdot":"ċ","cedi":"¸","cedil":"¸","cemptyv":"⦲","cen":"¢","cent":"¢","centerdot":"·","cfr":"𝔠","chcy":"ч","check":"✓","checkmark":"✓","chi":"χ","cir":"○","cirE":"⧃","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledR":"®","circledS":"Ⓢ","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","clubs":"♣","clubsuit":"♣","colon":":","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","conint":"∮","copf":"𝕔","coprod":"∐","cop":"©","copy":"©","copysr":"℗","crarr":"↵","cross":"✗","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cup":"∪","cupbrcap":"⩈","cupcap":"⩆","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curre":"¤","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dArr":"⇓","dHar":"⥥","dagger":"†","daleth":"ℸ","darr":"↓","dash":"‐","dashv":"⊣","dbkarow":"⤏","dblac":"˝","dcaron":"ď","dcy":"д","dd":"ⅆ","ddagger":"‡","ddarr":"⇊","ddotseq":"⩷","de":"°","deg":"°","delta":"δ","demptyv":"⦱","dfisht":"⥿","dfr":"𝔡","dharl":"⇃","dharr":"⇂","diam":"⋄","diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","digamma":"ϝ","disin":"⋲","div":"÷","divid":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","dopf":"𝕕","dot":"˙","doteq":"≐","doteqdot":"≑","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","downarrow":"↓","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","dscr":"𝒹","dscy":"ѕ","dsol":"⧶","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","dzcy":"џ","dzigrarr":"⟿","eDDot":"⩷","eDot":"≑","eacut":"é","eacute":"é","easter":"⩮","ecaron":"ě","ecir":"ê","ecirc":"ê","ecolon":"≕","ecy":"э","edot":"ė","ee":"ⅇ","efDot":"≒","efr":"𝔢","eg":"⪚","egrav":"è","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","emacr":"ē","empty":"∅","emptyset":"∅","emptyv":"∅","emsp13":" ","emsp14":" ","emsp":" ","eng":"ŋ","ensp":" ","eogon":"ę","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","equals":"=","equest":"≟","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erDot":"≓","erarr":"⥱","escr":"ℯ","esdot":"≐","esim":"≂","eta":"η","et":"ð","eth":"ð","eum":"ë","euml":"ë","euro":"€","excl":"!","exist":"∃","expectation":"ℰ","exponentiale":"ⅇ","fallingdotseq":"≒","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","ffr":"𝔣","filig":"fi","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","fopf":"𝕗","forall":"∀","fork":"⋔","forkv":"⫙","fpartint":"⨍","frac1":"¼","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac3":"¾","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","gE":"≧","gEl":"⪌","gacute":"ǵ","gamma":"γ","gammad":"ϝ","gap":"⪆","gbreve":"ğ","gcirc":"ĝ","gcy":"г","gdot":"ġ","ge":"≥","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","ges":"⩾","gescc":"⪩","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","gfr":"𝔤","gg":"≫","ggg":"⋙","gimel":"ℷ","gjcy":"ѓ","gl":"≷","glE":"⪒","gla":"⪥","glj":"⪤","gnE":"≩","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gneq":"⪈","gneqq":"≩","gnsim":"⋧","gopf":"𝕘","grave":"`","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","g":">","gt":">","gtcc":"⪧","gtcir":"⩺","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","hArr":"⇔","hairsp":" ","half":"½","hamilt":"ℋ","hardcy":"ъ","harr":"↔","harrcir":"⥈","harrw":"↭","hbar":"ℏ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","horbar":"―","hscr":"𝒽","hslash":"ℏ","hstrok":"ħ","hybull":"⁃","hyphen":"‐","iacut":"í","iacute":"í","ic":"⁣","icir":"î","icirc":"î","icy":"и","iecy":"е","iexc":"¡","iexcl":"¡","iff":"⇔","ifr":"𝔦","igrav":"ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","ijlig":"ij","imacr":"ī","image":"ℑ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","imof":"⊷","imped":"Ƶ","in":"∈","incare":"℅","infin":"∞","infintie":"⧝","inodot":"ı","int":"∫","intcal":"⊺","integers":"ℤ","intercal":"⊺","intlarhk":"⨗","intprod":"⨼","iocy":"ё","iogon":"į","iopf":"𝕚","iota":"ι","iprod":"⨼","iques":"¿","iquest":"¿","iscr":"𝒾","isin":"∈","isinE":"⋹","isindot":"⋵","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","itilde":"ĩ","iukcy":"і","ium":"ï","iuml":"ï","jcirc":"ĵ","jcy":"й","jfr":"𝔧","jmath":"ȷ","jopf":"𝕛","jscr":"𝒿","jsercy":"ј","jukcy":"є","kappa":"κ","kappav":"ϰ","kcedil":"ķ","kcy":"к","kfr":"𝔨","kgreen":"ĸ","khcy":"х","kjcy":"ќ","kopf":"𝕜","kscr":"𝓀","lAarr":"⇚","lArr":"⇐","lAtail":"⤛","lBarr":"⤎","lE":"≦","lEg":"⪋","lHar":"⥢","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","lambda":"λ","lang":"⟨","langd":"⦑","langle":"⟨","lap":"⪅","laqu":"«","laquo":"«","larr":"←","larrb":"⇤","larrbfs":"⤟","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","lat":"⪫","latail":"⤙","late":"⪭","lates":"⪭︀","lbarr":"⤌","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","lcaron":"ľ","lcedil":"ļ","lceil":"⌈","lcub":"{","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","leftarrow":"←","leftarrowtail":"↢","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","leftthreetimes":"⋋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","les":"⩽","lescc":"⪨","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","lessgtr":"≶","lesssim":"≲","lfisht":"⥼","lfloor":"⌊","lfr":"𝔩","lg":"≶","lgE":"⪑","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","ljcy":"љ","ll":"≪","llarr":"⇇","llcorner":"⌞","llhard":"⥫","lltri":"◺","lmidot":"ŀ","lmoust":"⎰","lmoustache":"⎰","lnE":"≨","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","longleftrightarrow":"⟷","longmapsto":"⟼","longrightarrow":"⟶","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","lstrok":"ł","l":"<","lt":"<","ltcc":"⪦","ltcir":"⩹","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltrPar":"⦖","ltri":"◃","ltrie":"⊴","ltrif":"◂","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","mDDot":"∺","mac":"¯","macr":"¯","male":"♂","malt":"✠","maltese":"✠","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","mcy":"м","mdash":"—","measuredangle":"∡","mfr":"𝔪","mho":"℧","micr":"µ","micro":"µ","mid":"∣","midast":"*","midcir":"⫰","middo":"·","middot":"·","minus":"−","minusb":"⊟","minusd":"∸","minusdu":"⨪","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","mopf":"𝕞","mp":"∓","mscr":"𝓂","mstpos":"∾","mu":"μ","multimap":"⊸","mumap":"⊸","nGg":"⋙̸","nGt":"≫⃒","nGtv":"≫̸","nLeftarrow":"⇍","nLeftrightarrow":"⇎","nLl":"⋘̸","nLt":"≪⃒","nLtv":"≪̸","nRightarrow":"⇏","nVDash":"⊯","nVdash":"⊮","nabla":"∇","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natur":"♮","natural":"♮","naturals":"ℕ","nbs":" ","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","ncaron":"ň","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","ncy":"н","ndash":"–","ne":"≠","neArr":"⇗","nearhk":"⤤","nearr":"↗","nearrow":"↗","nedot":"≐̸","nequiv":"≢","nesear":"⤨","nesim":"≂̸","nexist":"∄","nexists":"∄","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","ngsim":"≵","ngt":"≯","ngtr":"≯","nhArr":"⇎","nharr":"↮","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","njcy":"њ","nlArr":"⇍","nlE":"≦̸","nlarr":"↚","nldr":"‥","nle":"≰","nleftarrow":"↚","nleftrightarrow":"↮","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nlsim":"≴","nlt":"≮","nltri":"⋪","nltrie":"⋬","nmid":"∤","nopf":"𝕟","no":"¬","not":"¬","notin":"∉","notinE":"⋹̸","notindot":"⋵̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","npar":"∦","nparallel":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","npre":"⪯̸","nprec":"⊀","npreceq":"⪯̸","nrArr":"⇏","nrarr":"↛","nrarrc":"⤳̸","nrarrw":"↝̸","nrightarrow":"↛","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","ntild":"ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","nu":"ν","num":"#","numero":"№","numsp":" ","nvDash":"⊭","nvHarr":"⤄","nvap":"≍⃒","nvdash":"⊬","nvge":"≥⃒","nvgt":">⃒","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwArr":"⇖","nwarhk":"⤣","nwarr":"↖","nwarrow":"↖","nwnear":"⤧","oS":"Ⓢ","oacut":"ó","oacute":"ó","oast":"⊛","ocir":"ô","ocirc":"ô","ocy":"о","odash":"⊝","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","oelig":"œ","ofcir":"⦿","ofr":"𝔬","ogon":"˛","ograv":"ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","omacr":"ō","omega":"ω","omicron":"ο","omid":"⦶","ominus":"⊖","oopf":"𝕠","opar":"⦷","operp":"⦹","oplus":"⊕","or":"∨","orarr":"↻","ord":"º","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oscr":"ℴ","oslas":"ø","oslash":"ø","osol":"⊘","otild":"õ","otilde":"õ","otimes":"⊗","otimesas":"⨶","oum":"ö","ouml":"ö","ovbar":"⌽","par":"¶","para":"¶","parallel":"∥","parsim":"⫳","parsl":"⫽","part":"∂","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","pfr":"𝔭","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plus":"+","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plusdo":"∔","plusdu":"⨥","pluse":"⩲","plusm":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","pointint":"⨕","popf":"𝕡","poun":"£","pound":"£","pr":"≺","prE":"⪳","prap":"⪷","prcue":"≼","pre":"⪯","prec":"≺","precapprox":"⪷","preccurlyeq":"≼","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","precsim":"≾","prime":"′","primes":"ℙ","prnE":"⪵","prnap":"⪹","prnsim":"⋨","prod":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","propto":"∝","prsim":"≾","prurel":"⊰","pscr":"𝓅","psi":"ψ","puncsp":" ","qfr":"𝔮","qint":"⨌","qopf":"𝕢","qprime":"⁗","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quo":"\\"","quot":"\\"","rAarr":"⇛","rArr":"⇒","rAtail":"⤜","rBarr":"⤏","rHar":"⥤","race":"∽̱","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","rangd":"⦒","range":"⦥","rangle":"⟩","raqu":"»","raquo":"»","rarr":"→","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","rarrtl":"↣","rarrw":"↝","ratail":"⤚","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","rcaron":"ř","rcedil":"ŗ","rceil":"⌉","rcub":"}","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","rect":"▭","re":"®","reg":"®","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","rhard":"⇁","rharu":"⇀","rharul":"⥬","rho":"ρ","rhov":"ϱ","rightarrow":"→","rightarrowtail":"↣","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","rightthreetimes":"⋌","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoust":"⎱","rmoustache":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","roplus":"⨮","rotimes":"⨵","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","rsaquo":"›","rscr":"𝓇","rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","ruluhar":"⥨","rx":"℞","sacute":"ś","sbquo":"‚","sc":"≻","scE":"⪴","scap":"⪸","scaron":"š","sccue":"≽","sce":"⪰","scedil":"ş","scirc":"ŝ","scnE":"⪶","scnap":"⪺","scnsim":"⋩","scpolint":"⨓","scsim":"≿","scy":"с","sdot":"⋅","sdotb":"⊡","sdote":"⩦","seArr":"⇘","searhk":"⤥","searr":"↘","searrow":"↘","sec":"§","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","sfr":"𝔰","sfrown":"⌢","sharp":"♯","shchcy":"щ","shcy":"ш","shortmid":"∣","shortparallel":"∥","sh":"­","shy":"­","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","softcy":"ь","sol":"/","solb":"⧄","solbar":"⌿","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","squ":"□","square":"□","squarf":"▪","squf":"▪","srarr":"→","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","subE":"⫅","subdot":"⪽","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","subseteq":"⊆","subseteqq":"⫅","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succ":"≻","succapprox":"⪸","succcurlyeq":"≽","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","sum":"∑","sung":"♪","sup":"⊃","sup1":"¹","sup2":"²","sup3":"³","supE":"⫆","supdot":"⪾","supdsub":"⫘","supe":"⊇","supedot":"⫄","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swArr":"⇙","swarhk":"⤦","swarr":"↙","swarrow":"↙","swnwar":"⤪","szli":"ß","szlig":"ß","target":"⌖","tau":"τ","tbrk":"⎴","tcaron":"ť","tcedil":"ţ","tcy":"т","tdot":"⃛","telrec":"⌕","tfr":"𝔱","there4":"∴","therefore":"∴","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","thinsp":" ","thkap":"≈","thksim":"∼","thor":"þ","thorn":"þ","tilde":"˜","time":"×","times":"×","timesb":"⊠","timesbar":"⨱","timesd":"⨰","tint":"∭","toea":"⤨","top":"⊤","topbot":"⌶","topcir":"⫱","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","tscr":"𝓉","tscy":"ц","tshcy":"ћ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","uArr":"⇑","uHar":"⥣","uacut":"ú","uacute":"ú","uarr":"↑","ubrcy":"ў","ubreve":"ŭ","ucir":"û","ucirc":"û","ucy":"у","udarr":"⇅","udblac":"ű","udhar":"⥮","ufisht":"⥾","ufr":"𝔲","ugrav":"ù","ugrave":"ù","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","umacr":"ū","um":"¨","uml":"¨","uogon":"ų","uopf":"𝕦","uparrow":"↑","updownarrow":"↕","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","upsi":"υ","upsih":"ϒ","upsilon":"υ","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","uring":"ů","urtri":"◹","uscr":"𝓊","utdot":"⋰","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","uum":"ü","uuml":"ü","uwangle":"⦧","vArr":"⇕","vBar":"⫨","vBarv":"⫩","vDash":"⊨","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vcy":"в","vdash":"⊢","vee":"∨","veebar":"⊻","veeeq":"≚","vellip":"⋮","verbar":"|","vert":"|","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","vopf":"𝕧","vprop":"∝","vrtri":"⊳","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","vzigzag":"⦚","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","wedgeq":"≙","weierp":"℘","wfr":"𝔴","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","xfr":"𝔵","xhArr":"⟺","xharr":"⟷","xi":"ξ","xlArr":"⟸","xlarr":"⟵","xmap":"⟼","xnis":"⋻","xodot":"⨀","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrArr":"⟹","xrarr":"⟶","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","yacut":"ý","yacute":"ý","yacy":"я","ycirc":"ŷ","ycy":"ы","ye":"¥","yen":"¥","yfr":"𝔶","yicy":"ї","yopf":"𝕪","yscr":"𝓎","yucy":"ю","yum":"ÿ","yuml":"ÿ","zacute":"ź","zcaron":"ž","zcy":"з","zdot":"ż","zeetrf":"ℨ","zeta":"ζ","zfr":"𝔷","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","zscr":"𝓏","zwj":"‍","zwnj":"‌"}'); - -/***/ }), - -/***/ 229: -/***/ ((module) => { - -"use strict"; - - -var hasOwn = Object.prototype.hasOwnProperty; -var toStr = Object.prototype.toString; -var defineProperty = Object.defineProperty; -var gOPD = Object.getOwnPropertyDescriptor; - -var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - - return toStr.call(arr) === '[object Array]'; -}; - -var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) { /**/ } - - return typeof key === 'undefined' || hasOwn.call(obj, key); -}; - -// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target -var setProperty = function setProperty(target, options) { - if (defineProperty && options.name === '__proto__') { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true - }); - } else { - target[options.name] = options.newValue; - } -}; - -// Return undefined instead of __proto__ if '__proto__' is not an own property -var getProperty = function getProperty(obj, name) { - if (name === '__proto__') { - if (!hasOwn.call(obj, name)) { - return void 0; - } else if (gOPD) { - // In early versions of node, obj['__proto__'] is buggy when obj has - // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. - return gOPD(obj, name).value; - } - } - - return obj[name]; -}; - -module.exports = function extend() { - var options, name, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; - - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { - target = {}; - } - - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = getProperty(target, name); - copy = getProperty(options, name); - - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); - - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - setProperty(target, { name: name, newValue: copy }); - } - } - } - } - } - - // Return the modified object - return target; -}; - - -/***/ }), - -/***/ 8809: -/***/ ((module) => { - -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -module.exports = function isBuffer (obj) { - return obj != null && obj.constructor != null && - typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - - -/***/ }), - -/***/ 469: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var visit = __webpack_require__(2148) - -module.exports = getDefinitionFactory - -var own = {}.hasOwnProperty - -// Get a definition in `node` by `identifier`. -function getDefinitionFactory(node, options) { - return getterFactory(gather(node, options)) -} - -// Gather all definitions in `node` -function gather(node) { - var cache = {} - - if (!node || !node.type) { - throw new Error('mdast-util-definitions expected node') - } - - visit(node, 'definition', ondefinition) - - return cache - - function ondefinition(definition) { - var id = normalise(definition.identifier) - if (!own.call(cache, id)) { - cache[id] = definition - } - } -} - -// Factory to get a node from the given definition-cache. -function getterFactory(cache) { - return getter - - // Get a node from the bound definition-cache. - function getter(identifier) { - var id = identifier && normalise(identifier) - return id && own.call(cache, id) ? cache[id] : null - } -} - -function normalise(identifier) { - return identifier.toUpperCase() -} - - -/***/ }), - -/***/ 7275: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = fromMarkdown - -// These three are compiled away in the `dist/` - -var toString = __webpack_require__(8667) -var assign = __webpack_require__(1328) -var own = __webpack_require__(277) -var normalizeIdentifier = __webpack_require__(7243) -var safeFromInt = __webpack_require__(54) -var parser = __webpack_require__(2849) -var preprocessor = __webpack_require__(7500) -var postprocess = __webpack_require__(3153) -var decode = __webpack_require__(9944) -var stringifyPosition = __webpack_require__(9158) - -function fromMarkdown(value, encoding, options) { - if (typeof encoding !== 'string') { - options = encoding - encoding = undefined - } - - return compiler(options)( - postprocess( - parser(options).document().write(preprocessor()(value, encoding, true)) - ) - ) -} - -// Note this compiler only understand complete buffering, not streaming. -function compiler(options) { - var settings = options || {} - var config = configure( - { - transforms: [], - canContainEols: [ - 'emphasis', - 'fragment', - 'heading', - 'paragraph', - 'strong' - ], - - enter: { - autolink: opener(link), - autolinkProtocol: onenterdata, - autolinkEmail: onenterdata, - atxHeading: opener(heading), - blockQuote: opener(blockQuote), - characterEscape: onenterdata, - characterReference: onenterdata, - codeFenced: opener(codeFlow), - codeFencedFenceInfo: buffer, - codeFencedFenceMeta: buffer, - codeIndented: opener(codeFlow, buffer), - codeText: opener(codeText, buffer), - codeTextData: onenterdata, - data: onenterdata, - codeFlowValue: onenterdata, - definition: opener(definition), - definitionDestinationString: buffer, - definitionLabelString: buffer, - definitionTitleString: buffer, - emphasis: opener(emphasis), - hardBreakEscape: opener(hardBreak), - hardBreakTrailing: opener(hardBreak), - htmlFlow: opener(html, buffer), - htmlFlowData: onenterdata, - htmlText: opener(html, buffer), - htmlTextData: onenterdata, - image: opener(image), - label: buffer, - link: opener(link), - listItem: opener(listItem), - listItemValue: onenterlistitemvalue, - listOrdered: opener(list, onenterlistordered), - listUnordered: opener(list), - paragraph: opener(paragraph), - reference: onenterreference, - referenceString: buffer, - resourceDestinationString: buffer, - resourceTitleString: buffer, - setextHeading: opener(heading), - strong: opener(strong), - thematicBreak: opener(thematicBreak) - }, - - exit: { - atxHeading: closer(), - atxHeadingSequence: onexitatxheadingsequence, - autolink: closer(), - autolinkEmail: onexitautolinkemail, - autolinkProtocol: onexitautolinkprotocol, - blockQuote: closer(), - characterEscapeValue: onexitdata, - characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, - characterReferenceMarkerNumeric: onexitcharacterreferencemarker, - characterReferenceValue: onexitcharacterreferencevalue, - codeFenced: closer(onexitcodefenced), - codeFencedFence: onexitcodefencedfence, - codeFencedFenceInfo: onexitcodefencedfenceinfo, - codeFencedFenceMeta: onexitcodefencedfencemeta, - codeFlowValue: onexitdata, - codeIndented: closer(onexitcodeindented), - codeText: closer(onexitcodetext), - codeTextData: onexitdata, - data: onexitdata, - definition: closer(), - definitionDestinationString: onexitdefinitiondestinationstring, - definitionLabelString: onexitdefinitionlabelstring, - definitionTitleString: onexitdefinitiontitlestring, - emphasis: closer(), - hardBreakEscape: closer(onexithardbreak), - hardBreakTrailing: closer(onexithardbreak), - htmlFlow: closer(onexithtmlflow), - htmlFlowData: onexitdata, - htmlText: closer(onexithtmltext), - htmlTextData: onexitdata, - image: closer(onexitimage), - label: onexitlabel, - labelText: onexitlabeltext, - lineEnding: onexitlineending, - link: closer(onexitlink), - listItem: closer(), - listOrdered: closer(), - listUnordered: closer(), - paragraph: closer(), - referenceString: onexitreferencestring, - resourceDestinationString: onexitresourcedestinationstring, - resourceTitleString: onexitresourcetitlestring, - resource: onexitresource, - setextHeading: closer(onexitsetextheading), - setextHeadingLineSequence: onexitsetextheadinglinesequence, - setextHeadingText: onexitsetextheadingtext, - strong: closer(), - thematicBreak: closer() - } - }, - - settings.mdastExtensions || [] - ) - - var data = {} - - return compile - - function compile(events) { - var tree = {type: 'root', children: []} - var stack = [tree] - var tokenStack = [] - var listStack = [] - var index = -1 - var handler - var listStart - - var context = { - stack: stack, - tokenStack: tokenStack, - config: config, - enter: enter, - exit: exit, - buffer: buffer, - resume: resume, - setData: setData, - getData: getData - } - - while (++index < events.length) { - // We preprocess lists to add `listItem` tokens, and to infer whether - // items the list itself are spread out. - if ( - events[index][1].type === 'listOrdered' || - events[index][1].type === 'listUnordered' - ) { - if (events[index][0] === 'enter') { - listStack.push(index) - } else { - listStart = listStack.pop(index) - index = prepareList(events, listStart, index) - } - } - } - - index = -1 - - while (++index < events.length) { - handler = config[events[index][0]] - - if (own.call(handler, events[index][1].type)) { - handler[events[index][1].type].call( - assign({sliceSerialize: events[index][2].sliceSerialize}, context), - events[index][1] - ) - } - } - - if (tokenStack.length) { - throw new Error( - 'Cannot close document, a token (`' + - tokenStack[tokenStack.length - 1].type + - '`, ' + - stringifyPosition({ - start: tokenStack[tokenStack.length - 1].start, - end: tokenStack[tokenStack.length - 1].end - }) + - ') is still open' - ) - } - - // Figure out `root` position. - tree.position = { - start: point( - events.length ? events[0][1].start : {line: 1, column: 1, offset: 0} - ), - - end: point( - events.length - ? events[events.length - 2][1].end - : {line: 1, column: 1, offset: 0} - ) - } - - index = -1 - while (++index < config.transforms.length) { - tree = config.transforms[index](tree) || tree - } - - return tree - } - - function prepareList(events, start, length) { - var index = start - 1 - var containerBalance = -1 - var listSpread = false - var listItem - var tailIndex - var lineIndex - var tailEvent - var event - var firstBlankLineIndex - var atMarker - - while (++index <= length) { - event = events[index] - - if ( - event[1].type === 'listUnordered' || - event[1].type === 'listOrdered' || - event[1].type === 'blockQuote' - ) { - if (event[0] === 'enter') { - containerBalance++ - } else { - containerBalance-- - } - - atMarker = undefined - } else if (event[1].type === 'lineEndingBlank') { - if (event[0] === 'enter') { - if ( - listItem && - !atMarker && - !containerBalance && - !firstBlankLineIndex - ) { - firstBlankLineIndex = index - } - - atMarker = undefined - } - } else if ( - event[1].type === 'linePrefix' || - event[1].type === 'listItemValue' || - event[1].type === 'listItemMarker' || - event[1].type === 'listItemPrefix' || - event[1].type === 'listItemPrefixWhitespace' - ) { - // Empty. - } else { - atMarker = undefined - } - - if ( - (!containerBalance && - event[0] === 'enter' && - event[1].type === 'listItemPrefix') || - (containerBalance === -1 && - event[0] === 'exit' && - (event[1].type === 'listUnordered' || - event[1].type === 'listOrdered')) - ) { - if (listItem) { - tailIndex = index - lineIndex = undefined - - while (tailIndex--) { - tailEvent = events[tailIndex] - - if ( - tailEvent[1].type === 'lineEnding' || - tailEvent[1].type === 'lineEndingBlank' - ) { - if (tailEvent[0] === 'exit') continue - - if (lineIndex) { - events[lineIndex][1].type = 'lineEndingBlank' - listSpread = true - } - - tailEvent[1].type = 'lineEnding' - lineIndex = tailIndex - } else if ( - tailEvent[1].type === 'linePrefix' || - tailEvent[1].type === 'blockQuotePrefix' || - tailEvent[1].type === 'blockQuotePrefixWhitespace' || - tailEvent[1].type === 'blockQuoteMarker' || - tailEvent[1].type === 'listItemIndent' - ) { - // Empty - } else { - break - } - } - - if ( - firstBlankLineIndex && - (!lineIndex || firstBlankLineIndex < lineIndex) - ) { - listItem._spread = true - } - - // Fix position. - listItem.end = point( - lineIndex ? events[lineIndex][1].start : event[1].end - ) - - events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]) - index++ - length++ - } - - // Create a new list item. - if (event[1].type === 'listItemPrefix') { - listItem = { - type: 'listItem', - _spread: false, - start: point(event[1].start) - } - - events.splice(index, 0, ['enter', listItem, event[2]]) - index++ - length++ - firstBlankLineIndex = undefined - atMarker = true - } - } - } - - events[start][1]._spread = listSpread - return length - } - - function setData(key, value) { - data[key] = value - } - - function getData(key) { - return data[key] - } - - function point(d) { - return {line: d.line, column: d.column, offset: d.offset} - } - - function opener(create, and) { - return open - - function open(token) { - enter.call(this, create(token), token) - if (and) and.call(this, token) - } - } - - function buffer() { - this.stack.push({type: 'fragment', children: []}) - } - - function enter(node, token) { - this.stack[this.stack.length - 1].children.push(node) - this.stack.push(node) - this.tokenStack.push(token) - node.position = {start: point(token.start)} - return node - } - - function closer(and) { - return close - - function close(token) { - if (and) and.call(this, token) - exit.call(this, token) - } - } - - function exit(token) { - var node = this.stack.pop() - var open = this.tokenStack.pop() - - if (!open) { - throw new Error( - 'Cannot close `' + - token.type + - '` (' + - stringifyPosition({start: token.start, end: token.end}) + - '): it’s not open' - ) - } else if (open.type !== token.type) { - throw new Error( - 'Cannot close `' + - token.type + - '` (' + - stringifyPosition({start: token.start, end: token.end}) + - '): a different token (`' + - open.type + - '`, ' + - stringifyPosition({start: open.start, end: open.end}) + - ') is open' - ) - } - - node.position.end = point(token.end) - return node - } - - function resume() { - return toString(this.stack.pop()) - } - - // - // Handlers. - // - - function onenterlistordered() { - setData('expectingFirstListItemValue', true) - } - - function onenterlistitemvalue(token) { - if (getData('expectingFirstListItemValue')) { - this.stack[this.stack.length - 2].start = parseInt( - this.sliceSerialize(token), - 10 - ) - - setData('expectingFirstListItemValue') - } - } - - function onexitcodefencedfenceinfo() { - var data = this.resume() - this.stack[this.stack.length - 1].lang = data - } - - function onexitcodefencedfencemeta() { - var data = this.resume() - this.stack[this.stack.length - 1].meta = data - } - - function onexitcodefencedfence() { - // Exit if this is the closing fence. - if (getData('flowCodeInside')) return - this.buffer() - setData('flowCodeInside', true) - } - - function onexitcodefenced() { - var data = this.resume() - this.stack[this.stack.length - 1].value = data.replace( - /^(\r?\n|\r)|(\r?\n|\r)$/g, - '' - ) - - setData('flowCodeInside') - } - - function onexitcodeindented() { - var data = this.resume() - this.stack[this.stack.length - 1].value = data - } - - function onexitdefinitionlabelstring(token) { - // Discard label, use the source content instead. - var label = this.resume() - this.stack[this.stack.length - 1].label = label - this.stack[this.stack.length - 1].identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase() - } - - function onexitdefinitiontitlestring() { - var data = this.resume() - this.stack[this.stack.length - 1].title = data - } - - function onexitdefinitiondestinationstring() { - var data = this.resume() - this.stack[this.stack.length - 1].url = data - } - - function onexitatxheadingsequence(token) { - if (!this.stack[this.stack.length - 1].depth) { - this.stack[this.stack.length - 1].depth = this.sliceSerialize( - token - ).length - } - } - - function onexitsetextheadingtext() { - setData('setextHeadingSlurpLineEnding', true) - } - - function onexitsetextheadinglinesequence(token) { - this.stack[this.stack.length - 1].depth = - this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2 - } - - function onexitsetextheading() { - setData('setextHeadingSlurpLineEnding') - } - - function onenterdata(token) { - var siblings = this.stack[this.stack.length - 1].children - var tail = siblings[siblings.length - 1] - - if (!tail || tail.type !== 'text') { - // Add a new text node. - tail = text() - tail.position = {start: point(token.start)} - this.stack[this.stack.length - 1].children.push(tail) - } - - this.stack.push(tail) - } - - function onexitdata(token) { - var tail = this.stack.pop() - tail.value += this.sliceSerialize(token) - tail.position.end = point(token.end) - } - - function onexitlineending(token) { - var context = this.stack[this.stack.length - 1] - - // If we’re at a hard break, include the line ending in there. - if (getData('atHardBreak')) { - context.children[context.children.length - 1].position.end = point( - token.end - ) - - setData('atHardBreak') - return - } - - if ( - !getData('setextHeadingSlurpLineEnding') && - config.canContainEols.indexOf(context.type) > -1 - ) { - onenterdata.call(this, token) - onexitdata.call(this, token) - } - } - - function onexithardbreak() { - setData('atHardBreak', true) - } - - function onexithtmlflow() { - var data = this.resume() - this.stack[this.stack.length - 1].value = data - } - - function onexithtmltext() { - var data = this.resume() - this.stack[this.stack.length - 1].value = data - } - - function onexitcodetext() { - var data = this.resume() - this.stack[this.stack.length - 1].value = data - } - - function onexitlink() { - var context = this.stack[this.stack.length - 1] - - // To do: clean. - if (getData('inReference')) { - context.type += 'Reference' - context.referenceType = getData('referenceType') || 'shortcut' - delete context.url - delete context.title - } else { - delete context.identifier - delete context.label - delete context.referenceType - } - - setData('referenceType') - } - - function onexitimage() { - var context = this.stack[this.stack.length - 1] - - // To do: clean. - if (getData('inReference')) { - context.type += 'Reference' - context.referenceType = getData('referenceType') || 'shortcut' - delete context.url - delete context.title - } else { - delete context.identifier - delete context.label - delete context.referenceType - } - - setData('referenceType') - } - - function onexitlabeltext(token) { - this.stack[this.stack.length - 2].identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase() - } - - function onexitlabel() { - var fragment = this.stack[this.stack.length - 1] - var value = this.resume() - - this.stack[this.stack.length - 1].label = value - - // Assume a reference. - setData('inReference', true) - - if (this.stack[this.stack.length - 1].type === 'link') { - this.stack[this.stack.length - 1].children = fragment.children - } else { - this.stack[this.stack.length - 1].alt = value - } - } - - function onexitresourcedestinationstring() { - var data = this.resume() - this.stack[this.stack.length - 1].url = data - } - - function onexitresourcetitlestring() { - var data = this.resume() - this.stack[this.stack.length - 1].title = data - } - - function onexitresource() { - setData('inReference') - } - - function onenterreference() { - setData('referenceType', 'collapsed') - } - - function onexitreferencestring(token) { - var label = this.resume() - this.stack[this.stack.length - 1].label = label - this.stack[this.stack.length - 1].identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase() - setData('referenceType', 'full') - } - - function onexitcharacterreferencemarker(token) { - setData('characterReferenceType', token.type) - } - - function onexitcharacterreferencevalue(token) { - var data = this.sliceSerialize(token) - var type = getData('characterReferenceType') - var value - var tail - - if (type) { - value = safeFromInt( - data, - type === 'characterReferenceMarkerNumeric' ? 10 : 16 - ) - - setData('characterReferenceType') - } else { - value = decode(data) - } - - tail = this.stack.pop() - tail.value += value - tail.position.end = point(token.end) - } - - function onexitautolinkprotocol(token) { - onexitdata.call(this, token) - this.stack[this.stack.length - 1].url = this.sliceSerialize(token) - } - - function onexitautolinkemail(token) { - onexitdata.call(this, token) - this.stack[this.stack.length - 1].url = - 'mailto:' + this.sliceSerialize(token) - } - - // - // Creaters. - // - - function blockQuote() { - return {type: 'blockquote', children: []} - } - - function codeFlow() { - return {type: 'code', lang: null, meta: null, value: ''} - } - - function codeText() { - return {type: 'inlineCode', value: ''} - } - - function definition() { - return { - type: 'definition', - identifier: '', - label: null, - title: null, - url: '' - } - } - - function emphasis() { - return {type: 'emphasis', children: []} - } - - function heading() { - return {type: 'heading', depth: undefined, children: []} - } - - function hardBreak() { - return {type: 'break'} - } - - function html() { - return {type: 'html', value: ''} - } - - function image() { - return {type: 'image', title: null, url: '', alt: null} - } - - function link() { - return {type: 'link', title: null, url: '', children: []} - } - - function list(token) { - return { - type: 'list', - ordered: token.type === 'listOrdered', - start: null, - spread: token._spread, - children: [] - } - } - - function listItem(token) { - return { - type: 'listItem', - spread: token._spread, - checked: null, - children: [] - } - } - - function paragraph() { - return {type: 'paragraph', children: []} - } - - function strong() { - return {type: 'strong', children: []} - } - - function text() { - return {type: 'text', value: ''} - } - - function thematicBreak() { - return {type: 'thematicBreak'} - } -} - -function configure(config, extensions) { - var index = -1 - - while (++index < extensions.length) { - extension(config, extensions[index]) - } - - return config -} - -function extension(config, extension) { - var key - var left - - for (key in extension) { - left = own.call(config, key) ? config[key] : (config[key] = {}) - - if (key === 'canContainEols' || key === 'transforms') { - config[key] = [].concat(left, extension[key]) - } else { - Object.assign(left, extension[key]) - } - } -} - - -/***/ }), - -/***/ 3885: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = __webpack_require__(7275) - - -/***/ }), - -/***/ 8667: -/***/ ((module) => { - -"use strict"; - - -module.exports = toString - -// Get the text content of a node. -// Prefer the node’s plain-text fields, otherwise serialize its children, -// and if the given value is an array, serialize the nodes in it. -function toString(node) { - return ( - (node && - (node.value || - node.alt || - node.title || - ('children' in node && all(node.children)) || - ('length' in node && all(node)))) || - '' - ) -} - -function all(values) { - var result = [] - var index = -1 - - while (++index < values.length) { - result[index] = toString(values[index]) - } - - return result.join('') -} - - -/***/ }), - -/***/ 9376: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -module.exports = __webpack_require__(8780) - - -/***/ }), - -/***/ 8941: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = all - -var one = __webpack_require__(8205) - -function all(h, parent) { - var nodes = parent.children || [] - var length = nodes.length - var values = [] - var index = -1 - var result - var head - - while (++index < length) { - result = one(h, nodes[index], parent) - - if (result) { - if (index && nodes[index - 1].type === 'break') { - if (result.value) { - result.value = result.value.replace(/^\s+/, '') - } - - head = result.children && result.children[0] - - if (head && head.value) { - head.value = head.value.replace(/^\s+/, '') - } - } - - values = values.concat(result) - } - } - - return values -} - - -/***/ }), - -/***/ 783: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = generateFootnotes - -var thematicBreak = __webpack_require__(3699) -var list = __webpack_require__(6054) -var wrap = __webpack_require__(5295) - -function generateFootnotes(h) { - var footnoteById = h.footnoteById - var footnoteOrder = h.footnoteOrder - var length = footnoteOrder.length - var index = -1 - var listItems = [] - var def - var backReference - var content - var tail - - while (++index < length) { - def = footnoteById[footnoteOrder[index].toUpperCase()] - - if (!def) { - continue - } - - content = def.children.concat() - tail = content[content.length - 1] - backReference = { - type: 'link', - url: '#fnref-' + def.identifier, - data: {hProperties: {className: ['footnote-backref']}}, - children: [{type: 'text', value: '↩'}] - } - - if (!tail || tail.type !== 'paragraph') { - tail = {type: 'paragraph', children: []} - content.push(tail) - } - - tail.children.push(backReference) - - listItems.push({ - type: 'listItem', - data: {hProperties: {id: 'fn-' + def.identifier}}, - children: content, - position: def.position - }) - } - - if (listItems.length === 0) { - return null - } - - return h( - null, - 'div', - {className: ['footnotes']}, - wrap( - [ - thematicBreak(h), - list(h, {type: 'list', ordered: true, children: listItems}) - ], - true - ) - ) -} - - -/***/ }), - -/***/ 4182: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = blockquote - -var wrap = __webpack_require__(5295) -var all = __webpack_require__(8941) - -function blockquote(h, node) { - return h(node, 'blockquote', wrap(all(h, node), true)) -} - - -/***/ }), - -/***/ 2016: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = hardBreak - -var u = __webpack_require__(2872) - -function hardBreak(h, node) { - return [h(node, 'br'), u('text', '\n')] -} - - -/***/ }), - -/***/ 7021: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = code - -var u = __webpack_require__(2872) - -function code(h, node) { - var value = node.value ? node.value + '\n' : '' - // To do: next major, use `node.lang` w/o regex, the splitting’s been going - // on for years in remark now. - var lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/) - var props = {} - var code - - if (lang) { - props.className = ['language-' + lang] - } - - code = h(node, 'code', props, [u('text', value)]) - - if (node.meta) { - code.data = {meta: node.meta} - } - - return h(node.position, 'pre', [code]) -} - - -/***/ }), - -/***/ 4941: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = strikethrough - -var all = __webpack_require__(8941) - -function strikethrough(h, node) { - return h(node, 'del', all(h, node)) -} - - -/***/ }), - -/***/ 5363: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = emphasis - -var all = __webpack_require__(8941) - -function emphasis(h, node) { - return h(node, 'em', all(h, node)) -} - - -/***/ }), - -/***/ 7123: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = footnoteReference - -var u = __webpack_require__(2872) - -function footnoteReference(h, node) { - var footnoteOrder = h.footnoteOrder - var identifier = String(node.identifier) - - if (footnoteOrder.indexOf(identifier) === -1) { - footnoteOrder.push(identifier) - } - - return h(node.position, 'sup', {id: 'fnref-' + identifier}, [ - h(node, 'a', {href: '#fn-' + identifier, className: ['footnote-ref']}, [ - u('text', node.label || identifier) - ]) - ]) -} - - -/***/ }), - -/***/ 8945: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = footnote - -var footnoteReference = __webpack_require__(7123) - -function footnote(h, node) { - var footnoteById = h.footnoteById - var footnoteOrder = h.footnoteOrder - var identifier = 1 - - while (identifier in footnoteById) { - identifier++ - } - - identifier = String(identifier) - - // No need to check if `identifier` exists in `footnoteOrder`, it’s guaranteed - // to not exist because we just generated it. - footnoteOrder.push(identifier) - - footnoteById[identifier] = { - type: 'footnoteDefinition', - identifier: identifier, - children: [{type: 'paragraph', children: node.children}], - position: node.position - } - - return footnoteReference(h, { - type: 'footnoteReference', - identifier: identifier, - position: node.position - }) -} - - -/***/ }), - -/***/ 2593: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = heading - -var all = __webpack_require__(8941) - -function heading(h, node) { - return h(node, 'h' + node.depth, all(h, node)) -} - - -/***/ }), - -/***/ 7973: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = html - -var u = __webpack_require__(2872) - -// Return either a `raw` node in dangerous mode, otherwise nothing. -function html(h, node) { - return h.dangerous ? h.augment(node, u('raw', node.value)) : null -} - - -/***/ }), - -/***/ 1480: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = imageReference - -var normalize = __webpack_require__(4651) -var revert = __webpack_require__(1704) - -function imageReference(h, node) { - var def = h.definition(node.identifier) - var props - - if (!def) { - return revert(h, node) - } - - props = {src: normalize(def.url || ''), alt: node.alt} - - if (def.title !== null && def.title !== undefined) { - props.title = def.title - } - - return h(node, 'img', props) -} - - -/***/ }), - -/***/ 1387: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var normalize = __webpack_require__(4651) - -module.exports = image - -function image(h, node) { - var props = {src: normalize(node.url), alt: node.alt} - - if (node.title !== null && node.title !== undefined) { - props.title = node.title - } - - return h(node, 'img', props) -} - - -/***/ }), - -/***/ 8995: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = { - blockquote: __webpack_require__(4182), - break: __webpack_require__(2016), - code: __webpack_require__(7021), - delete: __webpack_require__(4941), - emphasis: __webpack_require__(5363), - footnoteReference: __webpack_require__(7123), - footnote: __webpack_require__(8945), - heading: __webpack_require__(2593), - html: __webpack_require__(7973), - imageReference: __webpack_require__(1480), - image: __webpack_require__(1387), - inlineCode: __webpack_require__(8611), - linkReference: __webpack_require__(9285), - link: __webpack_require__(8037), - listItem: __webpack_require__(848), - list: __webpack_require__(6054), - paragraph: __webpack_require__(1741), - root: __webpack_require__(3863), - strong: __webpack_require__(8149), - table: __webpack_require__(4627), - text: __webpack_require__(6864), - thematicBreak: __webpack_require__(3699), - toml: ignore, - yaml: ignore, - definition: ignore, - footnoteDefinition: ignore -} - -// Return nothing for nodes that are ignored. -function ignore() { - return null -} - - -/***/ }), - -/***/ 8611: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = inlineCode - -var u = __webpack_require__(2872) - -function inlineCode(h, node) { - var value = node.value.replace(/\r?\n|\r/g, ' ') - return h(node, 'code', [u('text', value)]) -} - - -/***/ }), - -/***/ 9285: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = linkReference - -var normalize = __webpack_require__(4651) -var revert = __webpack_require__(1704) -var all = __webpack_require__(8941) - -function linkReference(h, node) { - var def = h.definition(node.identifier) - var props - - if (!def) { - return revert(h, node) - } - - props = {href: normalize(def.url || '')} - - if (def.title !== null && def.title !== undefined) { - props.title = def.title - } - - return h(node, 'a', props, all(h, node)) -} - - -/***/ }), - -/***/ 8037: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var normalize = __webpack_require__(4651) -var all = __webpack_require__(8941) - -module.exports = link - -function link(h, node) { - var props = {href: normalize(node.url)} - - if (node.title !== null && node.title !== undefined) { - props.title = node.title - } - - return h(node, 'a', props, all(h, node)) -} - - -/***/ }), - -/***/ 848: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = listItem - -var u = __webpack_require__(2872) -var all = __webpack_require__(8941) - -function listItem(h, node, parent) { - var result = all(h, node) - var head = result[0] - var loose = parent ? listLoose(parent) : listItemLoose(node) - var props = {} - var wrapped = [] - var length - var index - var child - - if (typeof node.checked === 'boolean') { - if (!head || head.tagName !== 'p') { - head = h(null, 'p', []) - result.unshift(head) - } - - if (head.children.length > 0) { - head.children.unshift(u('text', ' ')) - } - - head.children.unshift( - h(null, 'input', { - type: 'checkbox', - checked: node.checked, - disabled: true - }) - ) - - // According to github-markdown-css, this class hides bullet. - // See: . - props.className = ['task-list-item'] - } - - length = result.length - index = -1 - - while (++index < length) { - child = result[index] - - // Add eols before nodes, except if this is a loose, first paragraph. - if (loose || index !== 0 || child.tagName !== 'p') { - wrapped.push(u('text', '\n')) - } - - if (child.tagName === 'p' && !loose) { - wrapped = wrapped.concat(child.children) - } else { - wrapped.push(child) - } - } - - // Add a final eol. - if (length && (loose || child.tagName !== 'p')) { - wrapped.push(u('text', '\n')) - } - - return h(node, 'li', props, wrapped) -} - -function listLoose(node) { - var loose = node.spread - var children = node.children - var length = children.length - var index = -1 - - while (!loose && ++index < length) { - loose = listItemLoose(children[index]) - } - - return loose -} - -function listItemLoose(node) { - var spread = node.spread - - return spread === undefined || spread === null - ? node.children.length > 1 - : spread -} - - -/***/ }), - -/***/ 6054: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = list - -var wrap = __webpack_require__(5295) -var all = __webpack_require__(8941) - -function list(h, node) { - var props = {} - var name = node.ordered ? 'ol' : 'ul' - var items - var index = -1 - var length - - if (typeof node.start === 'number' && node.start !== 1) { - props.start = node.start - } - - items = all(h, node) - length = items.length - - // Like GitHub, add a class for custom styling. - while (++index < length) { - if ( - items[index].properties.className && - items[index].properties.className.indexOf('task-list-item') !== -1 - ) { - props.className = ['contains-task-list'] - break - } - } - - return h(node, name, props, wrap(items, true)) -} - - -/***/ }), - -/***/ 1741: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = paragraph - -var all = __webpack_require__(8941) - -function paragraph(h, node) { - return h(node, 'p', all(h, node)) -} - - -/***/ }), - -/***/ 3863: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = root - -var u = __webpack_require__(2872) -var wrap = __webpack_require__(5295) -var all = __webpack_require__(8941) - -function root(h, node) { - return h.augment(node, u('root', wrap(all(h, node)))) -} - - -/***/ }), - -/***/ 8149: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = strong - -var all = __webpack_require__(8941) - -function strong(h, node) { - return h(node, 'strong', all(h, node)) -} - - -/***/ }), - -/***/ 4627: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = table - -var position = __webpack_require__(9725) -var wrap = __webpack_require__(5295) -var all = __webpack_require__(8941) - -function table(h, node) { - var rows = node.children - var index = rows.length - var align = node.align || [] - var alignLength = align.length - var result = [] - var pos - var row - var out - var name - var cell - - while (index--) { - row = rows[index].children - name = index === 0 ? 'th' : 'td' - pos = alignLength || row.length - out = [] - - while (pos--) { - cell = row[pos] - out[pos] = h(cell, name, {align: align[pos]}, cell ? all(h, cell) : []) - } - - result[index] = h(rows[index], 'tr', wrap(out, true)) - } - - return h( - node, - 'table', - wrap( - [h(result[0].position, 'thead', wrap([result[0]], true))].concat( - result[1] - ? h( - { - start: position.start(result[1]), - end: position.end(result[result.length - 1]) - }, - 'tbody', - wrap(result.slice(1), true) - ) - : [] - ), - true - ) - ) -} - - -/***/ }), - -/***/ 6864: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = text - -var u = __webpack_require__(2872) - -function text(h, node) { - return h.augment( - node, - u('text', String(node.value).replace(/[ \t]*(\r?\n|\r)[ \t]*/g, '$1')) - ) -} - - -/***/ }), - -/***/ 3699: -/***/ ((module) => { - -"use strict"; - - -module.exports = thematicBreak - -function thematicBreak(h, node) { - return h(node, 'hr') -} - - -/***/ }), - -/***/ 8780: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = toHast - -var u = __webpack_require__(2872) -var visit = __webpack_require__(2148) -var position = __webpack_require__(9725) -var generated = __webpack_require__(8666) -var definitions = __webpack_require__(469) -var one = __webpack_require__(8205) -var footer = __webpack_require__(783) -var handlers = __webpack_require__(8995) - -var own = {}.hasOwnProperty - -var deprecationWarningIssued = false - -// Factory to transform. -function factory(tree, options) { - var settings = options || {} - - // Issue a warning if the deprecated tag 'allowDangerousHTML' is used - if (settings.allowDangerousHTML !== undefined && !deprecationWarningIssued) { - deprecationWarningIssued = true - console.warn( - 'mdast-util-to-hast: deprecation: `allowDangerousHTML` is nonstandard, use `allowDangerousHtml` instead' - ) - } - - var dangerous = settings.allowDangerousHtml || settings.allowDangerousHTML - var footnoteById = {} - - h.dangerous = dangerous - h.definition = definitions(tree) - h.footnoteById = footnoteById - h.footnoteOrder = [] - h.augment = augment - h.handlers = Object.assign({}, handlers, settings.handlers) - h.unknownHandler = settings.unknownHandler - h.passThrough = settings.passThrough - - visit(tree, 'footnoteDefinition', onfootnotedefinition) - - return h - - // Finalise the created `right`, a hast node, from `left`, an mdast node. - function augment(left, right) { - var data - var ctx - - // Handle `data.hName`, `data.hProperties, `data.hChildren`. - if (left && left.data) { - data = left.data - - if (data.hName) { - if (right.type !== 'element') { - right = { - type: 'element', - tagName: '', - properties: {}, - children: [] - } - } - - right.tagName = data.hName - } - - if (right.type === 'element' && data.hProperties) { - right.properties = Object.assign({}, right.properties, data.hProperties) - } - - if (right.children && data.hChildren) { - right.children = data.hChildren - } - } - - ctx = left && left.position ? left : {position: left} - - if (!generated(ctx)) { - right.position = { - start: position.start(ctx), - end: position.end(ctx) - } - } - - return right - } - - // Create an element for `node`. - function h(node, tagName, props, children) { - if ( - (children === undefined || children === null) && - typeof props === 'object' && - 'length' in props - ) { - children = props - props = {} - } - - return augment(node, { - type: 'element', - tagName: tagName, - properties: props || {}, - children: children || [] - }) - } - - function onfootnotedefinition(definition) { - var id = String(definition.identifier).toUpperCase() - - // Mimick CM behavior of link definitions. - // See: . - if (!own.call(footnoteById, id)) { - footnoteById[id] = definition - } - } -} - -// Transform `tree`, which is an mdast node, to a hast node. -function toHast(tree, options) { - var h = factory(tree, options) - var node = one(h, tree) - var foot = footer(h) - - if (foot) { - node.children = node.children.concat(u('text', '\n'), foot) - } - - return node -} - - -/***/ }), - -/***/ 8205: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = one - -var u = __webpack_require__(2872) -var all = __webpack_require__(8941) - -var own = {}.hasOwnProperty - -// Transform an unknown node. -function unknown(h, node) { - if (text(node)) { - return h.augment(node, u('text', node.value)) - } - - return h(node, 'div', all(h, node)) -} - -// Visit a node. -function one(h, node, parent) { - var type = node && node.type - var fn - - // Fail on non-nodes. - if (!type) { - throw new Error('Expected node, got `' + node + '`') - } - - if (own.call(h.handlers, type)) { - fn = h.handlers[type] - } else if (h.passThrough && h.passThrough.indexOf(type) > -1) { - fn = returnNode - } else { - fn = h.unknownHandler - } - - return (typeof fn === 'function' ? fn : unknown)(h, node, parent) -} - -// Check if the node should be renderered as a text node. -function text(node) { - var data = node.data || {} - - if ( - own.call(data, 'hName') || - own.call(data, 'hProperties') || - own.call(data, 'hChildren') - ) { - return false - } - - return 'value' in node -} - -function returnNode(h, node) { - var clone - - if (node.children) { - clone = Object.assign({}, node) - clone.children = all(h, node) - return clone - } - - return node -} - - -/***/ }), - -/***/ 1704: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = revert - -var u = __webpack_require__(2872) -var all = __webpack_require__(8941) - -// Return the content of a reference without definition as Markdown. -function revert(h, node) { - var subtype = node.referenceType - var suffix = ']' - var contents - var head - var tail - - if (subtype === 'collapsed') { - suffix += '[]' - } else if (subtype === 'full') { - suffix += '[' + (node.label || node.identifier) + ']' - } - - if (node.type === 'imageReference') { - return u('text', '![' + node.alt + suffix) - } - - contents = all(h, node) - head = contents[0] - - if (head && head.type === 'text') { - head.value = '[' + head.value - } else { - contents.unshift(u('text', '[')) - } - - tail = contents[contents.length - 1] - - if (tail && tail.type === 'text') { - tail.value += suffix - } else { - contents.push(u('text', suffix)) - } - - return contents -} - - -/***/ }), - -/***/ 5295: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = wrap - -var u = __webpack_require__(2872) - -// Wrap `nodes` with line feeds between each entry. -// Optionally adds line feeds at the start and end. -function wrap(nodes, loose) { - var result = [] - var index = -1 - var length = nodes.length - - if (loose) { - result.push(u('text', '\n')) - } - - while (++index < length) { - if (index) { - result.push(u('text', '\n')) - } - - result.push(nodes[index]) - } - - if (loose && nodes.length > 0) { - result.push(u('text', '\n')) - } - - return result -} - - -/***/ }), - -/***/ 4651: -/***/ ((module) => { - -"use strict"; - - - - -var encodeCache = {}; - - -// Create a lookup array where anything but characters in `chars` string -// and alphanumeric chars is percent-encoded. -// -function getEncodeCache(exclude) { - var i, ch, cache = encodeCache[exclude]; - if (cache) { return cache; } - - cache = encodeCache[exclude] = []; - - for (i = 0; i < 128; i++) { - ch = String.fromCharCode(i); - - if (/^[0-9a-z]$/i.test(ch)) { - // always allow unencoded alphanumeric characters - cache.push(ch); - } else { - cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2)); - } - } - - for (i = 0; i < exclude.length; i++) { - cache[exclude.charCodeAt(i)] = exclude[i]; - } - - return cache; -} - - -// Encode unsafe characters with percent-encoding, skipping already -// encoded sequences. -// -// - string - string to encode -// - exclude - list of characters to ignore (in addition to a-zA-Z0-9) -// - keepEscaped - don't encode '%' in a correct escape sequence (default: true) -// -function encode(string, exclude, keepEscaped) { - var i, l, code, nextCode, cache, - result = ''; - - if (typeof exclude !== 'string') { - // encode(string, keepEscaped) - keepEscaped = exclude; - exclude = encode.defaultChars; - } - - if (typeof keepEscaped === 'undefined') { - keepEscaped = true; - } - - cache = getEncodeCache(exclude); - - for (i = 0, l = string.length; i < l; i++) { - code = string.charCodeAt(i); - - if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { - if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { - result += string.slice(i, i + 3); - i += 2; - continue; - } - } - - if (code < 128) { - result += cache[code]; - continue; - } - - if (code >= 0xD800 && code <= 0xDFFF) { - if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) { - nextCode = string.charCodeAt(i + 1); - if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) { - result += encodeURIComponent(string[i] + string[i + 1]); - i++; - continue; - } - } - result += '%EF%BF%BD'; - continue; - } - - result += encodeURIComponent(string[i]); - } - - return result; -} - -encode.defaultChars = ";/?:@&=+$,-_.!~*'()#"; -encode.componentChars = "-_.!~*'()"; - - -module.exports = encode; - - -/***/ }), - -/***/ 5111: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var asciiAlpha = regexCheck(/[A-Za-z]/) - -module.exports = asciiAlpha - - -/***/ }), - -/***/ 6102: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) - -module.exports = asciiAlphanumeric - - -/***/ }), - -/***/ 5860: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) - -module.exports = asciiAtext - - -/***/ }), - -/***/ 841: -/***/ ((module) => { - -"use strict"; - - -// Note: EOF is seen as ASCII control here, because `null < 32 == true`. -function asciiControl(code) { - return ( - // Special whitespace codes (which have negative values), C0 and Control - // character DEL - code < 32 || code === 127 - ) -} - -module.exports = asciiControl - - -/***/ }), - -/***/ 9602: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var asciiDigit = regexCheck(/\d/) - -module.exports = asciiDigit - - -/***/ }), - -/***/ 3688: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var asciiHexDigit = regexCheck(/[\dA-Fa-f]/) - -module.exports = asciiHexDigit - - -/***/ }), - -/***/ 6577: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) - -module.exports = asciiPunctuation - - -/***/ }), - -/***/ 6430: -/***/ ((module) => { - -"use strict"; - - -function markdownLineEndingOrSpace(code) { - return code < 0 || code === 32 -} - -module.exports = markdownLineEndingOrSpace - - -/***/ }), - -/***/ 2739: -/***/ ((module) => { - -"use strict"; - - -function markdownLineEnding(code) { - return code < -2 -} - -module.exports = markdownLineEnding - - -/***/ }), - -/***/ 9225: -/***/ ((module) => { - -"use strict"; - - -function markdownSpace(code) { - return code === -2 || code === -1 || code === 32 -} - -module.exports = markdownSpace - - -/***/ }), - -/***/ 6516: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var unicodePunctuationRegex = __webpack_require__(3055) -var regexCheck = __webpack_require__(5540) - -// In fact adds to the bundle size. - -var unicodePunctuation = regexCheck(unicodePunctuationRegex) - -module.exports = unicodePunctuation - - -/***/ }), - -/***/ 463: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var regexCheck = __webpack_require__(5540) - -var unicodeWhitespace = regexCheck(/\s/) - -module.exports = unicodeWhitespace - - -/***/ }), - -/***/ 1328: -/***/ ((module) => { - -"use strict"; - - -var assign = Object.assign - -module.exports = assign - - -/***/ }), - -/***/ 4428: -/***/ ((module) => { - -"use strict"; - - -var fromCharCode = String.fromCharCode - -module.exports = fromCharCode - - -/***/ }), - -/***/ 277: -/***/ ((module) => { - -"use strict"; - - -var own = {}.hasOwnProperty - -module.exports = own - - -/***/ }), - -/***/ 958: -/***/ ((module) => { - -"use strict"; - - -// This module is copied from . -var basics = [ - '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', - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'head', - 'header', - 'hr', - 'html', - 'iframe', - 'legend', - 'li', - 'link', - 'main', - 'menu', - 'menuitem', - 'nav', - 'noframes', - 'ol', - 'optgroup', - 'option', - 'p', - 'param', - 'section', - 'source', - 'summary', - 'table', - 'tbody', - 'td', - 'tfoot', - 'th', - 'thead', - 'title', - 'tr', - 'track', - 'ul' -] - -module.exports = basics - - -/***/ }), - -/***/ 5121: -/***/ ((module) => { - -"use strict"; - - -// This module is copied from . -var raws = ['pre', 'script', 'style', 'textarea'] - -module.exports = raws - - -/***/ }), - -/***/ 7716: -/***/ ((module) => { - -"use strict"; - - -var splice = [].splice - -module.exports = splice - - -/***/ }), - -/***/ 3055: -/***/ ((module) => { - -"use strict"; - - -// This module is generated by `script/`. -// -// CommonMark handles attention (emphasis, strong) markers based on what comes -// before or after them. -// One such difference is if those characters are Unicode punctuation. -// This script is generated from the Unicode data. -var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/ - -module.exports = unicodePunctuation - - -/***/ }), - -/***/ 4770: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({value: true})) - -var text$1 = __webpack_require__(663) -var attention = __webpack_require__(9573) -var autolink = __webpack_require__(3613) -var blockQuote = __webpack_require__(893) -var characterEscape = __webpack_require__(6329) -var characterReference = __webpack_require__(5284) -var codeFenced = __webpack_require__(8638) -var codeIndented = __webpack_require__(3761) -var codeText = __webpack_require__(6758) -var definition = __webpack_require__(9767) -var hardBreakEscape = __webpack_require__(3690) -var headingAtx = __webpack_require__(2336) -var htmlFlow = __webpack_require__(6022) -var htmlText = __webpack_require__(6112) -var labelEnd = __webpack_require__(7680) -var labelStartImage = __webpack_require__(1038) -var labelStartLink = __webpack_require__(2484) -var lineEnding = __webpack_require__(7611) -var list = __webpack_require__(9955) -var setextUnderline = __webpack_require__(6468) -var thematicBreak = __webpack_require__(3834) - -var document = { - 42: list, - // Asterisk - 43: list, - // Plus sign - 45: list, - // Dash - 48: list, - // 0 - 49: list, - // 1 - 50: list, - // 2 - 51: list, - // 3 - 52: list, - // 4 - 53: list, - // 5 - 54: list, - // 6 - 55: list, - // 7 - 56: list, - // 8 - 57: list, - // 9 - 62: blockQuote // Greater than -} -var contentInitial = { - 91: definition // Left square bracket -} -var flowInitial = { - '-2': codeIndented, - // Horizontal tab - '-1': codeIndented, - // Virtual space - 32: codeIndented // Space -} -var flow = { - 35: headingAtx, - // Number sign - 42: thematicBreak, - // Asterisk - 45: [setextUnderline, thematicBreak], - // Dash - 60: htmlFlow, - // Less than - 61: setextUnderline, - // Equals to - 95: thematicBreak, - // Underscore - 96: codeFenced, - // Grave accent - 126: codeFenced // Tilde -} -var string = { - 38: characterReference, - // Ampersand - 92: characterEscape // Backslash -} -var text = { - '-5': lineEnding, - // Carriage return - '-4': lineEnding, - // Line feed - '-3': lineEnding, - // Carriage return + line feed - 33: labelStartImage, - // Exclamation mark - 38: characterReference, - // Ampersand - 42: attention, - // Asterisk - 60: [autolink, htmlText], - // Less than - 91: labelStartLink, - // Left square bracket - 92: [hardBreakEscape, characterEscape], - // Backslash - 93: labelEnd, - // Right square bracket - 95: attention, - // Underscore - 96: codeText // Grave accent -} -var insideSpan = { - null: [attention, text$1.resolver] -} -var disable = { - null: [] -} - -exports.contentInitial = contentInitial -exports.disable = disable -exports.document = document -exports.flow = flow -exports.flowInitial = flowInitial -exports.insideSpan = insideSpan -exports.string = string -exports.text = text - - -/***/ }), - -/***/ 5132: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({value: true})) - -var markdownLineEnding = __webpack_require__(2739) -var factorySpace = __webpack_require__(1905) - -var tokenize = initializeContent - -function initializeContent(effects) { - var contentStart = effects.attempt( - this.parser.constructs.contentInitial, - afterContentStartConstruct, - paragraphInitial - ) - var previous - return contentStart - - function afterContentStartConstruct(code) { - if (code === null) { - effects.consume(code) - return - } - - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return factorySpace(effects, contentStart, 'linePrefix') - } - - function paragraphInitial(code) { - effects.enter('paragraph') - return lineStart(code) - } - - function lineStart(code) { - var token = effects.enter('chunkText', { - contentType: 'text', - previous: previous - }) - - if (previous) { - previous.next = token - } - - previous = token - return data(code) - } - - function data(code) { - if (code === null) { - effects.exit('chunkText') - effects.exit('paragraph') - effects.consume(code) - return - } - - if (markdownLineEnding(code)) { - effects.consume(code) - effects.exit('chunkText') - return lineStart - } // Data. - - effects.consume(code) - return data - } -} - -exports.tokenize = tokenize - - -/***/ }), - -/***/ 4703: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({value: true})) - -var markdownLineEnding = __webpack_require__(2739) -var factorySpace = __webpack_require__(1905) -var partialBlankLine = __webpack_require__(921) - -var tokenize = initializeDocument -var containerConstruct = { - tokenize: tokenizeContainer -} -var lazyFlowConstruct = { - tokenize: tokenizeLazyFlow -} - -function initializeDocument(effects) { - var self = this - var stack = [] - var continued = 0 - var inspectConstruct = { - tokenize: tokenizeInspect, - partial: true - } - var inspectResult - var childFlow - var childToken - return start - - function start(code) { - if (continued < stack.length) { - self.containerState = stack[continued][1] - return effects.attempt( - stack[continued][0].continuation, - documentContinue, - documentContinued - )(code) - } - - return documentContinued(code) - } - - function documentContinue(code) { - continued++ - return start(code) - } - - function documentContinued(code) { - // If we’re in a concrete construct (such as when expecting another line of - // HTML, or we resulted in lazy content), we can immediately start flow. - if (inspectResult && inspectResult.flowContinue) { - return flowStart(code) - } - - self.interrupt = - childFlow && - childFlow.currentConstruct && - childFlow.currentConstruct.interruptible - self.containerState = {} - return effects.attempt( - containerConstruct, - containerContinue, - flowStart - )(code) - } - - function containerContinue(code) { - stack.push([self.currentConstruct, self.containerState]) - self.containerState = undefined - return documentContinued(code) - } - - function flowStart(code) { - if (code === null) { - exitContainers(0, true) - effects.consume(code) - return - } - - childFlow = childFlow || self.parser.flow(self.now()) - effects.enter('chunkFlow', { - contentType: 'flow', - previous: childToken, - _tokenizer: childFlow - }) - return flowContinue(code) - } - - function flowContinue(code) { - if (code === null) { - continueFlow(effects.exit('chunkFlow')) - return flowStart(code) - } - - if (markdownLineEnding(code)) { - effects.consume(code) - continueFlow(effects.exit('chunkFlow')) - return effects.check(inspectConstruct, documentAfterPeek) - } - - effects.consume(code) - return flowContinue - } - - function documentAfterPeek(code) { - exitContainers( - inspectResult.continued, - inspectResult && inspectResult.flowEnd - ) - continued = 0 - return start(code) - } - - function continueFlow(token) { - if (childToken) childToken.next = token - childToken = token - childFlow.lazy = inspectResult && inspectResult.lazy - childFlow.defineSkip(token.start) - childFlow.write(self.sliceStream(token)) - } - - function exitContainers(size, end) { - var index = stack.length // Close the flow. - - if (childFlow && end) { - childFlow.write([null]) - childToken = childFlow = undefined - } // Exit open containers. - - while (index-- > size) { - self.containerState = stack[index][1] - stack[index][0].exit.call(self, effects) - } - - stack.length = size - } - - function tokenizeInspect(effects, ok) { - var subcontinued = 0 - inspectResult = {} - return inspectStart - - function inspectStart(code) { - if (subcontinued < stack.length) { - self.containerState = stack[subcontinued][1] - return effects.attempt( - stack[subcontinued][0].continuation, - inspectContinue, - inspectLess - )(code) - } // If we’re continued but in a concrete flow, we can’t have more - // containers. - - if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { - inspectResult.flowContinue = true - return inspectDone(code) - } - - self.interrupt = - childFlow.currentConstruct && childFlow.currentConstruct.interruptible - self.containerState = {} - return effects.attempt( - containerConstruct, - inspectFlowEnd, - inspectDone - )(code) - } - - function inspectContinue(code) { - subcontinued++ - return self.containerState._closeFlow - ? inspectFlowEnd(code) - : inspectStart(code) - } - - function inspectLess(code) { - if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { - // Maybe another container? - self.containerState = {} - return effects.attempt( - containerConstruct, - inspectFlowEnd, // Maybe flow, or a blank line? - effects.attempt( - lazyFlowConstruct, - inspectFlowEnd, - effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) - ) - )(code) - } // Otherwise we’re interrupting. - - return inspectFlowEnd(code) - } - - function inspectLazy(code) { - // Act as if all containers are continued. - subcontinued = stack.length - inspectResult.lazy = true - inspectResult.flowContinue = true - return inspectDone(code) - } // We’re done with flow if we have more containers, or an interruption. - - function inspectFlowEnd(code) { - inspectResult.flowEnd = true - return inspectDone(code) - } - - function inspectDone(code) { - inspectResult.continued = subcontinued - self.interrupt = self.containerState = undefined - return ok(code) - } - } -} - -function tokenizeContainer(effects, ok, nok) { - return factorySpace( - effects, - effects.attempt(this.parser.constructs.document, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) -} - -function tokenizeLazyFlow(effects, ok, nok) { - return factorySpace( - effects, - effects.lazy(this.parser.constructs.flow, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) -} - -exports.tokenize = tokenize - - -/***/ }), - -/***/ 8664: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({value: true})) - -var content = __webpack_require__(6464) -var factorySpace = __webpack_require__(1905) -var partialBlankLine = __webpack_require__(921) - -var tokenize = initializeFlow - -function initializeFlow(effects) { - var self = this - var initial = effects.attempt( - // Try to parse a blank line. - partialBlankLine, - atBlankEnding, // Try to parse initial flow (essentially, only code). - effects.attempt( - this.parser.constructs.flowInitial, - afterConstruct, - factorySpace( - effects, - effects.attempt( - this.parser.constructs.flow, - afterConstruct, - effects.attempt(content, afterConstruct) - ), - 'linePrefix' - ) - ) - ) - return initial - - function atBlankEnding(code) { - if (code === null) { - effects.consume(code) - return - } - - effects.enter('lineEndingBlank') - effects.consume(code) - effects.exit('lineEndingBlank') - self.currentConstruct = undefined - return initial - } - - function afterConstruct(code) { - if (code === null) { - effects.consume(code) - return - } - - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - self.currentConstruct = undefined - return initial - } -} - -exports.tokenize = tokenize - - -/***/ }), - -/***/ 663: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({value: true})) - -var assign = __webpack_require__(1328) -var shallow = __webpack_require__(286) - -var text = initializeFactory('text') -var string = initializeFactory('string') -var resolver = { - resolveAll: createResolver() -} - -function initializeFactory(field) { - return { - tokenize: initializeText, - resolveAll: createResolver( - field === 'text' ? resolveAllLineSuffixes : undefined - ) - } - - function initializeText(effects) { - var self = this - var constructs = this.parser.constructs[field] - var text = effects.attempt(constructs, start, notText) - return start - - function start(code) { - return atBreak(code) ? text(code) : notText(code) - } - - function notText(code) { - if (code === null) { - effects.consume(code) - return - } - - effects.enter('data') - effects.consume(code) - return data - } - - function data(code) { - if (atBreak(code)) { - effects.exit('data') - return text(code) - } // Data. - - effects.consume(code) - return data - } - - function atBreak(code) { - var list = constructs[code] - var index = -1 - - if (code === null) { - return true - } - - if (list) { - while (++index < list.length) { - if ( - !list[index].previous || - list[index].previous.call(self, self.previous) - ) { - return true - } - } - } - } - } -} - -function createResolver(extraResolver) { - return resolveAllText - - function resolveAllText(events, context) { - var index = -1 - var enter // A rather boring computation (to merge adjacent `data` events) which - // improves mm performance by 29%. - - while (++index <= events.length) { - if (enter === undefined) { - if (events[index] && events[index][1].type === 'data') { - enter = index - index++ - } - } else if (!events[index] || events[index][1].type !== 'data') { - // Don’t do anything if there is one data token. - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end - events.splice(enter + 2, index - enter - 2) - index = enter + 2 - } - - enter = undefined - } - } - - return extraResolver ? extraResolver(events, context) : events - } -} // A rather ugly set of instructions which again looks at chunks in the input -// stream. -// The reason to do this here is that it is *much* faster to parse in reverse. -// And that we can’t hook into `null` to split the line suffix before an EOF. -// To do: figure out if we can make this into a clean utility, or even in core. -// As it will be useful for GFMs literal autolink extension (and maybe even -// tables?) - -function resolveAllLineSuffixes(events, context) { - var eventIndex = -1 - var chunks - var data - var chunk - var index - var bufferIndex - var size - var tabs - var token - - while (++eventIndex <= events.length) { - if ( - (eventIndex === events.length || - events[eventIndex][1].type === 'lineEnding') && - events[eventIndex - 1][1].type === 'data' - ) { - data = events[eventIndex - 1][1] - chunks = context.sliceStream(data) - index = chunks.length - bufferIndex = -1 - size = 0 - tabs = undefined - - while (index--) { - chunk = chunks[index] - - if (typeof chunk === 'string') { - bufferIndex = chunk.length - - while (chunk.charCodeAt(bufferIndex - 1) === 32) { - size++ - bufferIndex-- - } - - if (bufferIndex) break - bufferIndex = -1 - } // Number - else if (chunk === -2) { - tabs = true - size++ - } else if (chunk === -1); - else { - // Replacement character, exit. - index++ - break - } - } - - if (size) { - token = { - type: - eventIndex === events.length || tabs || size < 2 - ? 'lineSuffix' - : 'hardBreakTrailing', - start: { - line: data.end.line, - column: data.end.column - size, - offset: data.end.offset - size, - _index: data.start._index + index, - _bufferIndex: index - ? bufferIndex - : data.start._bufferIndex + bufferIndex - }, - end: shallow(data.end) - } - data.end = shallow(token.start) - - if (data.start.offset === data.end.offset) { - assign(data, token) - } else { - events.splice( - eventIndex, - 0, - ['enter', token, context], - ['exit', token, context] - ) - eventIndex += 2 - } - } - - eventIndex++ - } - } - - return events -} - -exports.resolver = resolver -exports.string = string -exports.text = text - - -/***/ }), - -/***/ 2849: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var content = __webpack_require__(5132) -var document = __webpack_require__(4703) -var flow = __webpack_require__(8664) -var text = __webpack_require__(663) -var combineExtensions = __webpack_require__(7450) -var createTokenizer = __webpack_require__(9708) -var miniflat = __webpack_require__(8011) -var constructs = __webpack_require__(4770) - -function parse(options) { - var settings = options || {} - var parser = { - defined: [], - constructs: combineExtensions( - [constructs].concat(miniflat(settings.extensions)) - ), - content: create(content), - document: create(document), - flow: create(flow), - string: create(text.string), - text: create(text.text) - } - return parser - - function create(initializer) { - return creator - - function creator(from) { - return createTokenizer(parser, initializer, from) - } - } -} - -module.exports = parse - - -/***/ }), - -/***/ 3153: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var subtokenize = __webpack_require__(8199) - -function postprocess(events) { - while (!subtokenize(events)) { - // Empty - } - - return events -} - -module.exports = postprocess - - -/***/ }), - -/***/ 7500: -/***/ ((module) => { - -"use strict"; - - -var search = /[\0\t\n\r]/g - -function preprocess() { - var start = true - var column = 1 - var buffer = '' - var atCarriageReturn - return preprocessor - - function preprocessor(value, encoding, end) { - var chunks = [] - var match - var next - var startPosition - var endPosition - var code - value = buffer + value.toString(encoding) - startPosition = 0 - buffer = '' - - if (start) { - if (value.charCodeAt(0) === 65279) { - startPosition++ - } - - start = undefined - } - - while (startPosition < value.length) { - search.lastIndex = startPosition - match = search.exec(value) - endPosition = match ? match.index : value.length - code = value.charCodeAt(endPosition) - - if (!match) { - buffer = value.slice(startPosition) - break - } - - if (code === 10 && startPosition === endPosition && atCarriageReturn) { - chunks.push(-3) - atCarriageReturn = undefined - } else { - if (atCarriageReturn) { - chunks.push(-5) - atCarriageReturn = undefined - } - - if (startPosition < endPosition) { - chunks.push(value.slice(startPosition, endPosition)) - column += endPosition - startPosition - } - - if (code === 0) { - chunks.push(65533) - column++ - } else if (code === 9) { - next = Math.ceil(column / 4) * 4 - chunks.push(-2) - - while (column++ < next) chunks.push(-1) - } else if (code === 10) { - chunks.push(-4) - column = 1 - } // Must be carriage return. - else { - atCarriageReturn = true - column = 1 - } - } - - startPosition = endPosition + 1 - } - - if (end) { - if (atCarriageReturn) chunks.push(-5) - if (buffer) chunks.push(buffer) - chunks.push(null) - } - - return chunks - } -} - -module.exports = preprocess - - -/***/ }), - -/***/ 9573: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var chunkedPush = __webpack_require__(8948) -var chunkedSplice = __webpack_require__(5966) -var classifyCharacter = __webpack_require__(3) -var movePoint = __webpack_require__(930) -var resolveAll = __webpack_require__(5579) -var shallow = __webpack_require__(286) - -var attention = { - name: 'attention', - tokenize: tokenizeAttention, - resolveAll: resolveAllAttention -} - -function resolveAllAttention(events, context) { - var index = -1 - var open - var group - var text - var openingSequence - var closingSequence - var use - var nextEvents - var offset // Walk through all events. - // - // Note: performance of this is fine on an mb of normal markdown, but it’s - // a bottleneck for malicious stuff. - - while (++index < events.length) { - // Find a token that can close. - if ( - events[index][0] === 'enter' && - events[index][1].type === 'attentionSequence' && - events[index][1]._close - ) { - open = index // Now walk back to find an opener. - - while (open--) { - // Find a token that can open the closer. - if ( - events[open][0] === 'exit' && - events[open][1].type === 'attentionSequence' && - events[open][1]._open && // If the markers are the same: - context.sliceSerialize(events[open][1]).charCodeAt(0) === - context.sliceSerialize(events[index][1]).charCodeAt(0) - ) { - // If the opening can close or the closing can open, - // and the close size *is not* a multiple of three, - // but the sum of the opening and closing size *is* multiple of three, - // then don’t match. - if ( - (events[open][1]._close || events[index][1]._open) && - (events[index][1].end.offset - events[index][1].start.offset) % 3 && - !( - (events[open][1].end.offset - - events[open][1].start.offset + - events[index][1].end.offset - - events[index][1].start.offset) % - 3 - ) - ) { - continue - } // Number of markers to use from the sequence. - - use = - events[open][1].end.offset - events[open][1].start.offset > 1 && - events[index][1].end.offset - events[index][1].start.offset > 1 - ? 2 - : 1 - openingSequence = { - type: use > 1 ? 'strongSequence' : 'emphasisSequence', - start: movePoint(shallow(events[open][1].end), -use), - end: shallow(events[open][1].end) - } - closingSequence = { - type: use > 1 ? 'strongSequence' : 'emphasisSequence', - start: shallow(events[index][1].start), - end: movePoint(shallow(events[index][1].start), use) - } - text = { - type: use > 1 ? 'strongText' : 'emphasisText', - start: shallow(events[open][1].end), - end: shallow(events[index][1].start) - } - group = { - type: use > 1 ? 'strong' : 'emphasis', - start: shallow(openingSequence.start), - end: shallow(closingSequence.end) - } - events[open][1].end = shallow(openingSequence.start) - events[index][1].start = shallow(closingSequence.end) - nextEvents = [] // If there are more markers in the opening, add them before. - - if (events[open][1].end.offset - events[open][1].start.offset) { - nextEvents = chunkedPush(nextEvents, [ - ['enter', events[open][1], context], - ['exit', events[open][1], context] - ]) - } // Opening. - - nextEvents = chunkedPush(nextEvents, [ - ['enter', group, context], - ['enter', openingSequence, context], - ['exit', openingSequence, context], - ['enter', text, context] - ]) // Between. - - nextEvents = chunkedPush( - nextEvents, - resolveAll( - context.parser.constructs.insideSpan.null, - events.slice(open + 1, index), - context - ) - ) // Closing. - - nextEvents = chunkedPush(nextEvents, [ - ['exit', text, context], - ['enter', closingSequence, context], - ['exit', closingSequence, context], - ['exit', group, context] - ]) // If there are more markers in the closing, add them after. - - if (events[index][1].end.offset - events[index][1].start.offset) { - offset = 2 - nextEvents = chunkedPush(nextEvents, [ - ['enter', events[index][1], context], - ['exit', events[index][1], context] - ]) - } else { - offset = 0 - } - - chunkedSplice(events, open - 1, index - open + 3, nextEvents) - index = open + nextEvents.length - offset - 2 - break - } - } - } - } // Remove remaining sequences. - - index = -1 - - while (++index < events.length) { - if (events[index][1].type === 'attentionSequence') { - events[index][1].type = 'data' - } - } - - return events -} - -function tokenizeAttention(effects, ok) { - var before = classifyCharacter(this.previous) - var marker - return start - - function start(code) { - effects.enter('attentionSequence') - marker = code - return sequence(code) - } - - function sequence(code) { - var token - var after - var open - var close - - if (code === marker) { - effects.consume(code) - return sequence - } - - token = effects.exit('attentionSequence') - after = classifyCharacter(code) - open = !after || (after === 2 && before) - close = !before || (before === 2 && after) - token._open = marker === 42 ? open : open && (before || !close) - token._close = marker === 42 ? close : close && (after || !open) - return ok(code) - } -} - -module.exports = attention - - -/***/ }), - -/***/ 3613: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var asciiAlpha = __webpack_require__(5111) -var asciiAlphanumeric = __webpack_require__(6102) -var asciiAtext = __webpack_require__(5860) -var asciiControl = __webpack_require__(841) - -var autolink = { - name: 'autolink', - tokenize: tokenizeAutolink -} - -function tokenizeAutolink(effects, ok, nok) { - var size = 1 - return start - - function start(code) { - effects.enter('autolink') - effects.enter('autolinkMarker') - effects.consume(code) - effects.exit('autolinkMarker') - effects.enter('autolinkProtocol') - return open - } - - function open(code) { - if (asciiAlpha(code)) { - effects.consume(code) - return schemeOrEmailAtext - } - - return asciiAtext(code) ? emailAtext(code) : nok(code) - } - - function schemeOrEmailAtext(code) { - return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) - ? schemeInsideOrEmailAtext(code) - : emailAtext(code) - } - - function schemeInsideOrEmailAtext(code) { - if (code === 58) { - effects.consume(code) - return urlInside - } - - if ( - (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && - size++ < 32 - ) { - effects.consume(code) - return schemeInsideOrEmailAtext - } - - return emailAtext(code) - } - - function urlInside(code) { - if (code === 62) { - effects.exit('autolinkProtocol') - return end(code) - } - - if (code === 32 || code === 60 || asciiControl(code)) { - return nok(code) - } - - effects.consume(code) - return urlInside - } - - function emailAtext(code) { - if (code === 64) { - effects.consume(code) - size = 0 - return emailAtSignOrDot - } - - if (asciiAtext(code)) { - effects.consume(code) - return emailAtext - } - - return nok(code) - } - - function emailAtSignOrDot(code) { - return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) - } - - function emailLabel(code) { - if (code === 46) { - effects.consume(code) - size = 0 - return emailAtSignOrDot - } - - if (code === 62) { - // Exit, then change the type. - effects.exit('autolinkProtocol').type = 'autolinkEmail' - return end(code) - } - - return emailValue(code) - } - - function emailValue(code) { - if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { - effects.consume(code) - return code === 45 ? emailValue : emailLabel - } - - return nok(code) - } - - function end(code) { - effects.enter('autolinkMarker') - effects.consume(code) - effects.exit('autolinkMarker') - effects.exit('autolink') - return ok - } -} - -module.exports = autolink - - -/***/ }), - -/***/ 893: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownSpace = __webpack_require__(9225) -var factorySpace = __webpack_require__(1905) - -var blockQuote = { - name: 'blockQuote', - tokenize: tokenizeBlockQuoteStart, - continuation: { - tokenize: tokenizeBlockQuoteContinuation - }, - exit: exit -} - -function tokenizeBlockQuoteStart(effects, ok, nok) { - var self = this - return start - - function start(code) { - if (code === 62) { - if (!self.containerState.open) { - effects.enter('blockQuote', { - _container: true - }) - self.containerState.open = true - } - - effects.enter('blockQuotePrefix') - effects.enter('blockQuoteMarker') - effects.consume(code) - effects.exit('blockQuoteMarker') - return after - } - - return nok(code) - } - - function after(code) { - if (markdownSpace(code)) { - effects.enter('blockQuotePrefixWhitespace') - effects.consume(code) - effects.exit('blockQuotePrefixWhitespace') - effects.exit('blockQuotePrefix') - return ok - } - - effects.exit('blockQuotePrefix') - return ok(code) - } -} - -function tokenizeBlockQuoteContinuation(effects, ok, nok) { - return factorySpace( - effects, - effects.attempt(blockQuote, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) -} - -function exit(effects) { - effects.exit('blockQuote') -} - -module.exports = blockQuote - - -/***/ }), - -/***/ 6329: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var asciiPunctuation = __webpack_require__(6577) - -var characterEscape = { - name: 'characterEscape', - tokenize: tokenizeCharacterEscape -} - -function tokenizeCharacterEscape(effects, ok, nok) { - return start - - function start(code) { - effects.enter('characterEscape') - effects.enter('escapeMarker') - effects.consume(code) - effects.exit('escapeMarker') - return open - } - - function open(code) { - if (asciiPunctuation(code)) { - effects.enter('characterEscapeValue') - effects.consume(code) - effects.exit('characterEscapeValue') - effects.exit('characterEscape') - return ok - } - - return nok(code) - } -} - -module.exports = characterEscape - - -/***/ }), - -/***/ 5284: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var decodeEntity = __webpack_require__(9944) -var asciiAlphanumeric = __webpack_require__(6102) -var asciiDigit = __webpack_require__(9602) -var asciiHexDigit = __webpack_require__(3688) - -function _interopDefaultLegacy(e) { - return e && typeof e === 'object' && 'default' in e ? e : {default: e} -} - -var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy(decodeEntity) - -var characterReference = { - name: 'characterReference', - tokenize: tokenizeCharacterReference -} - -function tokenizeCharacterReference(effects, ok, nok) { - var self = this - var size = 0 - var max - var test - return start - - function start(code) { - effects.enter('characterReference') - effects.enter('characterReferenceMarker') - effects.consume(code) - effects.exit('characterReferenceMarker') - return open - } - - function open(code) { - if (code === 35) { - effects.enter('characterReferenceMarkerNumeric') - effects.consume(code) - effects.exit('characterReferenceMarkerNumeric') - return numeric - } - - effects.enter('characterReferenceValue') - max = 31 - test = asciiAlphanumeric - return value(code) - } - - function numeric(code) { - if (code === 88 || code === 120) { - effects.enter('characterReferenceMarkerHexadecimal') - effects.consume(code) - effects.exit('characterReferenceMarkerHexadecimal') - effects.enter('characterReferenceValue') - max = 6 - test = asciiHexDigit - return value - } - - effects.enter('characterReferenceValue') - max = 7 - test = asciiDigit - return value(code) - } - - function value(code) { - var token - - if (code === 59 && size) { - token = effects.exit('characterReferenceValue') - - if ( - test === asciiAlphanumeric && - !decodeEntity__default['default'](self.sliceSerialize(token)) - ) { - return nok(code) - } - - effects.enter('characterReferenceMarker') - effects.consume(code) - effects.exit('characterReferenceMarker') - effects.exit('characterReference') - return ok - } - - if (test(code) && size++ < max) { - effects.consume(code) - return value - } - - return nok(code) - } -} - -module.exports = characterReference - - -/***/ }), - -/***/ 8638: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var markdownLineEndingOrSpace = __webpack_require__(6430) -var prefixSize = __webpack_require__(4510) -var factorySpace = __webpack_require__(1905) - -var codeFenced = { - name: 'codeFenced', - tokenize: tokenizeCodeFenced, - concrete: true -} - -function tokenizeCodeFenced(effects, ok, nok) { - var self = this - var closingFenceConstruct = { - tokenize: tokenizeClosingFence, - partial: true - } - var initialPrefix = prefixSize(this.events, 'linePrefix') - var sizeOpen = 0 - var marker - return start - - function start(code) { - effects.enter('codeFenced') - effects.enter('codeFencedFence') - effects.enter('codeFencedFenceSequence') - marker = code - return sequenceOpen(code) - } - - function sequenceOpen(code) { - if (code === marker) { - effects.consume(code) - sizeOpen++ - return sequenceOpen - } - - effects.exit('codeFencedFenceSequence') - return sizeOpen < 3 - ? nok(code) - : factorySpace(effects, infoOpen, 'whitespace')(code) - } - - function infoOpen(code) { - if (code === null || markdownLineEnding(code)) { - return openAfter(code) - } - - effects.enter('codeFencedFenceInfo') - effects.enter('chunkString', { - contentType: 'string' - }) - return info(code) - } - - function info(code) { - if (code === null || markdownLineEndingOrSpace(code)) { - effects.exit('chunkString') - effects.exit('codeFencedFenceInfo') - return factorySpace(effects, infoAfter, 'whitespace')(code) - } - - if (code === 96 && code === marker) return nok(code) - effects.consume(code) - return info - } - - function infoAfter(code) { - if (code === null || markdownLineEnding(code)) { - return openAfter(code) - } - - effects.enter('codeFencedFenceMeta') - effects.enter('chunkString', { - contentType: 'string' - }) - return meta(code) - } - - function meta(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('chunkString') - effects.exit('codeFencedFenceMeta') - return openAfter(code) - } - - if (code === 96 && code === marker) return nok(code) - effects.consume(code) - return meta - } - - function openAfter(code) { - effects.exit('codeFencedFence') - return self.interrupt ? ok(code) : content(code) - } - - function content(code) { - if (code === null) { - return after(code) - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return effects.attempt( - closingFenceConstruct, - after, - initialPrefix - ? factorySpace(effects, content, 'linePrefix', initialPrefix + 1) - : content - ) - } - - effects.enter('codeFlowValue') - return contentContinue(code) - } - - function contentContinue(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('codeFlowValue') - return content(code) - } - - effects.consume(code) - return contentContinue - } - - function after(code) { - effects.exit('codeFenced') - return ok(code) - } - - function tokenizeClosingFence(effects, ok, nok) { - var size = 0 - return factorySpace( - effects, - closingSequenceStart, - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) - - function closingSequenceStart(code) { - effects.enter('codeFencedFence') - effects.enter('codeFencedFenceSequence') - return closingSequence(code) - } - - function closingSequence(code) { - if (code === marker) { - effects.consume(code) - size++ - return closingSequence - } - - if (size < sizeOpen) return nok(code) - effects.exit('codeFencedFenceSequence') - return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) - } - - function closingSequenceEnd(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('codeFencedFence') - return ok(code) - } - - return nok(code) - } - } -} - -module.exports = codeFenced - - -/***/ }), - -/***/ 3761: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var chunkedSplice = __webpack_require__(5966) -var prefixSize = __webpack_require__(4510) -var factorySpace = __webpack_require__(1905) - -var codeIndented = { - name: 'codeIndented', - tokenize: tokenizeCodeIndented, - resolve: resolveCodeIndented -} -var indentedContentConstruct = { - tokenize: tokenizeIndentedContent, - partial: true -} - -function resolveCodeIndented(events, context) { - var code = { - type: 'codeIndented', - start: events[0][1].start, - end: events[events.length - 1][1].end - } - chunkedSplice(events, 0, 0, [['enter', code, context]]) - chunkedSplice(events, events.length, 0, [['exit', code, context]]) - return events -} - -function tokenizeCodeIndented(effects, ok, nok) { - return effects.attempt(indentedContentConstruct, afterPrefix, nok) - - function afterPrefix(code) { - if (code === null) { - return ok(code) - } - - if (markdownLineEnding(code)) { - return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) - } - - effects.enter('codeFlowValue') - return content(code) - } - - function content(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('codeFlowValue') - return afterPrefix(code) - } - - effects.consume(code) - return content - } -} - -function tokenizeIndentedContent(effects, ok, nok) { - var self = this - return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) - - function afterPrefix(code) { - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) - } - - return prefixSize(self.events, 'linePrefix') < 4 ? nok(code) : ok(code) - } -} - -module.exports = codeIndented - - -/***/ }), - -/***/ 6758: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) - -var codeText = { - name: 'codeText', - tokenize: tokenizeCodeText, - resolve: resolveCodeText, - previous: previous -} - -function resolveCodeText(events) { - var tailExitIndex = events.length - 4 - var headEnterIndex = 3 - var index - var enter // If we start and end with an EOL or a space. - - if ( - (events[headEnterIndex][1].type === 'lineEnding' || - events[headEnterIndex][1].type === 'space') && - (events[tailExitIndex][1].type === 'lineEnding' || - events[tailExitIndex][1].type === 'space') - ) { - index = headEnterIndex // And we have data. - - while (++index < tailExitIndex) { - if (events[index][1].type === 'codeTextData') { - // Then we have padding. - events[tailExitIndex][1].type = events[headEnterIndex][1].type = - 'codeTextPadding' - headEnterIndex += 2 - tailExitIndex -= 2 - break - } - } - } // Merge adjacent spaces and data. - - index = headEnterIndex - 1 - tailExitIndex++ - - while (++index <= tailExitIndex) { - if (enter === undefined) { - if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { - enter = index - } - } else if ( - index === tailExitIndex || - events[index][1].type === 'lineEnding' - ) { - events[enter][1].type = 'codeTextData' - - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end - events.splice(enter + 2, index - enter - 2) - tailExitIndex -= index - enter - 2 - index = enter + 2 - } - - enter = undefined - } - } - - return events -} - -function previous(code) { - // If there is a previous code, there will always be a tail. - return ( - code !== 96 || - this.events[this.events.length - 1][1].type === 'characterEscape' - ) -} - -function tokenizeCodeText(effects, ok, nok) { - var sizeOpen = 0 - var size - var token - return start - - function start(code) { - effects.enter('codeText') - effects.enter('codeTextSequence') - return openingSequence(code) - } - - function openingSequence(code) { - if (code === 96) { - effects.consume(code) - sizeOpen++ - return openingSequence - } - - effects.exit('codeTextSequence') - return gap(code) - } - - function gap(code) { - // EOF. - if (code === null) { - return nok(code) - } // Closing fence? - // Could also be data. - - if (code === 96) { - token = effects.enter('codeTextSequence') - size = 0 - return closingSequence(code) - } // Tabs don’t work, and virtual spaces don’t make sense. - - if (code === 32) { - effects.enter('space') - effects.consume(code) - effects.exit('space') - return gap - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return gap - } // Data. - - effects.enter('codeTextData') - return data(code) - } // In code. - - function data(code) { - if ( - code === null || - code === 32 || - code === 96 || - markdownLineEnding(code) - ) { - effects.exit('codeTextData') - return gap(code) - } - - effects.consume(code) - return data - } // Closing fence. - - function closingSequence(code) { - // More. - if (code === 96) { - effects.consume(code) - size++ - return closingSequence - } // Done! - - if (size === sizeOpen) { - effects.exit('codeTextSequence') - effects.exit('codeText') - return ok(code) - } // More or less accents: mark as data. - - token.type = 'codeTextData' - return data(code) - } -} - -module.exports = codeText - - -/***/ }), - -/***/ 6464: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var prefixSize = __webpack_require__(4510) -var subtokenize = __webpack_require__(8199) -var factorySpace = __webpack_require__(1905) - -// No name because it must not be turned off. -var content = { - tokenize: tokenizeContent, - resolve: resolveContent, - interruptible: true, - lazy: true -} -var continuationConstruct = { - tokenize: tokenizeContinuation, - partial: true -} // Content is transparent: it’s parsed right now. That way, definitions are also -// parsed right now: before text in paragraphs (specifically, media) are parsed. - -function resolveContent(events) { - subtokenize(events) - return events -} - -function tokenizeContent(effects, ok) { - var previous - return start - - function start(code) { - effects.enter('content') - previous = effects.enter('chunkContent', { - contentType: 'content' - }) - return data(code) - } - - function data(code) { - if (code === null) { - return contentEnd(code) - } - - if (markdownLineEnding(code)) { - return effects.check( - continuationConstruct, - contentContinue, - contentEnd - )(code) - } // Data. - - effects.consume(code) - return data - } - - function contentEnd(code) { - effects.exit('chunkContent') - effects.exit('content') - return ok(code) - } - - function contentContinue(code) { - effects.consume(code) - effects.exit('chunkContent') - previous = previous.next = effects.enter('chunkContent', { - contentType: 'content', - previous: previous - }) - return data - } -} - -function tokenizeContinuation(effects, ok, nok) { - var self = this - return startLookahead - - function startLookahead(code) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return factorySpace(effects, prefixed, 'linePrefix') - } - - function prefixed(code) { - if (code === null || markdownLineEnding(code)) { - return nok(code) - } - - if ( - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || - prefixSize(self.events, 'linePrefix') < 4 - ) { - return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) - } - - return ok(code) - } -} - -module.exports = content - - -/***/ }), - -/***/ 9767: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var markdownLineEndingOrSpace = __webpack_require__(6430) -var normalizeIdentifier = __webpack_require__(7243) -var factoryDestination = __webpack_require__(4625) -var factoryLabel = __webpack_require__(7422) -var factorySpace = __webpack_require__(1905) -var factoryWhitespace = __webpack_require__(415) -var factoryTitle = __webpack_require__(2608) - -var definition = { - name: 'definition', - tokenize: tokenizeDefinition -} -var titleConstruct = { - tokenize: tokenizeTitle, - partial: true -} - -function tokenizeDefinition(effects, ok, nok) { - var self = this - var identifier - return start - - function start(code) { - effects.enter('definition') - return factoryLabel.call( - self, - effects, - labelAfter, - nok, - 'definitionLabel', - 'definitionLabelMarker', - 'definitionLabelString' - )(code) - } - - function labelAfter(code) { - identifier = normalizeIdentifier( - self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) - ) - - if (code === 58) { - effects.enter('definitionMarker') - effects.consume(code) - effects.exit('definitionMarker') // Note: blank lines can’t exist in content. - - return factoryWhitespace( - effects, - factoryDestination( - effects, - effects.attempt( - titleConstruct, - factorySpace(effects, after, 'whitespace'), - factorySpace(effects, after, 'whitespace') - ), - nok, - 'definitionDestination', - 'definitionDestinationLiteral', - 'definitionDestinationLiteralMarker', - 'definitionDestinationRaw', - 'definitionDestinationString' - ) - ) - } - - return nok(code) - } - - function after(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('definition') - - if (self.parser.defined.indexOf(identifier) < 0) { - self.parser.defined.push(identifier) - } - - return ok(code) - } - - return nok(code) - } -} - -function tokenizeTitle(effects, ok, nok) { - return start - - function start(code) { - return markdownLineEndingOrSpace(code) - ? factoryWhitespace(effects, before)(code) - : nok(code) - } - - function before(code) { - if (code === 34 || code === 39 || code === 40) { - return factoryTitle( - effects, - factorySpace(effects, after, 'whitespace'), - nok, - 'definitionTitle', - 'definitionTitleMarker', - 'definitionTitleString' - )(code) - } - - return nok(code) - } - - function after(code) { - return code === null || markdownLineEnding(code) ? ok(code) : nok(code) - } -} - -module.exports = definition - - -/***/ }), - -/***/ 4625: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var asciiControl = __webpack_require__(841) -var markdownLineEndingOrSpace = __webpack_require__(6430) -var markdownLineEnding = __webpack_require__(2739) - -// eslint-disable-next-line max-params -function destinationFactory( - effects, - ok, - nok, - type, - literalType, - literalMarkerType, - rawType, - stringType, - max -) { - var limit = max || Infinity - var balance = 0 - return start - - function start(code) { - if (code === 60) { - effects.enter(type) - effects.enter(literalType) - effects.enter(literalMarkerType) - effects.consume(code) - effects.exit(literalMarkerType) - return destinationEnclosedBefore - } - - if (asciiControl(code) || code === 41) { - return nok(code) - } - - effects.enter(type) - effects.enter(rawType) - effects.enter(stringType) - effects.enter('chunkString', { - contentType: 'string' - }) - return destinationRaw(code) - } - - function destinationEnclosedBefore(code) { - if (code === 62) { - effects.enter(literalMarkerType) - effects.consume(code) - effects.exit(literalMarkerType) - effects.exit(literalType) - effects.exit(type) - return ok - } - - effects.enter(stringType) - effects.enter('chunkString', { - contentType: 'string' - }) - return destinationEnclosed(code) - } - - function destinationEnclosed(code) { - if (code === 62) { - effects.exit('chunkString') - effects.exit(stringType) - return destinationEnclosedBefore(code) - } - - if (code === null || code === 60 || markdownLineEnding(code)) { - return nok(code) - } - - effects.consume(code) - return code === 92 ? destinationEnclosedEscape : destinationEnclosed - } - - function destinationEnclosedEscape(code) { - if (code === 60 || code === 62 || code === 92) { - effects.consume(code) - return destinationEnclosed - } - - return destinationEnclosed(code) - } - - function destinationRaw(code) { - if (code === 40) { - if (++balance > limit) return nok(code) - effects.consume(code) - return destinationRaw - } - - if (code === 41) { - if (!balance--) { - effects.exit('chunkString') - effects.exit(stringType) - effects.exit(rawType) - effects.exit(type) - return ok(code) - } - - effects.consume(code) - return destinationRaw - } - - if (code === null || markdownLineEndingOrSpace(code)) { - if (balance) return nok(code) - effects.exit('chunkString') - effects.exit(stringType) - effects.exit(rawType) - effects.exit(type) - return ok(code) - } - - if (asciiControl(code)) return nok(code) - effects.consume(code) - return code === 92 ? destinationRawEscape : destinationRaw - } - - function destinationRawEscape(code) { - if (code === 40 || code === 41 || code === 92) { - effects.consume(code) - return destinationRaw - } - - return destinationRaw(code) - } -} - -module.exports = destinationFactory - - -/***/ }), - -/***/ 7422: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var markdownSpace = __webpack_require__(9225) - -// eslint-disable-next-line max-params -function labelFactory(effects, ok, nok, type, markerType, stringType) { - var self = this - var size = 0 - var data - return start - - function start(code) { - effects.enter(type) - effects.enter(markerType) - effects.consume(code) - effects.exit(markerType) - effects.enter(stringType) - return atBreak - } - - function atBreak(code) { - if ( - code === null || - code === 91 || - (code === 93 && !data) || - /* c8 ignore next */ - (code === 94 && - /* c8 ignore next */ - !size && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs) || - size > 999 - ) { - return nok(code) - } - - if (code === 93) { - effects.exit(stringType) - effects.enter(markerType) - effects.consume(code) - effects.exit(markerType) - effects.exit(type) - return ok - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return atBreak - } - - effects.enter('chunkString', { - contentType: 'string' - }) - return label(code) - } - - function label(code) { - if ( - code === null || - code === 91 || - code === 93 || - markdownLineEnding(code) || - size++ > 999 - ) { - effects.exit('chunkString') - return atBreak(code) - } - - effects.consume(code) - data = data || !markdownSpace(code) - return code === 92 ? labelEscape : label - } - - function labelEscape(code) { - if (code === 91 || code === 92 || code === 93) { - effects.consume(code) - size++ - return label - } - - return label(code) - } -} - -module.exports = labelFactory - - -/***/ }), - -/***/ 1905: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownSpace = __webpack_require__(9225) - -function spaceFactory(effects, ok, type, max) { - var limit = max ? max - 1 : Infinity - var size = 0 - return start - - function start(code) { - if (markdownSpace(code)) { - effects.enter(type) - return prefix(code) - } - - return ok(code) - } - - function prefix(code) { - if (markdownSpace(code) && size++ < limit) { - effects.consume(code) - return prefix - } - - effects.exit(type) - return ok(code) - } -} - -module.exports = spaceFactory - - -/***/ }), - -/***/ 2608: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var factorySpace = __webpack_require__(1905) - -function titleFactory(effects, ok, nok, type, markerType, stringType) { - var marker - return start - - function start(code) { - effects.enter(type) - effects.enter(markerType) - effects.consume(code) - effects.exit(markerType) - marker = code === 40 ? 41 : code - return atFirstTitleBreak - } - - function atFirstTitleBreak(code) { - if (code === marker) { - effects.enter(markerType) - effects.consume(code) - effects.exit(markerType) - effects.exit(type) - return ok - } - - effects.enter(stringType) - return atTitleBreak(code) - } - - function atTitleBreak(code) { - if (code === marker) { - effects.exit(stringType) - return atFirstTitleBreak(marker) - } - - if (code === null) { - return nok(code) - } // Note: blank lines can’t exist in content. - - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return factorySpace(effects, atTitleBreak, 'linePrefix') - } - - effects.enter('chunkString', { - contentType: 'string' - }) - return title(code) - } - - function title(code) { - if (code === marker || code === null || markdownLineEnding(code)) { - effects.exit('chunkString') - return atTitleBreak(code) - } - - effects.consume(code) - return code === 92 ? titleEscape : title - } - - function titleEscape(code) { - if (code === marker || code === 92) { - effects.consume(code) - return title - } - - return title(code) - } -} - -module.exports = titleFactory - - -/***/ }), - -/***/ 415: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var markdownSpace = __webpack_require__(9225) -var factorySpace = __webpack_require__(1905) - -function whitespaceFactory(effects, ok) { - var seen - return start - - function start(code) { - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - seen = true - return start - } - - if (markdownSpace(code)) { - return factorySpace( - effects, - start, - seen ? 'linePrefix' : 'lineSuffix' - )(code) - } - - return ok(code) - } -} - -module.exports = whitespaceFactory - - -/***/ }), - -/***/ 3690: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) - -var hardBreakEscape = { - name: 'hardBreakEscape', - tokenize: tokenizeHardBreakEscape -} - -function tokenizeHardBreakEscape(effects, ok, nok) { - return start - - function start(code) { - effects.enter('hardBreakEscape') - effects.enter('escapeMarker') - effects.consume(code) - return open - } - - function open(code) { - if (markdownLineEnding(code)) { - effects.exit('escapeMarker') - effects.exit('hardBreakEscape') - return ok(code) - } - - return nok(code) - } -} - -module.exports = hardBreakEscape - - -/***/ }), - -/***/ 2336: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var markdownLineEndingOrSpace = __webpack_require__(6430) -var markdownSpace = __webpack_require__(9225) -var chunkedSplice = __webpack_require__(5966) -var factorySpace = __webpack_require__(1905) - -var headingAtx = { - name: 'headingAtx', - tokenize: tokenizeHeadingAtx, - resolve: resolveHeadingAtx -} - -function resolveHeadingAtx(events, context) { - var contentEnd = events.length - 2 - var contentStart = 3 - var content - var text // Prefix whitespace, part of the opening. - - if (events[contentStart][1].type === 'whitespace') { - contentStart += 2 - } // Suffix whitespace, part of the closing. - - if ( - contentEnd - 2 > contentStart && - events[contentEnd][1].type === 'whitespace' - ) { - contentEnd -= 2 - } - - if ( - events[contentEnd][1].type === 'atxHeadingSequence' && - (contentStart === contentEnd - 1 || - (contentEnd - 4 > contentStart && - events[contentEnd - 2][1].type === 'whitespace')) - ) { - contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 - } - - if (contentEnd > contentStart) { - content = { - type: 'atxHeadingText', - start: events[contentStart][1].start, - end: events[contentEnd][1].end - } - text = { - type: 'chunkText', - start: events[contentStart][1].start, - end: events[contentEnd][1].end, - contentType: 'text' - } - chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [ - ['enter', content, context], - ['enter', text, context], - ['exit', text, context], - ['exit', content, context] - ]) - } - - return events -} - -function tokenizeHeadingAtx(effects, ok, nok) { - var self = this - var size = 0 - return start - - function start(code) { - effects.enter('atxHeading') - effects.enter('atxHeadingSequence') - return fenceOpenInside(code) - } - - function fenceOpenInside(code) { - if (code === 35 && size++ < 6) { - effects.consume(code) - return fenceOpenInside - } - - if (code === null || markdownLineEndingOrSpace(code)) { - effects.exit('atxHeadingSequence') - return self.interrupt ? ok(code) : headingBreak(code) - } - - return nok(code) - } - - function headingBreak(code) { - if (code === 35) { - effects.enter('atxHeadingSequence') - return sequence(code) - } - - if (code === null || markdownLineEnding(code)) { - effects.exit('atxHeading') - return ok(code) - } - - if (markdownSpace(code)) { - return factorySpace(effects, headingBreak, 'whitespace')(code) - } - - effects.enter('atxHeadingText') - return data(code) - } - - function sequence(code) { - if (code === 35) { - effects.consume(code) - return sequence - } - - effects.exit('atxHeadingSequence') - return headingBreak(code) - } - - function data(code) { - if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { - effects.exit('atxHeadingText') - return headingBreak(code) - } - - effects.consume(code) - return data - } -} - -module.exports = headingAtx - - -/***/ }), - -/***/ 6022: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var asciiAlpha = __webpack_require__(5111) -var asciiAlphanumeric = __webpack_require__(6102) -var markdownLineEnding = __webpack_require__(2739) -var markdownLineEndingOrSpace = __webpack_require__(6430) -var markdownSpace = __webpack_require__(9225) -var fromCharCode = __webpack_require__(4428) -var htmlBlockNames = __webpack_require__(958) -var htmlRawNames = __webpack_require__(5121) -var partialBlankLine = __webpack_require__(921) - -var htmlFlow = { - name: 'htmlFlow', - tokenize: tokenizeHtmlFlow, - resolveTo: resolveToHtmlFlow, - concrete: true -} -var nextBlankConstruct = { - tokenize: tokenizeNextBlank, - partial: true -} - -function resolveToHtmlFlow(events) { - var index = events.length - - while (index--) { - if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { - break - } - } - - if (index > 1 && events[index - 2][1].type === 'linePrefix') { - // Add the prefix start to the HTML token. - events[index][1].start = events[index - 2][1].start // Add the prefix start to the HTML line token. - - events[index + 1][1].start = events[index - 2][1].start // Remove the line prefix. - - events.splice(index - 2, 2) - } - - return events -} - -function tokenizeHtmlFlow(effects, ok, nok) { - var self = this - var kind - var startTag - var buffer - var index - var marker - return start - - function start(code) { - effects.enter('htmlFlow') - effects.enter('htmlFlowData') - effects.consume(code) - return open - } - - function open(code) { - if (code === 33) { - effects.consume(code) - return declarationStart - } - - if (code === 47) { - effects.consume(code) - return tagCloseStart - } - - if (code === 63) { - effects.consume(code) - kind = 3 // While we’re in an instruction instead of a declaration, we’re on a `?` - // right now, so we do need to search for `>`, similar to declarations. - - return self.interrupt ? ok : continuationDeclarationInside - } - - if (asciiAlpha(code)) { - effects.consume(code) - buffer = fromCharCode(code) - startTag = true - return tagName - } - - return nok(code) - } - - function declarationStart(code) { - if (code === 45) { - effects.consume(code) - kind = 2 - return commentOpenInside - } - - if (code === 91) { - effects.consume(code) - kind = 5 - buffer = 'CDATA[' - index = 0 - return cdataOpenInside - } - - if (asciiAlpha(code)) { - effects.consume(code) - kind = 4 - return self.interrupt ? ok : continuationDeclarationInside - } - - return nok(code) - } - - function commentOpenInside(code) { - if (code === 45) { - effects.consume(code) - return self.interrupt ? ok : continuationDeclarationInside - } - - return nok(code) - } - - function cdataOpenInside(code) { - if (code === buffer.charCodeAt(index++)) { - effects.consume(code) - return index === buffer.length - ? self.interrupt - ? ok - : continuation - : cdataOpenInside - } - - return nok(code) - } - - function tagCloseStart(code) { - if (asciiAlpha(code)) { - effects.consume(code) - buffer = fromCharCode(code) - return tagName - } - - return nok(code) - } - - function tagName(code) { - if ( - code === null || - code === 47 || - code === 62 || - markdownLineEndingOrSpace(code) - ) { - if ( - code !== 47 && - startTag && - htmlRawNames.indexOf(buffer.toLowerCase()) > -1 - ) { - kind = 1 - return self.interrupt ? ok(code) : continuation(code) - } - - if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { - kind = 6 - - if (code === 47) { - effects.consume(code) - return basicSelfClosing - } - - return self.interrupt ? ok(code) : continuation(code) - } - - kind = 7 // Do not support complete HTML when interrupting. - - return self.interrupt - ? nok(code) - : startTag - ? completeAttributeNameBefore(code) - : completeClosingTagAfter(code) - } - - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code) - buffer += fromCharCode(code) - return tagName - } - - return nok(code) - } - - function basicSelfClosing(code) { - if (code === 62) { - effects.consume(code) - return self.interrupt ? ok : continuation - } - - return nok(code) - } - - function completeClosingTagAfter(code) { - if (markdownSpace(code)) { - effects.consume(code) - return completeClosingTagAfter - } - - return completeEnd(code) - } - - function completeAttributeNameBefore(code) { - if (code === 47) { - effects.consume(code) - return completeEnd - } - - if (code === 58 || code === 95 || asciiAlpha(code)) { - effects.consume(code) - return completeAttributeName - } - - if (markdownSpace(code)) { - effects.consume(code) - return completeAttributeNameBefore - } - - return completeEnd(code) - } - - function completeAttributeName(code) { - if ( - code === 45 || - code === 46 || - code === 58 || - code === 95 || - asciiAlphanumeric(code) - ) { - effects.consume(code) - return completeAttributeName - } - - return completeAttributeNameAfter(code) - } - - function completeAttributeNameAfter(code) { - if (code === 61) { - effects.consume(code) - return completeAttributeValueBefore - } - - if (markdownSpace(code)) { - effects.consume(code) - return completeAttributeNameAfter - } - - return completeAttributeNameBefore(code) - } - - function completeAttributeValueBefore(code) { - if ( - code === null || - code === 60 || - code === 61 || - code === 62 || - code === 96 - ) { - return nok(code) - } - - if (code === 34 || code === 39) { - effects.consume(code) - marker = code - return completeAttributeValueQuoted - } - - if (markdownSpace(code)) { - effects.consume(code) - return completeAttributeValueBefore - } - - marker = undefined - return completeAttributeValueUnquoted(code) - } - - function completeAttributeValueQuoted(code) { - if (code === marker) { - effects.consume(code) - return completeAttributeValueQuotedAfter - } - - if (code === null || markdownLineEnding(code)) { - return nok(code) - } - - effects.consume(code) - return completeAttributeValueQuoted - } - - function completeAttributeValueUnquoted(code) { - if ( - code === null || - code === 34 || - code === 39 || - code === 60 || - code === 61 || - code === 62 || - code === 96 || - markdownLineEndingOrSpace(code) - ) { - return completeAttributeNameAfter(code) - } - - effects.consume(code) - return completeAttributeValueUnquoted - } - - function completeAttributeValueQuotedAfter(code) { - if (code === 47 || code === 62 || markdownSpace(code)) { - return completeAttributeNameBefore(code) - } - - return nok(code) - } - - function completeEnd(code) { - if (code === 62) { - effects.consume(code) - return completeAfter - } - - return nok(code) - } - - function completeAfter(code) { - if (markdownSpace(code)) { - effects.consume(code) - return completeAfter - } - - return code === null || markdownLineEnding(code) - ? continuation(code) - : nok(code) - } - - function continuation(code) { - if (code === 45 && kind === 2) { - effects.consume(code) - return continuationCommentInside - } - - if (code === 60 && kind === 1) { - effects.consume(code) - return continuationRawTagOpen - } - - if (code === 62 && kind === 4) { - effects.consume(code) - return continuationClose - } - - if (code === 63 && kind === 3) { - effects.consume(code) - return continuationDeclarationInside - } - - if (code === 93 && kind === 5) { - effects.consume(code) - return continuationCharacterDataInside - } - - if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { - return effects.check( - nextBlankConstruct, - continuationClose, - continuationAtLineEnding - )(code) - } - - if (code === null || markdownLineEnding(code)) { - return continuationAtLineEnding(code) - } - - effects.consume(code) - return continuation - } - - function continuationAtLineEnding(code) { - effects.exit('htmlFlowData') - return htmlContinueStart(code) - } - - function htmlContinueStart(code) { - if (code === null) { - return done(code) - } - - if (markdownLineEnding(code)) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return htmlContinueStart - } - - effects.enter('htmlFlowData') - return continuation(code) - } - - function continuationCommentInside(code) { - if (code === 45) { - effects.consume(code) - return continuationDeclarationInside - } - - return continuation(code) - } - - function continuationRawTagOpen(code) { - if (code === 47) { - effects.consume(code) - buffer = '' - return continuationRawEndTag - } - - return continuation(code) - } - - function continuationRawEndTag(code) { - if (code === 62 && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { - effects.consume(code) - return continuationClose - } - - if (asciiAlpha(code) && buffer.length < 8) { - effects.consume(code) - buffer += fromCharCode(code) - return continuationRawEndTag - } - - return continuation(code) - } - - function continuationCharacterDataInside(code) { - if (code === 93) { - effects.consume(code) - return continuationDeclarationInside - } - - return continuation(code) - } - - function continuationDeclarationInside(code) { - if (code === 62) { - effects.consume(code) - return continuationClose - } - - return continuation(code) - } - - function continuationClose(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('htmlFlowData') - return done(code) - } - - effects.consume(code) - return continuationClose - } - - function done(code) { - effects.exit('htmlFlow') - return ok(code) - } -} - -function tokenizeNextBlank(effects, ok, nok) { - return start - - function start(code) { - effects.exit('htmlFlowData') - effects.enter('lineEndingBlank') - effects.consume(code) - effects.exit('lineEndingBlank') - return effects.attempt(partialBlankLine, ok, nok) - } -} - -module.exports = htmlFlow - - -/***/ }), - -/***/ 6112: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var asciiAlpha = __webpack_require__(5111) -var asciiAlphanumeric = __webpack_require__(6102) -var markdownLineEnding = __webpack_require__(2739) -var markdownLineEndingOrSpace = __webpack_require__(6430) -var markdownSpace = __webpack_require__(9225) -var factorySpace = __webpack_require__(1905) - -var htmlText = { - name: 'htmlText', - tokenize: tokenizeHtmlText -} - -function tokenizeHtmlText(effects, ok, nok) { - var self = this - var marker - var buffer - var index - var returnState - return start - - function start(code) { - effects.enter('htmlText') - effects.enter('htmlTextData') - effects.consume(code) - return open - } - - function open(code) { - if (code === 33) { - effects.consume(code) - return declarationOpen - } - - if (code === 47) { - effects.consume(code) - return tagCloseStart - } - - if (code === 63) { - effects.consume(code) - return instruction - } - - if (asciiAlpha(code)) { - effects.consume(code) - return tagOpen - } - - return nok(code) - } - - function declarationOpen(code) { - if (code === 45) { - effects.consume(code) - return commentOpen - } - - if (code === 91) { - effects.consume(code) - buffer = 'CDATA[' - index = 0 - return cdataOpen - } - - if (asciiAlpha(code)) { - effects.consume(code) - return declaration - } - - return nok(code) - } - - function commentOpen(code) { - if (code === 45) { - effects.consume(code) - return commentStart - } - - return nok(code) - } - - function commentStart(code) { - if (code === null || code === 62) { - return nok(code) - } - - if (code === 45) { - effects.consume(code) - return commentStartDash - } - - return comment(code) - } - - function commentStartDash(code) { - if (code === null || code === 62) { - return nok(code) - } - - return comment(code) - } - - function comment(code) { - if (code === null) { - return nok(code) - } - - if (code === 45) { - effects.consume(code) - return commentClose - } - - if (markdownLineEnding(code)) { - returnState = comment - return atLineEnding(code) - } - - effects.consume(code) - return comment - } - - function commentClose(code) { - if (code === 45) { - effects.consume(code) - return end - } - - return comment(code) - } - - function cdataOpen(code) { - if (code === buffer.charCodeAt(index++)) { - effects.consume(code) - return index === buffer.length ? cdata : cdataOpen - } - - return nok(code) - } - - function cdata(code) { - if (code === null) { - return nok(code) - } - - if (code === 93) { - effects.consume(code) - return cdataClose - } - - if (markdownLineEnding(code)) { - returnState = cdata - return atLineEnding(code) - } - - effects.consume(code) - return cdata - } - - function cdataClose(code) { - if (code === 93) { - effects.consume(code) - return cdataEnd - } - - return cdata(code) - } - - function cdataEnd(code) { - if (code === 62) { - return end(code) - } - - if (code === 93) { - effects.consume(code) - return cdataEnd - } - - return cdata(code) - } - - function declaration(code) { - if (code === null || code === 62) { - return end(code) - } - - if (markdownLineEnding(code)) { - returnState = declaration - return atLineEnding(code) - } - - effects.consume(code) - return declaration - } - - function instruction(code) { - if (code === null) { - return nok(code) - } - - if (code === 63) { - effects.consume(code) - return instructionClose - } - - if (markdownLineEnding(code)) { - returnState = instruction - return atLineEnding(code) - } - - effects.consume(code) - return instruction - } - - function instructionClose(code) { - return code === 62 ? end(code) : instruction(code) - } - - function tagCloseStart(code) { - if (asciiAlpha(code)) { - effects.consume(code) - return tagClose - } - - return nok(code) - } - - function tagClose(code) { - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code) - return tagClose - } - - return tagCloseBetween(code) - } - - function tagCloseBetween(code) { - if (markdownLineEnding(code)) { - returnState = tagCloseBetween - return atLineEnding(code) - } - - if (markdownSpace(code)) { - effects.consume(code) - return tagCloseBetween - } - - return end(code) - } - - function tagOpen(code) { - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code) - return tagOpen - } - - if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code) - } - - return nok(code) - } - - function tagOpenBetween(code) { - if (code === 47) { - effects.consume(code) - return end - } - - if (code === 58 || code === 95 || asciiAlpha(code)) { - effects.consume(code) - return tagOpenAttributeName - } - - if (markdownLineEnding(code)) { - returnState = tagOpenBetween - return atLineEnding(code) - } - - if (markdownSpace(code)) { - effects.consume(code) - return tagOpenBetween - } - - return end(code) - } - - function tagOpenAttributeName(code) { - if ( - code === 45 || - code === 46 || - code === 58 || - code === 95 || - asciiAlphanumeric(code) - ) { - effects.consume(code) - return tagOpenAttributeName - } - - return tagOpenAttributeNameAfter(code) - } - - function tagOpenAttributeNameAfter(code) { - if (code === 61) { - effects.consume(code) - return tagOpenAttributeValueBefore - } - - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeNameAfter - return atLineEnding(code) - } - - if (markdownSpace(code)) { - effects.consume(code) - return tagOpenAttributeNameAfter - } - - return tagOpenBetween(code) - } - - function tagOpenAttributeValueBefore(code) { - if ( - code === null || - code === 60 || - code === 61 || - code === 62 || - code === 96 - ) { - return nok(code) - } - - if (code === 34 || code === 39) { - effects.consume(code) - marker = code - return tagOpenAttributeValueQuoted - } - - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeValueBefore - return atLineEnding(code) - } - - if (markdownSpace(code)) { - effects.consume(code) - return tagOpenAttributeValueBefore - } - - effects.consume(code) - marker = undefined - return tagOpenAttributeValueUnquoted - } - - function tagOpenAttributeValueQuoted(code) { - if (code === marker) { - effects.consume(code) - return tagOpenAttributeValueQuotedAfter - } - - if (code === null) { - return nok(code) - } - - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeValueQuoted - return atLineEnding(code) - } - - effects.consume(code) - return tagOpenAttributeValueQuoted - } - - function tagOpenAttributeValueQuotedAfter(code) { - if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code) - } - - return nok(code) - } - - function tagOpenAttributeValueUnquoted(code) { - if ( - code === null || - code === 34 || - code === 39 || - code === 60 || - code === 61 || - code === 96 - ) { - return nok(code) - } - - if (code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code) - } - - effects.consume(code) - return tagOpenAttributeValueUnquoted - } // We can’t have blank lines in content, so no need to worry about empty - // tokens. - - function atLineEnding(code) { - effects.exit('htmlTextData') - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return factorySpace( - effects, - afterPrefix, - 'linePrefix', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) - } - - function afterPrefix(code) { - effects.enter('htmlTextData') - return returnState(code) - } - - function end(code) { - if (code === 62) { - effects.consume(code) - effects.exit('htmlTextData') - effects.exit('htmlText') - return ok - } - - return nok(code) - } -} - -module.exports = htmlText - - -/***/ }), - -/***/ 7680: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEndingOrSpace = __webpack_require__(6430) -var chunkedPush = __webpack_require__(8948) -var chunkedSplice = __webpack_require__(5966) -var normalizeIdentifier = __webpack_require__(7243) -var resolveAll = __webpack_require__(5579) -var shallow = __webpack_require__(286) -var factoryDestination = __webpack_require__(4625) -var factoryLabel = __webpack_require__(7422) -var factoryTitle = __webpack_require__(2608) -var factoryWhitespace = __webpack_require__(415) - -var labelEnd = { - name: 'labelEnd', - tokenize: tokenizeLabelEnd, - resolveTo: resolveToLabelEnd, - resolveAll: resolveAllLabelEnd -} -var resourceConstruct = { - tokenize: tokenizeResource -} -var fullReferenceConstruct = { - tokenize: tokenizeFullReference -} -var collapsedReferenceConstruct = { - tokenize: tokenizeCollapsedReference -} - -function resolveAllLabelEnd(events) { - var index = -1 - var token - - while (++index < events.length) { - token = events[index][1] - - if ( - !token._used && - (token.type === 'labelImage' || - token.type === 'labelLink' || - token.type === 'labelEnd') - ) { - // Remove the marker. - events.splice(index + 1, token.type === 'labelImage' ? 4 : 2) - token.type = 'data' - index++ - } - } - - return events -} - -function resolveToLabelEnd(events, context) { - var index = events.length - var offset = 0 - var group - var label - var text - var token - var open - var close - var media // Find an opening. - - while (index--) { - token = events[index][1] - - if (open) { - // If we see another link, or inactive link label, we’ve been here before. - if ( - token.type === 'link' || - (token.type === 'labelLink' && token._inactive) - ) { - break - } // Mark other link openings as inactive, as we can’t have links in - // links. - - if (events[index][0] === 'enter' && token.type === 'labelLink') { - token._inactive = true - } - } else if (close) { - if ( - events[index][0] === 'enter' && - (token.type === 'labelImage' || token.type === 'labelLink') && - !token._balanced - ) { - open = index - - if (token.type !== 'labelLink') { - offset = 2 - break - } - } - } else if (token.type === 'labelEnd') { - close = index - } - } - - group = { - type: events[open][1].type === 'labelLink' ? 'link' : 'image', - start: shallow(events[open][1].start), - end: shallow(events[events.length - 1][1].end) - } - label = { - type: 'label', - start: shallow(events[open][1].start), - end: shallow(events[close][1].end) - } - text = { - type: 'labelText', - start: shallow(events[open + offset + 2][1].end), - end: shallow(events[close - 2][1].start) - } - media = [ - ['enter', group, context], - ['enter', label, context] - ] // Opening marker. - - media = chunkedPush(media, events.slice(open + 1, open + offset + 3)) // Text open. - - media = chunkedPush(media, [['enter', text, context]]) // Between. - - media = chunkedPush( - media, - resolveAll( - context.parser.constructs.insideSpan.null, - events.slice(open + offset + 4, close - 3), - context - ) - ) // Text close, marker close, label close. - - media = chunkedPush(media, [ - ['exit', text, context], - events[close - 2], - events[close - 1], - ['exit', label, context] - ]) // Reference, resource, or so. - - media = chunkedPush(media, events.slice(close + 1)) // Media close. - - media = chunkedPush(media, [['exit', group, context]]) - chunkedSplice(events, open, events.length, media) - return events -} - -function tokenizeLabelEnd(effects, ok, nok) { - var self = this - var index = self.events.length - var labelStart - var defined // Find an opening. - - while (index--) { - if ( - (self.events[index][1].type === 'labelImage' || - self.events[index][1].type === 'labelLink') && - !self.events[index][1]._balanced - ) { - labelStart = self.events[index][1] - break - } - } - - return start - - function start(code) { - if (!labelStart) { - return nok(code) - } // It’s a balanced bracket, but contains a link. - - if (labelStart._inactive) return balanced(code) - defined = - self.parser.defined.indexOf( - normalizeIdentifier( - self.sliceSerialize({ - start: labelStart.end, - end: self.now() - }) - ) - ) > -1 - effects.enter('labelEnd') - effects.enter('labelMarker') - effects.consume(code) - effects.exit('labelMarker') - effects.exit('labelEnd') - return afterLabelEnd - } - - function afterLabelEnd(code) { - // Resource: `[asd](fgh)`. - if (code === 40) { - return effects.attempt( - resourceConstruct, - ok, - defined ? ok : balanced - )(code) - } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? - - if (code === 91) { - return effects.attempt( - fullReferenceConstruct, - ok, - defined - ? effects.attempt(collapsedReferenceConstruct, ok, balanced) - : balanced - )(code) - } // Shortcut reference: `[asd]`? - - return defined ? ok(code) : balanced(code) - } - - function balanced(code) { - labelStart._balanced = true - return nok(code) - } -} - -function tokenizeResource(effects, ok, nok) { - return start - - function start(code) { - effects.enter('resource') - effects.enter('resourceMarker') - effects.consume(code) - effects.exit('resourceMarker') - return factoryWhitespace(effects, open) - } - - function open(code) { - if (code === 41) { - return end(code) - } - - return factoryDestination( - effects, - destinationAfter, - nok, - 'resourceDestination', - 'resourceDestinationLiteral', - 'resourceDestinationLiteralMarker', - 'resourceDestinationRaw', - 'resourceDestinationString', - 3 - )(code) - } - - function destinationAfter(code) { - return markdownLineEndingOrSpace(code) - ? factoryWhitespace(effects, between)(code) - : end(code) - } - - function between(code) { - if (code === 34 || code === 39 || code === 40) { - return factoryTitle( - effects, - factoryWhitespace(effects, end), - nok, - 'resourceTitle', - 'resourceTitleMarker', - 'resourceTitleString' - )(code) - } - - return end(code) - } - - function end(code) { - if (code === 41) { - effects.enter('resourceMarker') - effects.consume(code) - effects.exit('resourceMarker') - effects.exit('resource') - return ok - } - - return nok(code) - } -} - -function tokenizeFullReference(effects, ok, nok) { - var self = this - return start - - function start(code) { - return factoryLabel.call( - self, - effects, - afterLabel, - nok, - 'reference', - 'referenceMarker', - 'referenceString' - )(code) - } - - function afterLabel(code) { - return self.parser.defined.indexOf( - normalizeIdentifier( - self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) - ) - ) < 0 - ? nok(code) - : ok(code) - } -} - -function tokenizeCollapsedReference(effects, ok, nok) { - return start - - function start(code) { - effects.enter('reference') - effects.enter('referenceMarker') - effects.consume(code) - effects.exit('referenceMarker') - return open - } - - function open(code) { - if (code === 93) { - effects.enter('referenceMarker') - effects.consume(code) - effects.exit('referenceMarker') - effects.exit('reference') - return ok - } - - return nok(code) - } -} - -module.exports = labelEnd - - -/***/ }), - -/***/ 1038: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var labelEnd = __webpack_require__(7680) - -var labelStartImage = { - name: 'labelStartImage', - tokenize: tokenizeLabelStartImage, - resolveAll: labelEnd.resolveAll -} - -function tokenizeLabelStartImage(effects, ok, nok) { - var self = this - return start - - function start(code) { - effects.enter('labelImage') - effects.enter('labelImageMarker') - effects.consume(code) - effects.exit('labelImageMarker') - return open - } - - function open(code) { - if (code === 91) { - effects.enter('labelMarker') - effects.consume(code) - effects.exit('labelMarker') - effects.exit('labelImage') - return after - } - - return nok(code) - } - - function after(code) { - /* c8 ignore next */ - return code === 94 && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs - ? /* c8 ignore next */ - nok(code) - : ok(code) - } -} - -module.exports = labelStartImage - - -/***/ }), - -/***/ 2484: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var labelEnd = __webpack_require__(7680) - -var labelStartLink = { - name: 'labelStartLink', - tokenize: tokenizeLabelStartLink, - resolveAll: labelEnd.resolveAll -} - -function tokenizeLabelStartLink(effects, ok, nok) { - var self = this - return start - - function start(code) { - effects.enter('labelLink') - effects.enter('labelMarker') - effects.consume(code) - effects.exit('labelMarker') - effects.exit('labelLink') - return after - } - - function after(code) { - /* c8 ignore next */ - return code === 94 && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs - ? /* c8 ignore next */ - nok(code) - : ok(code) - } -} - -module.exports = labelStartLink - - -/***/ }), - -/***/ 7611: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var factorySpace = __webpack_require__(1905) - -var lineEnding = { - name: 'lineEnding', - tokenize: tokenizeLineEnding -} - -function tokenizeLineEnding(effects, ok) { - return start - - function start(code) { - effects.enter('lineEnding') - effects.consume(code) - effects.exit('lineEnding') - return factorySpace(effects, ok, 'linePrefix') - } -} - -module.exports = lineEnding - - -/***/ }), - -/***/ 9955: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var asciiDigit = __webpack_require__(9602) -var markdownSpace = __webpack_require__(9225) -var prefixSize = __webpack_require__(4510) -var sizeChunks = __webpack_require__(9333) -var factorySpace = __webpack_require__(1905) -var partialBlankLine = __webpack_require__(921) -var thematicBreak = __webpack_require__(3834) - -var list = { - name: 'list', - tokenize: tokenizeListStart, - continuation: { - tokenize: tokenizeListContinuation - }, - exit: tokenizeListEnd -} -var listItemPrefixWhitespaceConstruct = { - tokenize: tokenizeListItemPrefixWhitespace, - partial: true -} -var indentConstruct = { - tokenize: tokenizeIndent, - partial: true -} - -function tokenizeListStart(effects, ok, nok) { - var self = this - var initialSize = prefixSize(self.events, 'linePrefix') - var size = 0 - return start - - function start(code) { - var kind = - self.containerState.type || - (code === 42 || code === 43 || code === 45 - ? 'listUnordered' - : 'listOrdered') - - if ( - kind === 'listUnordered' - ? !self.containerState.marker || code === self.containerState.marker - : asciiDigit(code) - ) { - if (!self.containerState.type) { - self.containerState.type = kind - effects.enter(kind, { - _container: true - }) - } - - if (kind === 'listUnordered') { - effects.enter('listItemPrefix') - return code === 42 || code === 45 - ? effects.check(thematicBreak, nok, atMarker)(code) - : atMarker(code) - } - - if (!self.interrupt || code === 49) { - effects.enter('listItemPrefix') - effects.enter('listItemValue') - return inside(code) - } - } - - return nok(code) - } - - function inside(code) { - if (asciiDigit(code) && ++size < 10) { - effects.consume(code) - return inside - } - - if ( - (!self.interrupt || size < 2) && - (self.containerState.marker - ? code === self.containerState.marker - : code === 41 || code === 46) - ) { - effects.exit('listItemValue') - return atMarker(code) - } - - return nok(code) - } - - function atMarker(code) { - effects.enter('listItemMarker') - effects.consume(code) - effects.exit('listItemMarker') - self.containerState.marker = self.containerState.marker || code - return effects.check( - partialBlankLine, // Can’t be empty when interrupting. - self.interrupt ? nok : onBlank, - effects.attempt( - listItemPrefixWhitespaceConstruct, - endOfPrefix, - otherPrefix - ) - ) - } - - function onBlank(code) { - self.containerState.initialBlankLine = true - initialSize++ - return endOfPrefix(code) - } - - function otherPrefix(code) { - if (markdownSpace(code)) { - effects.enter('listItemPrefixWhitespace') - effects.consume(code) - effects.exit('listItemPrefixWhitespace') - return endOfPrefix - } - - return nok(code) - } - - function endOfPrefix(code) { - self.containerState.size = - initialSize + sizeChunks(self.sliceStream(effects.exit('listItemPrefix'))) - return ok(code) - } -} - -function tokenizeListContinuation(effects, ok, nok) { - var self = this - self.containerState._closeFlow = undefined - return effects.check(partialBlankLine, onBlank, notBlank) - - function onBlank(code) { - self.containerState.furtherBlankLines = - self.containerState.furtherBlankLines || - self.containerState.initialBlankLine // We have a blank line. - // Still, try to consume at most the items size. - - return factorySpace( - effects, - ok, - 'listItemIndent', - self.containerState.size + 1 - )(code) - } - - function notBlank(code) { - if (self.containerState.furtherBlankLines || !markdownSpace(code)) { - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined - return notInCurrentItem(code) - } - - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined - return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) - } - - function notInCurrentItem(code) { - // While we do continue, we signal that the flow should be closed. - self.containerState._closeFlow = true // As we’re closing flow, we’re no longer interrupting. - - self.interrupt = undefined - return factorySpace( - effects, - effects.attempt(list, ok, nok), - 'linePrefix', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - )(code) - } -} - -function tokenizeIndent(effects, ok, nok) { - var self = this - return factorySpace( - effects, - afterPrefix, - 'listItemIndent', - self.containerState.size + 1 - ) - - function afterPrefix(code) { - return prefixSize(self.events, 'listItemIndent') === - self.containerState.size - ? ok(code) - : nok(code) - } -} - -function tokenizeListEnd(effects) { - effects.exit(this.containerState.type) -} - -function tokenizeListItemPrefixWhitespace(effects, ok, nok) { - var self = this - return factorySpace( - effects, - afterPrefix, - 'listItemPrefixWhitespace', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 + 1 - ) - - function afterPrefix(code) { - return markdownSpace(code) || - !prefixSize(self.events, 'listItemPrefixWhitespace') - ? nok(code) - : ok(code) - } -} - -module.exports = list - - -/***/ }), - -/***/ 921: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var factorySpace = __webpack_require__(1905) - -var partialBlankLine = { - tokenize: tokenizePartialBlankLine, - partial: true -} - -function tokenizePartialBlankLine(effects, ok, nok) { - return factorySpace(effects, afterWhitespace, 'linePrefix') - - function afterWhitespace(code) { - return code === null || markdownLineEnding(code) ? ok(code) : nok(code) - } -} - -module.exports = partialBlankLine - - -/***/ }), - -/***/ 6468: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var shallow = __webpack_require__(286) -var factorySpace = __webpack_require__(1905) - -var setextUnderline = { - name: 'setextUnderline', - tokenize: tokenizeSetextUnderline, - resolveTo: resolveToSetextUnderline -} - -function resolveToSetextUnderline(events, context) { - var index = events.length - var content - var text - var definition - var heading // Find the opening of the content. - // It’ll always exist: we don’t tokenize if it isn’t there. - - while (index--) { - if (events[index][0] === 'enter') { - if (events[index][1].type === 'content') { - content = index - break - } - - if (events[index][1].type === 'paragraph') { - text = index - } - } // Exit - else { - if (events[index][1].type === 'content') { - // Remove the content end (if needed we’ll add it later) - events.splice(index, 1) - } - - if (!definition && events[index][1].type === 'definition') { - definition = index - } - } - } - - heading = { - type: 'setextHeading', - start: shallow(events[text][1].start), - end: shallow(events[events.length - 1][1].end) - } // Change the paragraph to setext heading text. - - events[text][1].type = 'setextHeadingText' // If we have definitions in the content, we’ll keep on having content, - // but we need move it. - - if (definition) { - events.splice(text, 0, ['enter', heading, context]) - events.splice(definition + 1, 0, ['exit', events[content][1], context]) - events[content][1].end = shallow(events[definition][1].end) - } else { - events[content][1] = heading - } // Add the heading exit at the end. - - events.push(['exit', heading, context]) - return events -} - -function tokenizeSetextUnderline(effects, ok, nok) { - var self = this - var index = self.events.length - var marker - var paragraph // Find an opening. - - while (index--) { - // Skip enter/exit of line ending, line prefix, and content. - // We can now either have a definition or a paragraph. - if ( - self.events[index][1].type !== 'lineEnding' && - self.events[index][1].type !== 'linePrefix' && - self.events[index][1].type !== 'content' - ) { - paragraph = self.events[index][1].type === 'paragraph' - break - } - } - - return start - - function start(code) { - if (!self.lazy && (self.interrupt || paragraph)) { - effects.enter('setextHeadingLine') - effects.enter('setextHeadingLineSequence') - marker = code - return closingSequence(code) - } - - return nok(code) - } - - function closingSequence(code) { - if (code === marker) { - effects.consume(code) - return closingSequence - } - - effects.exit('setextHeadingLineSequence') - return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code) - } - - function closingSequenceEnd(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit('setextHeadingLine') - return ok(code) - } - - return nok(code) - } -} - -module.exports = setextUnderline - - -/***/ }), - -/***/ 3834: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEnding = __webpack_require__(2739) -var markdownSpace = __webpack_require__(9225) -var factorySpace = __webpack_require__(1905) - -var thematicBreak = { - name: 'thematicBreak', - tokenize: tokenizeThematicBreak -} - -function tokenizeThematicBreak(effects, ok, nok) { - var size = 0 - var marker - return start - - function start(code) { - effects.enter('thematicBreak') - marker = code - return atBreak(code) - } - - function atBreak(code) { - if (code === marker) { - effects.enter('thematicBreakSequence') - return sequence(code) - } - - if (markdownSpace(code)) { - return factorySpace(effects, atBreak, 'whitespace')(code) - } - - if (size < 3 || (code !== null && !markdownLineEnding(code))) { - return nok(code) - } - - effects.exit('thematicBreak') - return ok(code) - } - - function sequence(code) { - if (code === marker) { - effects.consume(code) - size++ - return sequence - } - - effects.exit('thematicBreakSequence') - return atBreak(code) - } -} - -module.exports = thematicBreak - - -/***/ }), - -/***/ 8948: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var chunkedSplice = __webpack_require__(5966) - -function chunkedPush(list, items) { - if (list.length) { - chunkedSplice(list, list.length, 0, items) - return list - } - - return items -} - -module.exports = chunkedPush - - -/***/ }), - -/***/ 5966: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var splice = __webpack_require__(7716) - -// causes a stack overflow in V8 when trying to insert 100k items for instance. - -function chunkedSplice(list, start, remove, items) { - var end = list.length - var chunkStart = 0 - var parameters // Make start between zero and `end` (included). - - if (start < 0) { - start = -start > end ? 0 : end + start - } else { - start = start > end ? end : start - } - - remove = remove > 0 ? remove : 0 // No need to chunk the items if there’s only a couple (10k) items. - - if (items.length < 10000) { - parameters = Array.from(items) - parameters.unshift(start, remove) - splice.apply(list, parameters) - } else { - // Delete `remove` items starting from `start` - if (remove) splice.apply(list, [start, remove]) // Insert the items in chunks to not cause stack overflows. - - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + 10000) - parameters.unshift(start, 0) - splice.apply(list, parameters) - chunkStart += 10000 - start += 10000 - } - } -} - -module.exports = chunkedSplice - - -/***/ }), - -/***/ 3: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var markdownLineEndingOrSpace = __webpack_require__(6430) -var unicodePunctuation = __webpack_require__(6516) -var unicodeWhitespace = __webpack_require__(463) - -// Classify whether a character is unicode whitespace, unicode punctuation, or -// anything else. -// Used for attention (emphasis, strong), whose sequences can open or close -// based on the class of surrounding characters. -function classifyCharacter(code) { - if ( - code === null || - markdownLineEndingOrSpace(code) || - unicodeWhitespace(code) - ) { - return 1 - } - - if (unicodePunctuation(code)) { - return 2 - } -} - -module.exports = classifyCharacter - - -/***/ }), - -/***/ 7450: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var hasOwnProperty = __webpack_require__(277) -var chunkedSplice = __webpack_require__(5966) -var miniflat = __webpack_require__(8011) - -function combineExtensions(extensions) { - var all = {} - var index = -1 - - while (++index < extensions.length) { - extension(all, extensions[index]) - } - - return all -} - -function extension(all, extension) { - var hook - var left - var right - var code - - for (hook in extension) { - left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {}) - right = extension[hook] - - for (code in right) { - left[code] = constructs( - miniflat(right[code]), - hasOwnProperty.call(left, code) ? left[code] : [] - ) - } - } -} - -function constructs(list, existing) { - var index = -1 - var before = [] - - while (++index < list.length) { - ;(list[index].add === 'after' ? existing : before).push(list[index]) - } - - chunkedSplice(existing, 0, 0, before) - return existing -} - -module.exports = combineExtensions - - -/***/ }), - -/***/ 9708: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var assign = __webpack_require__(1328) -var markdownLineEnding = __webpack_require__(2739) -var chunkedPush = __webpack_require__(8948) -var chunkedSplice = __webpack_require__(5966) -var miniflat = __webpack_require__(8011) -var resolveAll = __webpack_require__(5579) -var serializeChunks = __webpack_require__(5866) -var shallow = __webpack_require__(286) -var sliceChunks = __webpack_require__(6056) - -// Create a tokenizer. -// Tokenizers deal with one type of data (e.g., containers, flow, text). -// The parser is the object dealing with it all. -// `initialize` works like other constructs, except that only its `tokenize` -// function is used, in which case it doesn’t receive an `ok` or `nok`. -// `from` can be given to set the point before the first character, although -// when further lines are indented, they must be set with `defineSkip`. -function createTokenizer(parser, initialize, from) { - var point = from - ? shallow(from) - : { - line: 1, - column: 1, - offset: 0 - } - var columnStart = {} - var resolveAllConstructs = [] - var chunks = [] - var stack = [] - - var effects = { - consume: consume, - enter: enter, - exit: exit, - attempt: constructFactory(onsuccessfulconstruct), - check: constructFactory(onsuccessfulcheck), - interrupt: constructFactory(onsuccessfulcheck, { - interrupt: true - }), - lazy: constructFactory(onsuccessfulcheck, { - lazy: true - }) - } // State and tools for resolving and serializing. - - var context = { - previous: null, - events: [], - parser: parser, - sliceStream: sliceStream, - sliceSerialize: sliceSerialize, - now: now, - defineSkip: skip, - write: write - } // The state function. - - var state = initialize.tokenize.call(context, effects) // Track which character we expect to be consumed, to catch bugs. - - if (initialize.resolveAll) { - resolveAllConstructs.push(initialize) - } // Store where we are in the input stream. - - point._index = 0 - point._bufferIndex = -1 - return context - - function write(slice) { - chunks = chunkedPush(chunks, slice) - main() // Exit if we’re not done, resolve might change stuff. - - if (chunks[chunks.length - 1] !== null) { - return [] - } - - addResult(initialize, 0) // Otherwise, resolve, and exit. - - context.events = resolveAll(resolveAllConstructs, context.events, context) - return context.events - } // - // Tools. - // - - function sliceSerialize(token) { - return serializeChunks(sliceStream(token)) - } - - function sliceStream(token) { - return sliceChunks(chunks, token) - } - - function now() { - return shallow(point) - } - - function skip(value) { - columnStart[value.line] = value.column - accountForPotentialSkip() - } // - // State management. - // - // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by - // `consume`). - // Here is where we walk through the chunks, which either include strings of - // several characters, or numerical character codes. - // The reason to do this in a loop instead of a call is so the stack can - // drain. - - function main() { - var chunkIndex - var chunk - - while (point._index < chunks.length) { - chunk = chunks[point._index] // If we’re in a buffer chunk, loop through it. - - if (typeof chunk === 'string') { - chunkIndex = point._index - - if (point._bufferIndex < 0) { - point._bufferIndex = 0 - } - - while ( - point._index === chunkIndex && - point._bufferIndex < chunk.length - ) { - go(chunk.charCodeAt(point._bufferIndex)) - } - } else { - go(chunk) - } - } - } // Deal with one code. - - function go(code) { - state = state(code) - } // Move a character forward. - - function consume(code) { - if (markdownLineEnding(code)) { - point.line++ - point.column = 1 - point.offset += code === -3 ? 2 : 1 - accountForPotentialSkip() - } else if (code !== -1) { - point.column++ - point.offset++ - } // Not in a string chunk. - - if (point._bufferIndex < 0) { - point._index++ - } else { - point._bufferIndex++ // At end of string chunk. - - if (point._bufferIndex === chunks[point._index].length) { - point._bufferIndex = -1 - point._index++ - } - } // Expose the previous character. - - context.previous = code // Mark as consumed. - } // Start a token. - - function enter(type, fields) { - var token = fields || {} - token.type = type - token.start = now() - context.events.push(['enter', token, context]) - stack.push(token) - return token - } // Stop a token. - - function exit(type) { - var token = stack.pop() - token.end = now() - context.events.push(['exit', token, context]) - return token - } // Use results. - - function onsuccessfulconstruct(construct, info) { - addResult(construct, info.from) - } // Discard results. - - function onsuccessfulcheck(construct, info) { - info.restore() - } // Factory to attempt/check/interrupt. - - function constructFactory(onreturn, fields) { - return hook // Handle either an object mapping codes to constructs, a list of - // constructs, or a single construct. - - function hook(constructs, returnState, bogusState) { - var listOfConstructs - var constructIndex - var currentConstruct - var info - return constructs.tokenize || 'length' in constructs - ? handleListOfConstructs(miniflat(constructs)) - : handleMapOfConstructs - - function handleMapOfConstructs(code) { - if (code in constructs || null in constructs) { - return handleListOfConstructs( - constructs.null - ? /* c8 ignore next */ - miniflat(constructs[code]).concat(miniflat(constructs.null)) - : constructs[code] - )(code) - } - - return bogusState(code) - } - - function handleListOfConstructs(list) { - listOfConstructs = list - constructIndex = 0 - return handleConstruct(list[constructIndex]) - } - - function handleConstruct(construct) { - return start - - function start(code) { - // To do: not nede to store if there is no bogus state, probably? - // Currently doesn’t work because `inspect` in document does a check - // w/o a bogus, which doesn’t make sense. But it does seem to help perf - // by not storing. - info = store() - currentConstruct = construct - - if (!construct.partial) { - context.currentConstruct = construct - } - - if ( - construct.name && - context.parser.constructs.disable.null.indexOf(construct.name) > -1 - ) { - return nok() - } - - return construct.tokenize.call( - fields ? assign({}, context, fields) : context, - effects, - ok, - nok - )(code) - } - } - - function ok(code) { - onreturn(currentConstruct, info) - return returnState - } - - function nok(code) { - info.restore() - - if (++constructIndex < listOfConstructs.length) { - return handleConstruct(listOfConstructs[constructIndex]) - } - - return bogusState - } - } - } - - function addResult(construct, from) { - if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { - resolveAllConstructs.push(construct) - } - - if (construct.resolve) { - chunkedSplice( - context.events, - from, - context.events.length - from, - construct.resolve(context.events.slice(from), context) - ) - } - - if (construct.resolveTo) { - context.events = construct.resolveTo(context.events, context) - } - } - - function store() { - var startPoint = now() - var startPrevious = context.previous - var startCurrentConstruct = context.currentConstruct - var startEventsIndex = context.events.length - var startStack = Array.from(stack) - return { - restore: restore, - from: startEventsIndex - } - - function restore() { - point = startPoint - context.previous = startPrevious - context.currentConstruct = startCurrentConstruct - context.events.length = startEventsIndex - stack = startStack - accountForPotentialSkip() - } - } - - function accountForPotentialSkip() { - if (point.line in columnStart && point.column < 2) { - point.column = columnStart[point.line] - point.offset += columnStart[point.line] - 1 - } - } -} - -module.exports = createTokenizer - - -/***/ }), - -/***/ 8011: -/***/ ((module) => { - -"use strict"; - - -function miniflat(value) { - return value === null || value === undefined - ? [] - : 'length' in value - ? value - : [value] -} - -module.exports = miniflat - - -/***/ }), - -/***/ 930: -/***/ ((module) => { - -"use strict"; - - -// chunks (replacement characters, tabs, or line endings). - -function movePoint(point, offset) { - point.column += offset - point.offset += offset - point._bufferIndex += offset - return point -} - -module.exports = movePoint - - -/***/ }), - -/***/ 7243: -/***/ ((module) => { - -"use strict"; - - -function normalizeIdentifier(value) { - return ( - value // Collapse Markdown whitespace. - .replace(/[\t\n\r ]+/g, ' ') // Trim. - .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase - // counterpart is uppercased will result in a different uppercase - // character. - // Hence, to get that form, we perform both lower- and uppercase. - // Upper case makes sure keys will not interact with default prototypal - // methods: no object method is uppercase. - .toLowerCase() - .toUpperCase() - ) -} - -module.exports = normalizeIdentifier - - -/***/ }), - -/***/ 4510: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var sizeChunks = __webpack_require__(9333) - -function prefixSize(events, type) { - var tail = events[events.length - 1] - if (!tail || tail[1].type !== type) return 0 - return sizeChunks(tail[2].sliceStream(tail[1])) -} - -module.exports = prefixSize - - -/***/ }), - -/***/ 5540: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var fromCharCode = __webpack_require__(4428) - -function regexCheck(regex) { - return check - - function check(code) { - return regex.test(fromCharCode(code)) - } -} - -module.exports = regexCheck - - -/***/ }), - -/***/ 5579: -/***/ ((module) => { - -"use strict"; - - -function resolveAll(constructs, events, context) { - var called = [] - var index = -1 - var resolve - - while (++index < constructs.length) { - resolve = constructs[index].resolveAll - - if (resolve && called.indexOf(resolve) < 0) { - events = resolve(events, context) - called.push(resolve) - } - } - - return events -} - -module.exports = resolveAll - - -/***/ }), - -/***/ 54: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var fromCharCode = __webpack_require__(4428) - -function safeFromInt(value, base) { - var code = parseInt(value, base) - - if ( - // C0 except for HT, LF, FF, CR, space - code < 9 || - code === 11 || - (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. - (code > 126 && code < 160) || // Lone high surrogates and low surrogates. - (code > 55295 && code < 57344) || // Noncharacters. - (code > 64975 && code < 65008) || - (code & 65535) === 65535 || - (code & 65535) === 65534 || // Out of range - code > 1114111 - ) { - return '\uFFFD' - } - - return fromCharCode(code) -} - -module.exports = safeFromInt - - -/***/ }), - -/***/ 5866: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var fromCharCode = __webpack_require__(4428) - -function serializeChunks(chunks) { - var index = -1 - var result = [] - var chunk - var value - var atTab - - while (++index < chunks.length) { - chunk = chunks[index] - - if (typeof chunk === 'string') { - value = chunk - } else if (chunk === -5) { - value = '\r' - } else if (chunk === -4) { - value = '\n' - } else if (chunk === -3) { - value = '\r' + '\n' - } else if (chunk === -2) { - value = '\t' - } else if (chunk === -1) { - if (atTab) continue - value = ' ' - } else { - // Currently only replacement character. - value = fromCharCode(chunk) - } - - atTab = chunk === -2 - result.push(value) - } - - return result.join('') -} - -module.exports = serializeChunks - - -/***/ }), - -/***/ 286: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var assign = __webpack_require__(1328) - -function shallow(object) { - return assign({}, object) -} - -module.exports = shallow - - -/***/ }), - -/***/ 9333: -/***/ ((module) => { - -"use strict"; - - -// Counts tabs based on their expanded size, and CR+LF as one character. - -function sizeChunks(chunks) { - var index = -1 - var size = 0 - - while (++index < chunks.length) { - size += typeof chunks[index] === 'string' ? chunks[index].length : 1 - } - - return size -} - -module.exports = sizeChunks - - -/***/ }), - -/***/ 6056: -/***/ ((module) => { - -"use strict"; - - -function sliceChunks(chunks, token) { - var startIndex = token.start._index - var startBufferIndex = token.start._bufferIndex - var endIndex = token.end._index - var endBufferIndex = token.end._bufferIndex - var view - - if (startIndex === endIndex) { - view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] - } else { - view = chunks.slice(startIndex, endIndex) - - if (startBufferIndex > -1) { - view[0] = view[0].slice(startBufferIndex) - } - - if (endBufferIndex > 0) { - view.push(chunks[endIndex].slice(0, endBufferIndex)) - } - } - - return view -} - -module.exports = sliceChunks - - -/***/ }), - -/***/ 8199: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var assign = __webpack_require__(1328) -var chunkedSplice = __webpack_require__(5966) -var shallow = __webpack_require__(286) - -function subtokenize(events) { - var jumps = {} - var index = -1 - var event - var lineIndex - var otherIndex - var otherEvent - var parameters - var subevents - var more - - while (++index < events.length) { - while (index in jumps) { - index = jumps[index] - } - - event = events[index] // Add a hook for the GFM tasklist extension, which needs to know if text - // is in the first content of a list item. - - if ( - index && - event[1].type === 'chunkFlow' && - events[index - 1][1].type === 'listItemPrefix' - ) { - subevents = event[1]._tokenizer.events - otherIndex = 0 - - if ( - otherIndex < subevents.length && - subevents[otherIndex][1].type === 'lineEndingBlank' - ) { - otherIndex += 2 - } - - if ( - otherIndex < subevents.length && - subevents[otherIndex][1].type === 'content' - ) { - while (++otherIndex < subevents.length) { - if (subevents[otherIndex][1].type === 'content') { - break - } - - if (subevents[otherIndex][1].type === 'chunkText') { - subevents[otherIndex][1].isInFirstContentOfListItem = true - otherIndex++ - } - } - } - } // Enter. - - if (event[0] === 'enter') { - if (event[1].contentType) { - assign(jumps, subcontent(events, index)) - index = jumps[index] - more = true - } - } // Exit. - else if (event[1]._container || event[1]._movePreviousLineEndings) { - otherIndex = index - lineIndex = undefined - - while (otherIndex--) { - otherEvent = events[otherIndex] - - if ( - otherEvent[1].type === 'lineEnding' || - otherEvent[1].type === 'lineEndingBlank' - ) { - if (otherEvent[0] === 'enter') { - if (lineIndex) { - events[lineIndex][1].type = 'lineEndingBlank' - } - - otherEvent[1].type = 'lineEnding' - lineIndex = otherIndex - } - } else { - break - } - } - - if (lineIndex) { - // Fix position. - event[1].end = shallow(events[lineIndex][1].start) // Switch container exit w/ line endings. - - parameters = events.slice(lineIndex, index) - parameters.unshift(event) - chunkedSplice(events, lineIndex, index - lineIndex + 1, parameters) - } - } - } - - return !more -} - -function subcontent(events, eventIndex) { - var token = events[eventIndex][1] - var context = events[eventIndex][2] - var startPosition = eventIndex - 1 - var startPositions = [] - var tokenizer = - token._tokenizer || context.parser[token.contentType](token.start) - var childEvents = tokenizer.events - var jumps = [] - var gaps = {} - var stream - var previous - var index - var entered - var end - var adjust // Loop forward through the linked tokens to pass them in order to the - // subtokenizer. - - while (token) { - // Find the position of the event for this token. - while (events[++startPosition][1] !== token) { - // Empty. - } - - startPositions.push(startPosition) - - if (!token._tokenizer) { - stream = context.sliceStream(token) - - if (!token.next) { - stream.push(null) - } - - if (previous) { - tokenizer.defineSkip(token.start) - } - - if (token.isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = true - } - - tokenizer.write(stream) - - if (token.isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = undefined - } - } // Unravel the next token. - - previous = token - token = token.next - } // Now, loop back through all events (and linked tokens), to figure out which - // parts belong where. - - token = previous - index = childEvents.length - - while (index--) { - // Make sure we’ve at least seen something (final eol is part of the last - // token). - if (childEvents[index][0] === 'enter') { - entered = true - } else if ( - // Find a void token that includes a break. - entered && - childEvents[index][1].type === childEvents[index - 1][1].type && - childEvents[index][1].start.line !== childEvents[index][1].end.line - ) { - add(childEvents.slice(index + 1, end)) - // Help GC. - token._tokenizer = token.next = undefined - token = token.previous - end = index + 1 - } - } - - // Help GC. - tokenizer.events = token._tokenizer = token.next = undefined // Do head: - - add(childEvents.slice(0, end)) - index = -1 - adjust = 0 - - while (++index < jumps.length) { - gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] - adjust += jumps[index][1] - jumps[index][0] - 1 - } - - return gaps - - function add(slice) { - var start = startPositions.pop() - jumps.unshift([start, start + slice.length - 1]) - chunkedSplice(events, start, 2, slice) - } -} - -module.exports = subtokenize - - -/***/ }), - -/***/ 9944: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var characterEntities = __webpack_require__(3423) - -module.exports = decodeEntity - -var own = {}.hasOwnProperty - -function decodeEntity(characters) { - return own.call(characterEntities, characters) - ? characterEntities[characters] - : false -} - - -/***/ }), - -/***/ 3850: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = parse - -var fromMarkdown = __webpack_require__(3885) - -function parse(options) { - var self = this - - this.Parser = parse - - function parse(doc) { - return fromMarkdown( - doc, - Object.assign({}, self.data('settings'), options, { - // Note: these options are not in the readme. - // The goal is for them to be set by plugins on `data` instead of being - // passed by users. - extensions: self.data('micromarkExtensions') || [], - mdastExtensions: self.data('fromMarkdownExtensions') || [] - }) - ) - } -} - - -/***/ }), - -/***/ 613: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var wrap = __webpack_require__(6622) - -module.exports = trough - -trough.wrap = wrap - -var slice = [].slice - -// Create new middleware. -function trough() { - var fns = [] - var middleware = {} - - middleware.run = run - middleware.use = use - - return middleware - - // Run `fns`. Last argument must be a completion handler. - function run() { - var index = -1 - var input = slice.call(arguments, 0, -1) - var done = arguments[arguments.length - 1] - - if (typeof done !== 'function') { - throw new Error('Expected function as last argument, not ' + done) - } - - next.apply(null, [null].concat(input)) - - // Run the next `fn`, if any. - function next(err) { - var fn = fns[++index] - var params = slice.call(arguments, 0) - var values = params.slice(1) - var length = input.length - var pos = -1 - - if (err) { - done(err) - return - } - - // Copy non-nully input into values. - while (++pos < length) { - if (values[pos] === null || values[pos] === undefined) { - values[pos] = input[pos] - } - } - - input = values - - // Next or done. - if (fn) { - wrap(fn, next).apply(null, input) - } else { - done.apply(null, [null].concat(input)) - } - } - } - - // Add `fn` to the list. - function use(fn) { - if (typeof fn !== 'function') { - throw new Error('Expected `fn` to be a function, not ' + fn) - } - - fns.push(fn) - - return middleware - } -} - - -/***/ }), - -/***/ 6622: -/***/ ((module) => { - -"use strict"; - - -var slice = [].slice - -module.exports = wrap - -// Wrap `fn`. -// Can be sync or async; return a promise, receive a completion handler, return -// new values and errors. -function wrap(fn, callback) { - var invoked - - return wrapped - - function wrapped() { - var params = slice.call(arguments, 0) - var callback = fn.length > params.length - var result - - if (callback) { - params.push(done) - } - - try { - result = fn.apply(null, params) - } catch (error) { - // Well, this is quite the pickle. - // `fn` received a callback and invoked it (thus continuing the pipeline), - // but later also threw an error. - // We’re not about to restart the pipeline again, so the only thing left - // to do is to throw the thing instead. - if (callback && invoked) { - throw error - } - - return done(error) - } - - if (!callback) { - if (result && typeof result.then === 'function') { - result.then(then, done) - } else if (result instanceof Error) { - done(result) - } else { - then(result) - } - } - } - - // Invoke `next`, only once. - function done() { - if (!invoked) { - invoked = true - - callback.apply(null, arguments) - } - } - - // Invoke `done` with one value. - // Tracks if an error is passed, too. - function then(value) { - done(null, value) - } -} - - -/***/ }), - -/***/ 4338: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bail = __webpack_require__(1527) -var buffer = __webpack_require__(8809) -var extend = __webpack_require__(229) -var plain = __webpack_require__(5530) -var trough = __webpack_require__(613) -var vfile = __webpack_require__(9566) - -// Expose a frozen processor. -module.exports = unified().freeze() - -var slice = [].slice -var own = {}.hasOwnProperty - -// Process pipeline. -var pipeline = trough() - .use(pipelineParse) - .use(pipelineRun) - .use(pipelineStringify) - -function pipelineParse(p, ctx) { - ctx.tree = p.parse(ctx.file) -} - -function pipelineRun(p, ctx, next) { - p.run(ctx.tree, ctx.file, done) - - function done(error, tree, file) { - if (error) { - next(error) - } else { - ctx.tree = tree - ctx.file = file - next() - } - } -} - -function pipelineStringify(p, ctx) { - var result = p.stringify(ctx.tree, ctx.file) - - if (result === undefined || result === null) { - // Empty. - } else if (typeof result === 'string' || buffer(result)) { - ctx.file.contents = result - } else { - ctx.file.result = result - } -} - -// Function to create the first processor. -function unified() { - var attachers = [] - var transformers = trough() - var namespace = {} - var freezeIndex = -1 - var frozen - - // Data management. - processor.data = data - - // Lock. - processor.freeze = freeze - - // Plugins. - processor.attachers = attachers - processor.use = use - - // API. - processor.parse = parse - processor.stringify = stringify - processor.run = run - processor.runSync = runSync - processor.process = process - processor.processSync = processSync - - // Expose. - return processor - - // Create a new processor based on the processor in the current scope. - function processor() { - var destination = unified() - var index = -1 - - while (++index < attachers.length) { - destination.use.apply(null, attachers[index]) - } - - destination.data(extend(true, {}, namespace)) - - return destination - } - - // Freeze: used to signal a processor that has finished configuration. - // - // For example, take unified itself: it’s frozen. - // Plugins should not be added to it. - // Rather, it should be extended, by invoking it, before modifying it. - // - // In essence, always invoke this when exporting a processor. - function freeze() { - var values - var transformer - - if (frozen) { - return processor - } - - while (++freezeIndex < attachers.length) { - values = attachers[freezeIndex] - - if (values[1] === false) { - continue - } - - if (values[1] === true) { - values[1] = undefined - } - - transformer = values[0].apply(processor, values.slice(1)) - - if (typeof transformer === 'function') { - transformers.use(transformer) - } - } - - frozen = true - freezeIndex = Infinity - - return processor - } - - // Data management. - // Getter / setter for processor-specific informtion. - function data(key, value) { - if (typeof key === 'string') { - // Set `key`. - if (arguments.length === 2) { - assertUnfrozen('data', frozen) - namespace[key] = value - return processor - } - - // Get `key`. - return (own.call(namespace, key) && namespace[key]) || null - } - - // Set space. - if (key) { - assertUnfrozen('data', frozen) - namespace = key - return processor - } - - // Get space. - return namespace - } - - // Plugin management. - // - // Pass it: - // * an attacher and options, - // * a preset, - // * a list of presets, attachers, and arguments (list of attachers and - // options). - function use(value) { - var settings - - assertUnfrozen('use', frozen) - - if (value === null || value === undefined) { - // Empty. - } else if (typeof value === 'function') { - addPlugin.apply(null, arguments) - } else if (typeof value === 'object') { - if ('length' in value) { - addList(value) - } else { - addPreset(value) - } - } else { - throw new Error('Expected usable value, not `' + value + '`') - } - - if (settings) { - namespace.settings = extend(namespace.settings || {}, settings) - } - - return processor - - function addPreset(result) { - addList(result.plugins) - - if (result.settings) { - settings = extend(settings || {}, result.settings) - } - } - - function add(value) { - if (typeof value === 'function') { - addPlugin(value) - } else if (typeof value === 'object') { - if ('length' in value) { - addPlugin.apply(null, value) - } else { - addPreset(value) - } - } else { - throw new Error('Expected usable value, not `' + value + '`') - } - } - - function addList(plugins) { - var index = -1 - - if (plugins === null || plugins === undefined) { - // Empty. - } else if (typeof plugins === 'object' && 'length' in plugins) { - while (++index < plugins.length) { - add(plugins[index]) - } - } else { - throw new Error('Expected a list of plugins, not `' + plugins + '`') - } - } - - function addPlugin(plugin, value) { - var entry = find(plugin) - - if (entry) { - if (plain(entry[1]) && plain(value)) { - value = extend(true, entry[1], value) - } - - entry[1] = value - } else { - attachers.push(slice.call(arguments)) - } - } - } - - function find(plugin) { - var index = -1 - - while (++index < attachers.length) { - if (attachers[index][0] === plugin) { - return attachers[index] - } - } - } - - // Parse a file (in string or vfile representation) into a unist node using - // the `Parser` on the processor. - function parse(doc) { - var file = vfile(doc) - var Parser - - freeze() - Parser = processor.Parser - assertParser('parse', Parser) - - if (newable(Parser, 'parse')) { - return new Parser(String(file), file).parse() - } - - return Parser(String(file), file) // eslint-disable-line new-cap - } - - // Run transforms on a unist node representation of a file (in string or - // vfile representation), async. - function run(node, file, cb) { - assertNode(node) - freeze() - - if (!cb && typeof file === 'function') { - cb = file - file = null - } - - if (!cb) { - return new Promise(executor) - } - - executor(null, cb) - - function executor(resolve, reject) { - transformers.run(node, vfile(file), done) - - function done(error, tree, file) { - tree = tree || node - if (error) { - reject(error) - } else if (resolve) { - resolve(tree) - } else { - cb(null, tree, file) - } - } - } - } - - // Run transforms on a unist node representation of a file (in string or - // vfile representation), sync. - function runSync(node, file) { - var result - var complete - - run(node, file, done) - - assertDone('runSync', 'run', complete) - - return result - - function done(error, tree) { - complete = true - result = tree - bail(error) - } - } - - // Stringify a unist node representation of a file (in string or vfile - // representation) into a string using the `Compiler` on the processor. - function stringify(node, doc) { - var file = vfile(doc) - var Compiler - - freeze() - Compiler = processor.Compiler - assertCompiler('stringify', Compiler) - assertNode(node) - - if (newable(Compiler, 'compile')) { - return new Compiler(node, file).compile() - } - - return Compiler(node, file) // eslint-disable-line new-cap - } - - // Parse a file (in string or vfile representation) into a unist node using - // the `Parser` on the processor, then run transforms on that node, and - // compile the resulting node using the `Compiler` on the processor, and - // store that result on the vfile. - function process(doc, cb) { - freeze() - assertParser('process', processor.Parser) - assertCompiler('process', processor.Compiler) - - if (!cb) { - return new Promise(executor) - } - - executor(null, cb) - - function executor(resolve, reject) { - var file = vfile(doc) - - pipeline.run(processor, {file: file}, done) - - function done(error) { - if (error) { - reject(error) - } else if (resolve) { - resolve(file) - } else { - cb(null, file) - } - } - } - } - - // Process the given document (in string or vfile representation), sync. - function processSync(doc) { - var file - var complete - - freeze() - assertParser('processSync', processor.Parser) - assertCompiler('processSync', processor.Compiler) - file = vfile(doc) - - process(file, done) - - assertDone('processSync', 'process', complete) - - return file - - function done(error) { - complete = true - bail(error) - } - } -} - -// Check if `value` is a constructor. -function newable(value, name) { - return ( - typeof value === 'function' && - value.prototype && - // A function with keys in its prototype is probably a constructor. - // Classes’ prototype methods are not enumerable, so we check if some value - // exists in the prototype. - (keys(value.prototype) || name in value.prototype) - ) -} - -// Check if `value` is an object with keys. -function keys(value) { - var key - for (key in value) { - return true - } - - return false -} - -// Assert a parser is available. -function assertParser(name, Parser) { - if (typeof Parser !== 'function') { - throw new Error('Cannot `' + name + '` without `Parser`') - } -} - -// Assert a compiler is available. -function assertCompiler(name, Compiler) { - if (typeof Compiler !== 'function') { - throw new Error('Cannot `' + name + '` without `Compiler`') - } -} - -// Assert the processor is not frozen. -function assertUnfrozen(name, frozen) { - if (frozen) { - throw new Error( - 'Cannot invoke `' + - name + - '` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.' - ) - } -} - -// Assert `node` is a unist node. -function assertNode(node) { - if (!node || typeof node.type !== 'string') { - throw new Error('Expected node, got `' + node + '`') - } -} - -// Assert that `complete` is `true`. -function assertDone(name, asyncName, complete) { - if (!complete) { - throw new Error( - '`' + name + '` finished async. Use `' + asyncName + '` instead' - ) - } -} - - -/***/ }), - -/***/ 5530: -/***/ ((module) => { - -"use strict"; - - -module.exports = value => { - if (Object.prototype.toString.call(value) !== '[object Object]') { - return false; - } - - const prototype = Object.getPrototypeOf(value); - return prototype === null || prototype === Object.prototype; -}; - - -/***/ }), - -/***/ 2872: -/***/ ((module) => { - -"use strict"; - - -module.exports = u - -function u(type, props, value) { - var node - - if ( - (value === null || value === undefined) && - (typeof props !== 'object' || Array.isArray(props)) - ) { - value = props - props = {} - } - - node = Object.assign({type: String(type)}, props) - - if (Array.isArray(value)) { - node.children = value - } else if (value !== null && value !== undefined) { - node.value = String(value) - } - - return node -} - - -/***/ }), - -/***/ 8666: -/***/ ((module) => { - -"use strict"; - - -module.exports = generated - -function generated(node) { - return ( - !node || - !node.position || - !node.position.start || - !node.position.start.line || - !node.position.start.column || - !node.position.end || - !node.position.end.line || - !node.position.end.column - ) -} - - -/***/ }), - -/***/ 9725: -/***/ ((module) => { - -"use strict"; - - -var start = factory('start') -var end = factory('end') - -module.exports = position - -position.start = start -position.end = end - -function position(node) { - return {start: start(node), end: end(node)} -} - -function factory(type) { - point.displayName = type - - return point - - function point(node) { - var point = (node && node.position && node.position[type]) || {} - - return { - line: point.line || null, - column: point.column || null, - offset: isNaN(point.offset) ? null : point.offset - } - } -} - - -/***/ }), - -/***/ 9158: -/***/ ((module) => { - -"use strict"; - - -var own = {}.hasOwnProperty - -module.exports = stringify - -function stringify(value) { - // Nothing. - if (!value || typeof value !== 'object') { - return '' - } - - // Node. - if (own.call(value, 'position') || own.call(value, 'type')) { - return position(value.position) - } - - // Position. - if (own.call(value, 'start') || own.call(value, 'end')) { - return position(value) - } - - // Point. - if (own.call(value, 'line') || own.call(value, 'column')) { - return point(value) - } - - // ? - return '' -} - -function point(point) { - if (!point || typeof point !== 'object') { - point = {} - } - - return index(point.line) + ':' + index(point.column) -} - -function position(pos) { - if (!pos || typeof pos !== 'object') { - pos = {} - } - - return point(pos.start) + '-' + point(pos.end) -} - -function index(value) { - return value && typeof value === 'number' ? value : 1 -} - - -/***/ }), - -/***/ 9053: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var stringify = __webpack_require__(9158) - -module.exports = VMessage - -// Inherit from `Error#`. -function VMessagePrototype() {} -VMessagePrototype.prototype = Error.prototype -VMessage.prototype = new VMessagePrototype() - -// Message properties. -var proto = VMessage.prototype - -proto.file = '' -proto.name = '' -proto.reason = '' -proto.message = '' -proto.stack = '' -proto.fatal = null -proto.column = null -proto.line = null - -// Construct a new VMessage. -// -// Note: We cannot invoke `Error` on the created context, as that adds readonly -// `line` and `column` attributes on Safari 9, thus throwing and failing the -// data. -function VMessage(reason, position, origin) { - var parts - var range - var location - - if (typeof position === 'string') { - origin = position - position = null - } - - parts = parseOrigin(origin) - range = stringify(position) || '1:1' - - location = { - start: {line: null, column: null}, - end: {line: null, column: null} - } - - // Node. - if (position && position.position) { - position = position.position - } - - if (position) { - // Position. - if (position.start) { - location = position - position = position.start - } else { - // Point. - location.start = position - } - } - - if (reason.stack) { - this.stack = reason.stack - reason = reason.message - } - - this.message = reason - this.name = range - this.reason = reason - this.line = position ? position.line : null - this.column = position ? position.column : null - this.location = location - this.source = parts[0] - this.ruleId = parts[1] -} - -function parseOrigin(origin) { - var result = [null, null] - var index - - if (typeof origin === 'string') { - index = origin.indexOf(':') - - if (index === -1) { - result[1] = origin - } else { - result[0] = origin.slice(0, index) - result[1] = origin.slice(index + 1) - } - } - - return result -} - - -/***/ }), - -/***/ 9566: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = __webpack_require__(888) - - -/***/ }), - -/***/ 5050: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var p = __webpack_require__(7688) -var proc = __webpack_require__(2702) -var buffer = __webpack_require__(8809) - -module.exports = VFile - -var own = {}.hasOwnProperty - -// Order of setting (least specific to most), we need this because otherwise -// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a -// stem can be set. -var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname'] - -VFile.prototype.toString = toString - -// Access full path (`~/index.min.js`). -Object.defineProperty(VFile.prototype, 'path', {get: getPath, set: setPath}) - -// Access parent path (`~`). -Object.defineProperty(VFile.prototype, 'dirname', { - get: getDirname, - set: setDirname -}) - -// Access basename (`index.min.js`). -Object.defineProperty(VFile.prototype, 'basename', { - get: getBasename, - set: setBasename -}) - -// Access extname (`.js`). -Object.defineProperty(VFile.prototype, 'extname', { - get: getExtname, - set: setExtname -}) - -// Access stem (`index.min`). -Object.defineProperty(VFile.prototype, 'stem', {get: getStem, set: setStem}) - -// Construct a new file. -function VFile(options) { - var prop - var index - - if (!options) { - options = {} - } else if (typeof options === 'string' || buffer(options)) { - options = {contents: options} - } else if ('message' in options && 'messages' in options) { - return options - } - - if (!(this instanceof VFile)) { - return new VFile(options) - } - - this.data = {} - this.messages = [] - this.history = [] - this.cwd = proc.cwd() - - // Set path related properties in the correct order. - index = -1 - - while (++index < order.length) { - prop = order[index] - - if (own.call(options, prop)) { - this[prop] = options[prop] - } - } - - // Set non-path related properties. - for (prop in options) { - if (order.indexOf(prop) < 0) { - this[prop] = options[prop] - } - } -} - -function getPath() { - return this.history[this.history.length - 1] -} - -function setPath(path) { - assertNonEmpty(path, 'path') - - if (this.path !== path) { - this.history.push(path) - } -} - -function getDirname() { - return typeof this.path === 'string' ? p.dirname(this.path) : undefined -} - -function setDirname(dirname) { - assertPath(this.path, 'dirname') - this.path = p.join(dirname || '', this.basename) -} - -function getBasename() { - return typeof this.path === 'string' ? p.basename(this.path) : undefined -} - -function setBasename(basename) { - assertNonEmpty(basename, 'basename') - assertPart(basename, 'basename') - this.path = p.join(this.dirname || '', basename) -} - -function getExtname() { - return typeof this.path === 'string' ? p.extname(this.path) : undefined -} - -function setExtname(extname) { - assertPart(extname, 'extname') - assertPath(this.path, 'extname') - - if (extname) { - if (extname.charCodeAt(0) !== 46 /* `.` */) { - throw new Error('`extname` must start with `.`') - } - - if (extname.indexOf('.', 1) > -1) { - throw new Error('`extname` cannot contain multiple dots') - } - } - - this.path = p.join(this.dirname, this.stem + (extname || '')) -} - -function getStem() { - return typeof this.path === 'string' - ? p.basename(this.path, this.extname) - : undefined -} - -function setStem(stem) { - assertNonEmpty(stem, 'stem') - assertPart(stem, 'stem') - this.path = p.join(this.dirname || '', stem + (this.extname || '')) -} - -// Get the value of the file. -function toString(encoding) { - return (this.contents || '').toString(encoding) -} - -// Assert that `part` is not a path (i.e., does not contain `p.sep`). -function assertPart(part, name) { - if (part && part.indexOf(p.sep) > -1) { - throw new Error( - '`' + name + '` cannot be a path: did not expect `' + p.sep + '`' - ) - } -} - -// Assert that `part` is not empty. -function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty') - } -} - -// Assert `path` exists. -function assertPath(path, name) { - if (!path) { - throw new Error('Setting `' + name + '` requires `path` to be set too') - } -} - - -/***/ }), - -/***/ 888: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var VMessage = __webpack_require__(9053) -var VFile = __webpack_require__(5050) - -module.exports = VFile - -VFile.prototype.message = message -VFile.prototype.info = info -VFile.prototype.fail = fail - -// Create a message with `reason` at `position`. -// When an error is passed in as `reason`, copies the stack. -function message(reason, position, origin) { - var message = new VMessage(reason, position, origin) - - if (this.path) { - message.name = this.path + ':' + message.name - message.file = this.path - } - - message.fatal = false - - this.messages.push(message) - - return message -} - -// Fail: creates a vmessage, associates it with the file, and throws it. -function fail() { - var message = this.message.apply(this, arguments) - - message.fatal = true - - throw message -} - -// Info: creates a vmessage, associates it with the file, and marks the fatality -// as null. -function info() { - var message = this.message.apply(this, arguments) - - message.fatal = null - - return message -} - - -/***/ }), - -/***/ 7688: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = __webpack_require__(5622) - - -/***/ }), - -/***/ 2702: -/***/ ((module) => { - -"use strict"; - - -module.exports = process - - -/***/ }), - -/***/ 5622: -/***/ ((module) => { - -"use strict"; -module.exports = require("path");; - -/***/ }), - -/***/ 2148: -/***/ ((module) => { - -"use strict"; -module.exports = require("unist-util-visit");; - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. -(() => { -"use strict"; -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - "buildCourse": () => (/* binding */ buildCourse), - "buildUnit": () => (/* binding */ buildUnit) -}); - -;// CONCATENATED MODULE: external "chalk" -const external_chalk_namespaceObject = require("chalk");; -var external_chalk_default = /*#__PURE__*/__webpack_require__.n(external_chalk_namespaceObject); -// EXTERNAL MODULE: external "path" -var external_path_ = __webpack_require__(5622); -var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_); -;// CONCATENATED MODULE: external "to-vfile" -const external_to_vfile_namespaceObject = require("to-vfile");; -var external_to_vfile_default = /*#__PURE__*/__webpack_require__.n(external_to_vfile_namespaceObject); -;// CONCATENATED MODULE: external "js-yaml" -const external_js_yaml_namespaceObject = require("js-yaml");; -var external_js_yaml_default = /*#__PURE__*/__webpack_require__.n(external_js_yaml_namespaceObject); -;// CONCATENATED MODULE: external "yup" -const external_yup_namespaceObject = require("yup");; -;// CONCATENATED MODULE: external "fs" -const external_fs_namespaceObject = require("fs");; -var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_namespaceObject); -// EXTERNAL MODULE: ../node_modules/unified/index.js -var unified = __webpack_require__(4338); -var unified_default = /*#__PURE__*/__webpack_require__.n(unified); -;// CONCATENATED MODULE: external "rehype-parse" -const external_rehype_parse_namespaceObject = require("rehype-parse");; -var external_rehype_parse_default = /*#__PURE__*/__webpack_require__.n(external_rehype_parse_namespaceObject); -;// CONCATENATED MODULE: ./src/utils/utils.ts - - - // import visit from 'unist-util-visit'; - -const rehypeParser = unified_default()().use((external_rehype_parse_default()), { - fragment: true -}); -function readFile(filePath, encoding = 'utf-8') { - return external_fs_default().promises.readFile(filePath, encoding); -} -function writeFile(filePath, contents) { - return external_fs_default().promises.writeFile(filePath, contents); -} -async function checkFileExists(filePath) { - try { - await external_fs_default().promises.access(filePath, (external_fs_default()).constants.F_OK); - return true; - } catch (err) { - return false; - } -} -function mkdir(dirPath) { - return external_fs_default().promises.mkdir(dirPath, { - recursive: true - }); -} -function rmdir(dirPath) { - return fs.promises.rmdir(dirPath, { - recursive: true - }); -} -function getBuildDir(dirPath) { - return `${dirPath}/build`; -} -function getCacheDir(dirPath) { - return `${dirPath}/cache`; -} -function combineMdastTrees(mdasts) { - return { - type: 'root', - children: mdasts.flatMap(mdast => mdast.children || []) - }; -} -function inspect() { - return tree => { - console.log(JSON.stringify(tree, null, 2)); // console.dir(tree, { depth: null }); - // visit(tree, 'leafDirective', (node) => { - // console.log('---------------------'); - // console.dir(node, { depth: null }); - // }); - - return tree; - }; -} -;// CONCATENATED MODULE: ./src/course/load-course.ts - - - -const courseSchema = external_yup_namespaceObject.object().shape({ - title: external_yup_namespaceObject.string().required(), - units: external_yup_namespaceObject.array().of(external_yup_namespaceObject.object().shape({ - src: external_yup_namespaceObject.string().required() - })) -}); -async function loadCourseYaml(dirPath) { - const fileContents = await readFile(`${dirPath}/course.yaml`); - const course = external_js_yaml_default().load(fileContents); - return courseSchema.validateSync(course); -} -;// CONCATENATED MODULE: ./src/course/load-unit.ts - - - - -const unitSchema = external_yup_namespaceObject.object().shape({ - name: external_yup_namespaceObject.string().required(), - title: external_yup_namespaceObject.string().required(), - content: external_yup_namespaceObject.array().of(external_yup_namespaceObject.object().shape({ - src: external_yup_namespaceObject.string().required() - })) -}); -async function loadUnitYaml(dirPath, src) { - const fileContents = await readFile(external_path_default().join(dirPath, src)); - const unit = external_js_yaml_default().load(fileContents); - return unitSchema.validateSync(unit); -} -;// CONCATENATED MODULE: ./src/course/index.ts -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - // @ts-expect-error - - - - -async function collectCoursework(dirPath) { - const course = await loadCourseYaml(dirPath); - const units = await Promise.all(course.units.map(unit => collectUnitContents(dirPath, unit))); - return _objectSpread(_objectSpread({}, course), {}, { - units - }); -} - -async function collectUnitContents(dirPath, unit) { - const yaml = await loadUnitYaml(dirPath, unit.src); - const markdown = await Promise.all(yaml.content.map(c => external_to_vfile_default().read(external_path_default().join(dirPath, unit.src, '..', c.src), 'utf-8'))); - return _objectSpread(_objectSpread({}, yaml), {}, { - markdown - }); -} - -function getUnitTitles(course, unit) { - const courseTitle = `${course.title}: ${unit.name}`; - const unitTitle = unit.title; - const unitName = unit.name; - const docTitle = `${unitTitle} | ${courseTitle}`; - return { - courseTitle, - unitTitle, - unitName, - docTitle - }; -} -;// CONCATENATED MODULE: external "@double-great/remark-lint-alt-text" -const remark_lint_alt_text_namespaceObject = require("@double-great/remark-lint-alt-text");; -var remark_lint_alt_text_default = /*#__PURE__*/__webpack_require__.n(remark_lint_alt_text_namespaceObject); -;// CONCATENATED MODULE: external "@mapbox/remark-lint-link-text" -const remark_lint_link_text_namespaceObject = require("@mapbox/remark-lint-link-text");; -var remark_lint_link_text_default = /*#__PURE__*/__webpack_require__.n(remark_lint_link_text_namespaceObject); -;// CONCATENATED MODULE: external "dictionary-en-gb" -const external_dictionary_en_gb_namespaceObject = require("dictionary-en-gb");; -var external_dictionary_en_gb_default = /*#__PURE__*/__webpack_require__.n(external_dictionary_en_gb_namespaceObject); -;// CONCATENATED MODULE: external "rehype-document" -const external_rehype_document_namespaceObject = require("rehype-document");; -var external_rehype_document_default = /*#__PURE__*/__webpack_require__.n(external_rehype_document_namespaceObject); -;// CONCATENATED MODULE: external "rehype-format" -const external_rehype_format_namespaceObject = require("rehype-format");; -var external_rehype_format_default = /*#__PURE__*/__webpack_require__.n(external_rehype_format_namespaceObject); -;// CONCATENATED MODULE: external "rehype-stringify" -const external_rehype_stringify_namespaceObject = require("rehype-stringify");; -var external_rehype_stringify_default = /*#__PURE__*/__webpack_require__.n(external_rehype_stringify_namespaceObject); -;// CONCATENATED MODULE: external "remark-directive" -const external_remark_directive_namespaceObject = require("remark-directive");; -var external_remark_directive_default = /*#__PURE__*/__webpack_require__.n(external_remark_directive_namespaceObject); -;// CONCATENATED MODULE: external "remark-math" -const external_remark_math_namespaceObject = require("remark-math");; -var external_remark_math_default = /*#__PURE__*/__webpack_require__.n(external_remark_math_namespaceObject); -// EXTERNAL MODULE: ../node_modules/remark-parse/index.js -var remark_parse = __webpack_require__(3850); -var remark_parse_default = /*#__PURE__*/__webpack_require__.n(remark_parse); -;// CONCATENATED MODULE: external "remark-rehype" -const external_remark_rehype_namespaceObject = require("remark-rehype");; -var external_remark_rehype_default = /*#__PURE__*/__webpack_require__.n(external_remark_rehype_namespaceObject); -;// CONCATENATED MODULE: external "remark-retext" -const external_remark_retext_namespaceObject = require("remark-retext");; -var external_remark_retext_default = /*#__PURE__*/__webpack_require__.n(external_remark_retext_namespaceObject); -;// CONCATENATED MODULE: external "retext-english" -const external_retext_english_namespaceObject = require("retext-english");; -var external_retext_english_default = /*#__PURE__*/__webpack_require__.n(external_retext_english_namespaceObject); -;// CONCATENATED MODULE: external "retext-spell" -const external_retext_spell_namespaceObject = require("retext-spell");; -var external_retext_spell_default = /*#__PURE__*/__webpack_require__.n(external_retext_spell_namespaceObject); -;// CONCATENATED MODULE: ./src/env.ts - -function getTemplateCss() { - return readFile('../template/build/main.css'); -} -function getTemplateJs() { - return readFile('../template/build/main.js'); -} -// EXTERNAL MODULE: external "unist-util-visit" -var external_unist_util_visit_ = __webpack_require__(2148); -var external_unist_util_visit_default = /*#__PURE__*/__webpack_require__.n(external_unist_util_visit_); -;// CONCATENATED MODULE: ./src/utils/message.ts -let MessageStatus; - -(function (MessageStatus) { - MessageStatus["fail"] = "fail"; - MessageStatus["warning"] = "warning"; - MessageStatus["info"] = "info"; -})(MessageStatus || (MessageStatus = {})); - -function failMessage(file, message, position) { - const status = MessageStatus.fail; - return messageWithStatus(file, message, position, status); -} -function warnMessage(file, message, position) { - const status = MessageStatus.warning; - return messageWithStatus(file, message, position, status); -} -function infoMessage(file, message, position) { - const status = MessageStatus.info; - return messageWithStatus(file, message, position, status); -} - -function messageWithStatus(file, message, position, status) { - console.log(message); - const msg = file.message(message, position); - msg.status = status; - return msg; -} -;// CONCATENATED MODULE: ./src/linters/assert-task-answer.ts - - -function assertTaskAnswerStructure() { - return (tree, file) => { - external_unist_util_visit_default()(tree, 'containerDirective', (node, index, parent) => { - if (node.name === 'task') { - const children = node.children || []; - const answers = children.filter(o => o.name === 'answer'); - - if (answers.length < 1) { - failMessage(file, 'Task has no answer', node.position); - } - - if (answers.length > 1) { - failMessage(file, 'Task has multiple answers', node.position); - } - } - - if (node.name === 'answer') { - if (!parent || parent.name !== 'task') { - failMessage(file, 'Answer must be nested inside task', node.position); - } - } - }); - }; -} -;// CONCATENATED MODULE: external "child_process" -const external_child_process_namespaceObject = require("child_process");; -;// CONCATENATED MODULE: external "lodash" -const external_lodash_namespaceObject = require("lodash");; -;// CONCATENATED MODULE: ./src/linters/lint-latex.ts - - - -function lintLatex() { - return async (tree, file) => { - const transformations = []; - external_unist_util_visit_default()(tree, 'math', node => { - transformations.push(chktex(node, file)); - }); - await Promise.all(transformations); - return tree; - }; -} - -async function chktex(node, file) { - return new Promise(resolve => { - (0,external_child_process_namespaceObject.exec)(`chktex -q <<< "${node.value}"`, (err, response) => { - if (err) { - (0,external_lodash_namespaceObject.reject)(err); - } else { - const messages = formatResponse(response); - const position = node.position; - messages.forEach(({ - line, - column, - message - }) => { - file.message(message, { - line: position.start.line + line, - column: position.start.column + column - }); - }); - resolve(); - } - }); - }); -} - -function formatResponse(response) { - if (response.trim() === '') { - return []; - } - - function formatMessage(message) { - return message.replace(/'/g, '').replace(/`/g, ''); - } - - return response.split(/Warning \d+ in stdin line /).filter(Boolean).reduce((acc, s) => { - const [key, value] = s.split(':'); - const line = Number(key); - const trimmed = value.trim(); - const match = trimmed.match(/(.*)\n(.*)\n(\s*)\^/m); - - if (Array.isArray(match)) { - const message = formatMessage(match[1]); - acc.push({ - line, - column: match[3].length, - message: `${message}\n\n${match[2]}\n${match[3]}^` - }); - } else { - acc.push({ - line, - column: 0, - message: formatMessage(trimmed) - }); - } - - return acc; - }, []); -} -;// CONCATENATED MODULE: external "mime/lite" -const lite_namespaceObject = require("mime/lite");; -var lite_default = /*#__PURE__*/__webpack_require__.n(lite_namespaceObject); -;// CONCATENATED MODULE: external "node-fetch" -const external_node_fetch_namespaceObject = require("node-fetch");; -var external_node_fetch_default = /*#__PURE__*/__webpack_require__.n(external_node_fetch_namespaceObject); -;// CONCATENATED MODULE: external "sandboxed-module" -const external_sandboxed_module_namespaceObject = require("sandboxed-module");; -var external_sandboxed_module_default = /*#__PURE__*/__webpack_require__.n(external_sandboxed_module_namespaceObject); -// EXTERNAL MODULE: ./src/latex/domstubs.js -var domstubs = __webpack_require__(6209); -;// CONCATENATED MODULE: ./src/latex/pdf-to-svg.ts - - - - - // @ts-expect-error - - // inject globals into pdf.js in a non-leaky way - -const pdfjsLib = external_sandboxed_module_default().require('pdfjs-dist/es5/build/pdf', { - globals: { - document: domstubs.document, - Image: domstubs.Image, - Element: domstubs.Element, - console, - process - } -}); - -async function texPdfToSvg(filePath) { - const doc = await pdfjsLib.getDocument({ - url: filePath, - fontExtraProperties: true // cMapUrl: '../node_modules/pdfjs-dist/cmaps/', - // cMapPacked: true, - - }).promise; - const metadata = await doc.getMetadata(); - - if (!isPdfTexDocument(metadata.info)) { - throw new Error('Unhandled pdf file: was not produced by PdfTeX'); - } - - const page = await doc.getPage(1); - const opList = await page.getOperatorList(); - const viewport = page.getViewport({ - scale: 1.0 - }); - const svgGfx = new pdfjsLib.SVGGraphics(page.commonObjs, page.objs); - svgGfx.embedFonts = true; - const svg = await svgGfx.getSVG(opList, viewport); - return formatSvg(svg.toString()); -} - -function isPdfTexDocument(info = {}) { - var _info$Producer; - - return (_info$Producer = info.Producer) === null || _info$Producer === void 0 ? void 0 : _info$Producer.startsWith('pdfTeX'); -} - -async function formatSvg(str) { - const processor = unified_default()().use((external_rehype_parse_default()), { - fragment: true - }).use(addWrapper).use((external_rehype_stringify_default())); - const parsed = processor.parse(str.replace(/svg:/g, '')); - return processor.run(parsed); -} - -function addWrapper() { - return tree => { - external_unist_util_visit_default()(tree, 'element', node => { - if (node.tagName === 'svg') { - const properties = node.properties; - node.properties = { - width: properties.width, - height: properties.height, - viewBox: properties.viewBox, - className: 'pdftex' - }; - } - }); - }; -} -;// CONCATENATED MODULE: external "hash-sum" -const external_hash_sum_namespaceObject = require("hash-sum");; -var external_hash_sum_default = /*#__PURE__*/__webpack_require__.n(external_hash_sum_namespaceObject); -;// CONCATENATED MODULE: ./src/utils/cache-to-file.ts - - - - -async function cacheToFile({ - dirPath, - prefix, - key, - execFn -}) { - if (dirPath === null) { - return execFn(key); - } - - const cacheDir = getCacheDir(dirPath); - const filePath = `${prefix}-${external_hash_sum_default()(key)}.txt`; - const cachedFilePath = external_path_default().join(cacheDir, filePath); - - if (external_fs_default().existsSync(cachedFilePath)) { - return external_fs_default().readFileSync(cachedFilePath, 'utf-8'); - } - - const out = await execFn(key); - external_fs_default().mkdirSync(cacheDir, { - recursive: true - }); - external_fs_default().writeFileSync(cachedFilePath, out); - return out; -} -;// CONCATENATED MODULE: ./src/transforms-hast/embed-assets.ts -function embed_assets_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function embed_assets_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { embed_assets_ownKeys(Object(source), true).forEach(function (key) { embed_assets_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { embed_assets_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function embed_assets_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - - - - - - - - -function embedAssets(dirPath) { - async function embed(node, file) { - const src = getImageSrc(node); - const parsed = external_path_default().parse(src); - - try { - switch (parsed.ext) { - case '.png': - case '.jpg': - case '.gif': - return embedImage(node, dirPath); - - case '.pdf': - return embedTexPdfSvg(node); - - default: - throw new Error(`unhandled file extension: ${parsed.ext}`); - } - } catch (err) { - failMessage(file, err.message, node.position); - } - } - - return async (tree, file) => { - const transformations = []; - external_unist_util_visit_default()(tree, 'element', node => { - if (node.tagName === 'img') { - transformations.push(embed(node, file)); - } - }); - await Promise.all(transformations); - }; -} - -async function embedImage(node, dirPath) { - const properties = node.properties || {}; - const src = getImageSrc(node); - const mime = lite_default().getType(external_path_default().extname(src)); - const image = await getImage(src, dirPath); - node.properties = embed_assets_objectSpread(embed_assets_objectSpread({}, properties), {}, { - src: `data:${mime};base64,${image}` - }); -} - -function getImageSrc(node) { - const properties = node.properties || {}; - - if (!properties.src) { - throw new Error('Image has no src'); - } - - return properties.src; -} - -async function getImage(src, dirPath) { - if (src.startsWith('http')) { - return cacheToFile({ - dirPath, - prefix: 'youtube', - key: src, - execFn: getImageDataFromWeb - }); - } else { - return readFile(src, 'base64'); - } -} - -async function getImageDataFromWeb(src) { - const response = await external_node_fetch_default()(src); - const buffer = await response.buffer(); - return buffer.toString('base64'); -} - -async function embedTexPdfSvg(imgNode) { - const src = getImageSrc(imgNode); - const svgNode = await texPdfToSvg(src); - - const properties = embed_assets_objectSpread(embed_assets_objectSpread({}, svgNode.properties), imgNode.properties); - - delete properties.src; - Object.assign(imgNode, svgNode, { - properties - }); -} -;// CONCATENATED MODULE: ./src/transforms-hast/html-wrapper.ts -function htmlWrapper(opts) { - return tree => { - const children = tree.children; - return { - type: 'root', - children: [{ - type: 'element', - tagName: 'div', - properties: { - className: 'wrapper' - }, - children: [{ - type: 'element', - tagName: 'h4', - children: [{ - type: 'text', - value: opts.courseTitle - }] - }, { - type: 'element', - tagName: 'h1', - children: [{ - type: 'text', - value: opts.unitTitle - }] - }, ...children] - }] - }; - }; -} -;// CONCATENATED MODULE: external "mathjax-full/js/mathjax.js" -const mathjax_js_namespaceObject = require("mathjax-full/js/mathjax.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/input/tex.js" -const tex_js_namespaceObject = require("mathjax-full/js/input/tex.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/output/svg.js" -const svg_js_namespaceObject = require("mathjax-full/js/output/svg.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/input/mathml.js" -const mathml_js_namespaceObject = require("mathjax-full/js/input/mathml.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/adaptors/liteAdaptor.js" -const liteAdaptor_js_namespaceObject = require("mathjax-full/js/adaptors/liteAdaptor.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/handlers/html/HTMLDocument.js" -const HTMLDocument_js_namespaceObject = require("mathjax-full/js/handlers/html/HTMLDocument.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/handlers/html.js" -const html_js_namespaceObject = require("mathjax-full/js/handlers/html.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/input/tex/AllPackages.js" -const AllPackages_js_namespaceObject = require("mathjax-full/js/input/tex/AllPackages.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/core/MmlTree/SerializedMmlVisitor.js" -const SerializedMmlVisitor_js_namespaceObject = require("mathjax-full/js/core/MmlTree/SerializedMmlVisitor.js");; -;// CONCATENATED MODULE: external "mathjax-full/js/core/MathItem.js" -const MathItem_js_namespaceObject = require("mathjax-full/js/core/MathItem.js");; -;// CONCATENATED MODULE: external "speech-rule-engine" -const external_speech_rule_engine_namespaceObject = require("speech-rule-engine");; -;// CONCATENATED MODULE: ./src/latex/mathjax-tex.ts - - - - - - - - - - // @ts-expect-error - - -function texToMml(tex = '') { - const packages = AllPackages_js_namespaceObject.AllPackages.filter(name => name !== 'bussproofs'); - const adaptor = (0,liteAdaptor_js_namespaceObject.liteAdaptor)(); - const input = new tex_js_namespaceObject.TeX({ - packages - }); - const doc = new HTMLDocument_js_namespaceObject.HTMLDocument('', adaptor, { - InputJax: input - }); - const node = doc.convert(tex, { - end: MathItem_js_namespaceObject.STATE.CONVERT - }); - const visitor = new SerializedMmlVisitor_js_namespaceObject.SerializedMmlVisitor(); - return visitor.visitTree(node); -} -function mmlToSvg(mml) { - const adaptor = (0,liteAdaptor_js_namespaceObject.liteAdaptor)(); - (0,html_js_namespaceObject.RegisterHTMLHandler)(adaptor); - const input = new mathml_js_namespaceObject.MathML(); - const output = new svg_js_namespaceObject.SVG({ - fontCache: 'local' - }); - const doc = mathjax_js_namespaceObject.mathjax.document('', { - InputJax: input, - OutputJax: output - }); - const node = doc.convert(mml, { - em: 25 - }); - return adaptor.outerHTML(node); -} -function mmlToSpeech(mml) { - return (0,external_speech_rule_engine_namespaceObject.toSpeech)(mml); -} -;// CONCATENATED MODULE: ./src/transforms-mdast/accessible-tex.ts - - - -function accessibleTex() { - return tree => { - external_unist_util_visit_default()(tree, ['math', 'inlineMath'], customMath); - }; -} - -function customMath(node) { - const className = node.type === 'inlineMath' ? 'math-inline' : 'math'; - const mml = texToMml(node.value || ''); - const label = mmlToSpeech(mml); - const mathjaxSvg = mmlToSvg(mml); - const svg = customSvgOutput(mathjaxSvg, label); - node.data = { - hName: 'div', - hProperties: { - className - }, - hChildren: [svg] - }; -} - -function customSvgOutput(mathjaxSvg, label = '') { - const tree = rehypeParser.parse(mathjaxSvg); - const parent = tree.children[0]; - const svg = parent.children[0]; - const properties = svg.properties; - const newProperties = { - width: properties.width, - height: properties.height, - viewBox: properties.viewBox, - role: 'img' - }; - - if (label !== '') { - const uniqueId = `math-${Math.random().toString(16).slice(2)}`; - newProperties['aria-labelledby'] = uniqueId; - svg.children.unshift({ - type: 'element', - tagName: 'title', - properties: { - id: uniqueId - }, - children: [{ - type: 'text', - value: label - }] - }); - } - - svg.properties = newProperties; - return svg; -} -// EXTERNAL MODULE: ../node_modules/mdast-util-to-hast/index.js -var mdast_util_to_hast = __webpack_require__(9376); -var mdast_util_to_hast_default = /*#__PURE__*/__webpack_require__.n(mdast_util_to_hast); -;// CONCATENATED MODULE: ./src/transforms-mdast/boxouts.ts -function boxouts_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function boxouts_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { boxouts_ownKeys(Object(source), true).forEach(function (key) { boxouts_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { boxouts_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function boxouts_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - - - -function boxouts() { - const counter = createCounter(); - - function template(node) { - const name = node.name; - const children = node.children; - const count = counter.increment(name); - const title = getTitle(node, count); - const id = `${name}-${count}`; - const className = ['boxout', name]; - const attributes = node.attributes; - - if (attributes.icon) { - className.push(`${attributes.icon}-icon`); - } - - const newChildren = children.filter(o => { - var _o$data; - - return !((_o$data = o.data) !== null && _o$data !== void 0 && _o$data.directiveLabel); - }).map(o => boxouts_objectSpread(boxouts_objectSpread({}, mdast_util_to_hast_default()(o)), {}, { - name: o.name - })); - node.data = { - hProperties: { - className, - id - }, - hChildren: [title, ...newChildren] - }; - } - - return async tree => { - external_unist_util_visit_default()(tree, 'containerDirective', node => { - switch (node.name) { - case 'example': - case 'supplement': - case 'background': - case 'weblink': - case 'task': - case 'answer': - template(node); - } - }); - }; -} - -function getTitle(node, count) { - return { - type: 'element', - tagName: 'h3', - children: [{ - type: 'text', - value: getTitleValue(node, count) - }] - }; -} - -function getTitleValue(node, count) { - var _firstChild$children$, _firstChild$data; - - const subject = (0,external_lodash_namespaceObject.startCase)(node.name); - const children = node.children || []; - const firstChild = children[0] || {}; - const oldValue = ((_firstChild$children$ = firstChild.children[0]) === null || _firstChild$children$ === void 0 ? void 0 : _firstChild$children$.value) || ''; - let newValue = `${subject} ${count}`; - - if ((_firstChild$data = firstChild.data) !== null && _firstChild$data !== void 0 && _firstChild$data.directiveLabel && oldValue !== '') { - newValue += ` (${oldValue})`; - } - - return newValue; -} - -function createCounter() { - const store = {}; - return { - increment(key) { - store[key] = (store[key] || 0) + 1; - return store[key]; - } - - }; -} -;// CONCATENATED MODULE: external "lowlight" -const external_lowlight_namespaceObject = require("lowlight");; -;// CONCATENATED MODULE: ./src/r-markdown/exec-r.ts - -async function executeRCode(code) { - // I found this code to allow R graphs to be written to stdout as SVG - // https://stackoverflow.com/questions/54309405#54310307 - const wrappedCode = ` - dev_stdout = function () { - filename = tempfile() - svg(filename) - filename - } - - dev_stdout_off = function (filename) { - dev.off() - on.exit(unlink(filename)) - fake_stdout = pipe("cat", "wb") - on.exit(close(fake_stdout), add = TRUE) - writeBin(readBin(filename, "raw", file.info(filename)$size), fake_stdout) - } - - tmp_dev = dev_stdout() - ${code} - dev_stdout_off(tmp_dev) - `; - const execString = `Rscript -e '${wrappedCode}'`; - return new Promise((resolve, reject) => { - (0,external_child_process_namespaceObject.exec)(execString, (err, response) => { - // console.log('ERROR', err); - // console.log('RESPONSE', response); - if (err) { - reject(formatError(err, execString, code)); - } else { - resolve(exec_r_formatResponse(response)); - } - }); - }); -} - -function formatError(err, wrappedCode, code) { - err.message = err.message.replace(wrappedCode, `\n\n${code}\n`).replace('Execution halted', '').trim(); - return err; -} - -function exec_r_formatResponse(out) { - // If output is text it will print an empty SVG after, so remove it - if (out.startsWith('[1]')) { - return out.slice(0, out.indexOf(' s.trim())[0]; - } - - return trimmed; -} - -function parseOptions(options) { - const trimmed = options.trim(); - - if (trimmed[0] !== '{') { - return {}; - } - - return trimmed.slice(1, -1).split(',').slice(1).reduce((acc, str) => { - const [key, value] = str.split('=').map(s => s.trim()); - acc[key] = parseOptionValue(value); - return acc; - }, {}); -} - -function parseOptionValue(mixed) { - if (mixed === 'TRUE' || mixed === undefined) { - return true; - } - - if (mixed === 'FALSE') { - return false; - } - - if (!Number.isNaN(Number(mixed))) { - return Number(mixed); - } - - return mixed; -} -;// CONCATENATED MODULE: ./src/transforms-mdast/code-blocks.ts -// @ts-expect-error - - - - - - - -function codeBlocks(dirPath) { - return async (tree, file) => { - const transformations = []; - external_unist_util_visit_default()(tree, 'code', node => { - transformations.push(customCode(node, dirPath, file)); - }); - await Promise.all(transformations); - return tree; - }; -} - -async function customCode(node, dirPath, file) { - if (!node.data) { - node.data = {}; - } - - node.data.hName = 'div'; - node.data.hProperties = { - className: 'code-wrapper' - }; // parse custom Markdown syntax, ie. ```{r,echo=TRUE} - - const combined = `${node.lang || ''}${node.meta || ''}`; - const { - language, - options - } = parseCodeParams(combined); - const value = String(node.value); - const children = []; // - - children.push({ - type: 'element', - tagName: 'pre', - children: [{ - type: 'element', - tagName: 'code', - properties: { - className: language === '' ? '' : `language-${language}` - }, - children: (0,external_lowlight_namespaceObject.highlight)(language, value).value - }] - }); - - if (options.echo === true) { - let output = ''; - const classNames = ['output']; - - try { - output = await cacheToFile({ - dirPath, - prefix: 'r', - key: value, - execFn: executeRCode - }); - } catch (err) { - failMessage(file, err.message, node.position); - } - - const ast = rehypeParser.parse(output).children; - children.push({ - type: 'element', - tagName: 'div', - properties: { - className: classNames - }, - children: [{ - type: 'element', - tagName: 'h3', - children: [{ - type: 'text', - value: 'Output' - }] - }, { - type: 'element', - tagName: 'code', - children: ast - }] - }); - } - - node.data.hChildren = children; -} -;// CONCATENATED MODULE: ./src/transforms-mdast/embed-asset-urls.ts - - - - -function embedAssetUrl() { - async function getAssetUrl(node, file) { - const url = node.url || ''; - - if (!file.dirname) { - throw new Error('VFile dirname undefined'); - } - - if (/^\.{1,2}\//.test(url)) { - const fullPath = external_path_default().join(file.cwd, file.dirname, url); - const exists = await checkFileExists(fullPath); - - if (!exists) { - failMessage(file, `No asset found at ${url}`, node.position); - } else { - node.url = fullPath; - } - } - } - - return async (tree, file) => { - const transformations = []; - external_unist_util_visit_default()(tree, 'image', node => { - transformations.push(getAssetUrl(node, file)); - }); - await Promise.all(transformations); - }; -} -;// CONCATENATED MODULE: ./src/transforms-mdast/move-answers-to-end.ts - -function moveAnswersToEnd() { - return tree => { - external_unist_util_visit_default()(tree, 'containerDirective', (node, index, parent) => { - // remove answer from task rehype - if (node.name === 'task' && node.data) { - const children = node.data.hChildren || []; - node.data.hChildren = children.filter(o => o.name !== 'answer'); - } - - if (node.name === 'answer') { - // these nodes have already been moved to the end - if (node.movedToEnd) { - return; - } // remove answer block from task node - - - const parentChildren = (parent === null || parent === void 0 ? void 0 : parent.children) || []; - parentChildren.splice(index, 1); // add to root node - - const treeChildren = tree.children || []; - node.movedToEnd = true; - treeChildren.push(node); - } - }); - }; -} -;// CONCATENATED MODULE: ./src/transforms-mdast/youtube-videos.ts - - - -function youtubeVideos() { - return async (tree, file) => { - external_unist_util_visit_default()(tree, 'leafDirective', node => { - if (node.name === 'video') { - template(node, file); - } - }); - }; -} - -function template(node, file) { - if (!node.data) { - node.data = {}; - } - - node.data.hName = 'div'; - node.data.hProperties = { - className: 'video-wrapper' - }; - - try { - const attributes = getAttributes(node.attributes, file, node.position); - const children = [{ - type: 'element', - tagName: 'a', - properties: { - href: getYoutubeUrl(attributes.id), - title: attributes.title || null, - target: '_blank' - }, - children: [{ - type: 'element', - tagName: 'img', - properties: { - src: getYoutubeThumbnailUrl(attributes.id), - alt: '' - }, - children: [] - }] - }]; - node.data.hChildren = children; - } catch (err) { - failMessage(file, err.message, node.position); - } -} - -const attributesSchema = external_yup_namespaceObject.object().shape({ - id: external_yup_namespaceObject.string().required(), - title: external_yup_namespaceObject.string() -}); - -function getAttributes(attributes, file, position) { - if (!attributes.title) { - warnMessage(file, 'Videos should include title attributes', position); - } - - return attributesSchema.validateSync(attributes); -} - -function getYoutubeUrl(id) { - return `https://youtu.be/${id}`; -} - -function getYoutubeThumbnailUrl(id) { - return `http://img.youtube.com/vi/${id}/maxresdefault.jpg`; -} -;// CONCATENATED MODULE: ./src/processors.ts -// @ts-expect-error - // @ts-expect-error - - // @ts-expect-error - - - // @ts-expect-error - - - - - - - // @ts-expect-error - - // @ts-expect-error - - // @ts-expect-error - - - - - - - - - - - - - - // import { inspect } from './utils/utils'; - -async function markdownParser(file) { - const processor = unified_default()().use((remark_parse_default())).use((external_remark_directive_default())).use((external_remark_math_default())); - const parsed = processor.parse(file); - return processor.run(parsed, file); -} -async function customTransforms(mdast, file) { - const processor = unified_default()().use(embedAssetUrl).use(youtubeVideos); - return processor.run(mdast, file); -} -async function linter(mdast, file) { - const retextProcessor = unified_default()().use((external_retext_english_default())).use((external_retext_spell_default()), (external_dictionary_en_gb_default())); - const processor = unified_default()().use(assertTaskAnswerStructure).use(lintLatex).use((remark_lint_alt_text_default())).use((remark_lint_link_text_default())).use((external_remark_retext_default()), retextProcessor); - return processor.run(mdast, file); -} -async function customCombinedTransforms(mdast, dirPath) { - const processor = unified_default()().use(boxouts).use(moveAnswersToEnd) // .use(inspect) - .use(accessibleTex).use(codeBlocks, dirPath); - return processor.run(mdast); -} -async function htmlCompiler(mdast, dirPath, titles, options) { - const processor = unified_default()().use((external_remark_rehype_default())).use(embedAssets, dirPath) // TODO: try to get this inside custom transforms - .use(htmlWrapper, titles).use((external_rehype_format_default())).use((external_rehype_stringify_default())); - - if (!options.noDoc) { - processor.use((external_rehype_document_default()), { - title: titles.docTitle, - style: `\n${await getTemplateCss()}\n`, - script: `\n${await getTemplateJs()}\n` - }); - } - - const transformed = await processor.run(mdast); - return processor.stringify(transformed); -} -async function pdfHtmlCompiler(mdast, dirPath, titles, options) { - // TODO: pdf cover - return htmlCompiler(mdast, dirPath, titles, options); -} -;// CONCATENATED MODULE: external "figures" -const external_figures_namespaceObject = require("figures");; -var external_figures_default = /*#__PURE__*/__webpack_require__.n(external_figures_namespaceObject); -;// CONCATENATED MODULE: ./src/utils/report.ts - - - - -function printReport(files) { - for (const file of files) { - console.log(`\n${getFilePath(file.path)}`); - - for (const message of file.messages) { - const status = message.status; - const position = external_chalk_default().grey(`${message.line}:${message.column}`); - const reason = formatReason(message.reason, status); - console.log(`${formatStatus(status)} ${position} ${reason}`); - } - } -} -function reportHasFatalErrors(files) { - const passed = files.every(file => file.messages.every(message => message.status !== MessageStatus.fail)); - return !passed; -} - -function getFilePath(filePath) { - return external_path_default().join(process.cwd(), filePath); -} - -function formatStatus(status) { - const statusColour = getStatusColour(status); - - switch (status) { - case MessageStatus.fail: - return statusColour((external_figures_default()).cross); - - default: - return statusColour((external_figures_default()).warning); - // TODO: fail on unsupported status? - } -} - -function formatReason(reason, status) { - const statusColour = getStatusColour(status); - const [first, ...rest] = reason.split('\n'); - const formattedFirst = statusColour(first); - const formattedRest = rest.map(line => external_chalk_default().grey(line)); - return [formattedFirst, ...formattedRest].join('\n'); -} - -function getStatusColour(status) { - switch (status) { - case MessageStatus.fail: - return (external_chalk_default()).red; - - default: - return (external_chalk_default()).yellow; - } -} -;// CONCATENATED MODULE: external "html-pdf" -const external_html_pdf_namespaceObject = require("html-pdf");; -;// CONCATENATED MODULE: ./src/utils/write-files.ts - - - - -async function writeHtml(fileName, html, dirPath) { - const filePath = write_files_getFilePath(dirPath, fileName); - await writeFile(`${filePath}.html`, html); - console.log('html file written to:', `${filePath}.html`); -} -async function writePdf(fileName, pdfHtml, dirPath) { - const filePath = write_files_getFilePath(dirPath, fileName); - await writePdfFile(`${filePath}.pdf`, pdfHtml); - console.log('pdf file written to:', `${filePath}.pdf`); -} - -function write_files_getFilePath(dirPath, unitName) { - const buildDir = getBuildDir(dirPath); - const fileName = (0,external_lodash_namespaceObject.kebabCase)(unitName); - return external_path_default().join(buildDir, fileName); -} - -async function writePdfFile(filePath, html) { - return new Promise((resolve, reject) => { - pdf.create(html).toFile(filePath, err => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - }); -} -;// CONCATENATED MODULE: ./src/index.ts - - - - - - - -if (false) {} - -async function buildCourse(dirPath, options = {}) { - const course = await collectCoursework(dirPath); - const buildDir = getBuildDir(dirPath); - await mkdir(buildDir); - - for (const unit of course.units) { - await buildUnit(dirPath, course, unit, options); - } -} -async function buildUnit(dirPath, course, unit, options) { - try { - const files = unit.markdown; // parse markdown - - const mdasts = await Promise.all(files.map(markdownParser)); // transforms with reports back to original files - - await Promise.all(mdasts.map((mdast, idx) => customTransforms(mdast, files[idx]))); // linter - - await Promise.all(mdasts.map((mdast, idx) => linter(mdast, files[idx]))); - printReport(files); - - if (reportHasFatalErrors(files)) { - return; - } // combine mdast trees - - - const combined = combineMdastTrees(mdasts); // transforms on combined tree - - await customCombinedTransforms(combined, dirPath); // compile html - - const titles = getUnitTitles(course, unit); - const html = await htmlCompiler(combined, dirPath, titles, options); - await writeHtml(titles.unitName, html, dirPath); // const pdfHtml = await pdfHtmlCompiler(combined, titles, dirPath); - // await writePdf(titles.unitName, pdfHtml, dirPath); - } catch (err) { - console.error(external_chalk_default().red(err.message)); - } -} -})(); - -var __webpack_export_target__ = exports; -for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; -if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); -/******/ })() -; \ No newline at end of file diff --git a/compiler/dist/template/main.css b/compiler/dist/template/main.css deleted file mode 100644 index 259c31a5..00000000 --- a/compiler/dist/template/main.css +++ /dev/null @@ -1,218 +0,0 @@ -/* - -An Old Hope – Star Wars Syntax (c) Gustavo Costa -Original theme - Ocean Dark Theme – by https://github.com/gavsiu -Based on Jesse Leite's Atom syntax theme 'An Old Hope' – https://github.com/JesseLeite/an-old-hope-syntax-atom - -*/ - -/* Death Star Comment */ -.hljs-comment, -.hljs-quote -{ - color: #B6B18B; -} - -/* Darth Vader */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion -{ - color: #EB3C54; -} - -/* Threepio */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link -{ - color: #E7CE56; -} - -/* Luke Skywalker */ -.hljs-attribute -{ - color: #EE7C2B; -} - -/* Obi Wan Kenobi */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition -{ - color: #4FB4D7; -} - -/* Yoda */ -.hljs-title, -.hljs-section -{ - color: #78BB65; -} - -/* Mace Windu */ -.hljs-keyword, -.hljs-selector-tag -{ - color: #B45EA4; -} - -/* Millenium Falcon */ -.hljs -{ - display: block; - overflow-x: auto; - background: #1C1D21; - color: #c0c5ce; - padding: 0.5em; -} - -.hljs-emphasis -{ - font-style: italic; -} - -.hljs-strong -{ - font-weight: bold; -} - -* { - margin: 0; - border: 0; - padding: 0; -} - -html { - font: 14px/1.5 sans-serif; -} - -.wrapper { - max-width: 50rem; - margin: 0 auto; - padding: 2rem; -} - -h1, h2, h3, h4, h5, h6 { - padding: 1em 0 0.5em; -} - -p { - padding-bottom: 1rem; -} - -img { - display: block; - width: 100%; - height: auto; -} - -.code-wrapper { - background: #1c1d21; - color: #abb2bf; - margin-bottom: 1rem; - border-radius: 0.5rem; - overflow: hidden; -} - -.code-wrapper pre { - font-family: monospace; - padding: 2rem; -} - -.code-wrapper .output { - background: #fff3; - padding: 2rem; -} - -.code-wrapper .output.error { - background: #C21919; - color: #fff; -} - -.code-wrapper .output h3 { - color: white; - margin-top: -0.1rem; - padding: 0 0 1rem; -} - -.code-wrapper .output code { - white-space: pre-wrap; -} - -.code-wrapper .output svg { - display: block; - width: 100%; - height: auto; -} - -.boxout { - padding: 2rem; - margin-bottom: 1rem; - border-radius: 0.5rem; - background-color: #d7dce1; - color: #002f55; -} - -.boxout h3::before { - content: ''; - display: inline-block; - width: 20px; - height: 20px; - background-position: center; - background-size: contain; - background-repeat: no-repeat; - margin-right: 0.5rem; -} - -.boxout.task h3::before { - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjMuMTY4IiBoZWlnaHQ9IjEwNi42NjYiIHZpZXdCb3g9IjAgMCAxMTUuNDcgMTAwIj48cGF0aCB0cmFuc2Zvcm09Im1hdHJpeCgtLjU5MjUgMCAwIC0uNTkyNSAxMTYuOTg1IDEwOS4yNSkiIHN0eWxlPSJmaWxsOiM5NTEyNzI7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOiNmZmY7c3Ryb2tlLXdpZHRoOjIuNDk5NTg1NjM7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgZD0iTTE0OCAxNi44NjIgMTk2IDEwMGwtNDggODMuMTM4SDUyTDQgMTAwbDQ4LTgzLjEzOHoiLz48cGF0aCBkPSJtMjM1LjIzIDY3MS43NS0xMi4xODcgMjAuNjYtMTEuNjQ3LTcuNDc1IDExLjkwNy0yMC4xMjhtMTQuNjkgOC41NzcgMzEuNTM2IDE4LjY2OC0xMi4yMjYgMjAuNjM3LTMxLjUzNi0xOC42NjhtNDYuMzI5LjQ0MiAxMC43NDIgMTkuMzI0LTIyLjE3Mi0uMjEyIiBzdHlsZT0ic3Ryb2tlLXdpZHRoOjMuMTk3MjExOTg7ZmlsbDojZmZmIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTkxIC02NDIuMzYyKSIvPjwvc3ZnPg==); -} - -.boxout.example h3::before { - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjMuMTY4IiBoZWlnaHQ9IjEwNi42NjYiIHZpZXdCb3g9IjAgMCAxMTUuNDcgMTAwIj48cGF0aCB0cmFuc2Zvcm09Im1hdHJpeCgtLjU5MjUgMCAwIC0uNTkyNSAxMTYuOTg1IDEwOS4yNSkiIHN0eWxlPSJmaWxsOiMwMDM4NjU7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOiNmZmY7c3Ryb2tlLXdpZHRoOjIuNDk5NTg1NjM7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgZD0iTTE0OCAxNi44NjIgMTk2IDEwMGwtNDggODMuMTM4SDUyTDQgMTAwbDQ4LTgzLjEzOHoiLz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTg3LjAyMiAtNjQ1LjA1KSI+PHJlY3Qgcnk9IjEuNTgxIiB5PSI2NjYuMjQ1IiB4PSIyNDAuOTk4IiBoZWlnaHQ9IjMzLjE5NiIgd2lkdGg9IjcuODA3IiBzdHlsZT0ib3BhY2l0eTouOTg5OTk5OTk7ZmlsbDojZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDozLjE2Mjg1OTI7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIvPjxyZWN0IHRyYW5zZm9ybT0icm90YXRlKDcyKSIgc3R5bGU9Im9wYWNpdHk6Ljk4OTk5OTk5O2ZpbGw6I2ZmZjtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6My4xNjI4NTkyO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1vcGFjaXR5OjEiIHdpZHRoPSI3LjgwNyIgaGVpZ2h0PSIzMy4xOTYiIHg9IjczNC45IiB5PSItNDguMTU2IiByeT0iMS41ODEiLz48cmVjdCByeT0iMS41ODEiIHk9Ii03MzguNjQ4IiB4PSIyMDguMDg5IiBoZWlnaHQ9IjMzLjE5NiIgd2lkdGg9IjcuODA3IiBzdHlsZT0ib3BhY2l0eTouOTg5OTk5OTk7ZmlsbDojZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDozLjE2Mjg1OTI7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgdHJhbnNmb3JtPSJyb3RhdGUoMTQ0KSIvPjxyZWN0IHRyYW5zZm9ybT0icm90YXRlKC0xNDQpIiBzdHlsZT0ib3BhY2l0eTouOTg5OTk5OTk7ZmlsbDojZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDozLjE2Mjg1OTI7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgd2lkdGg9IjcuODA3IiBoZWlnaHQ9IjMzLjE5NiIgeD0iLTYxMS40MDEiIHk9Ii00NTAuOTk0IiByeT0iMS41ODEiLz48cmVjdCByeT0iMS41ODEiIHk9IjQxNy4yNzciIHg9Ii01OTEuMDYyIiBoZWlnaHQ9IjMzLjE5NiIgd2lkdGg9IjcuODA3IiBzdHlsZT0ib3BhY2l0eTouOTg5OTk5OTk7ZmlsbDojZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDozLjE2Mjg1OTI7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgdHJhbnNmb3JtPSJyb3RhdGUoLTcyKSIvPjwvZz48L3N2Zz4=); -} - -.boxout.supplement h3::before { - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjMuMTY4IiBoZWlnaHQ9IjEwNi42NjYiIHZpZXdCb3g9IjAgMCAxMTUuNDcgMTAwIj48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTkxIC02NDIuMzYyKSI+PHBhdGggdHJhbnNmb3JtPSJtYXRyaXgoLS41OTI1IDAgMCAtLjU5MjUgMzA3Ljk4NSA3NTEuNjEyKSIgc3R5bGU9ImZpbGw6IzU0NTQ1NDtmaWxsLW9wYWNpdHk6MTtzdHJva2U6I2ZmZjtzdHJva2Utd2lkdGg6Mi40OTk1ODU2MztzdHJva2UtbWl0ZXJsaW1pdDo0O3N0cm9rZS1kYXNoYXJyYXk6bm9uZTtzdHJva2Utb3BhY2l0eToxIiBkPSJNMTQ4IDE2Ljg2MiAxOTYgMTAwbC00OCA4My4xMzhINTJMNCAxMDBsNDgtODMuMTM4eiIvPjxjaXJjbGUgc3R5bGU9Im9wYWNpdHk6Ljk4OTk5OTk5O2ZpbGw6bm9uZTtmaWxsLW9wYWNpdHk6MTtzdHJva2U6I2ZmZjtzdHJva2Utd2lkdGg6Ny40OTk5OTk4NjtzdHJva2UtbWl0ZXJsaW1pdDo0O3N0cm9rZS1kYXNoYXJyYXk6bm9uZTtzdHJva2Utb3BhY2l0eToxIiBjeD0iMjQ4LjczNSIgY3k9IjY5Mi4zNjIiIHI9IjI2LjU1OCIvPjwvZz48L3N2Zz4=); -} - -.boxout.background h3::before { - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjMuMTY4IiBoZWlnaHQ9IjEwNi42NjYiIHZpZXdCb3g9IjAgMCAxMTUuNDcgMTAwIj48cGF0aCB0cmFuc2Zvcm09Im1hdHJpeCgtLjU5MjUgMCAwIC0uNTkyNSAxMTYuOTg1IDEwOS4yNSkiIHN0eWxlPSJmaWxsOiMwMDM4NjU7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOiNmZmY7c3Ryb2tlLXdpZHRoOjIuNDk5NTg1NjM7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgZD0iTTE0OCAxNi44NjIgMTk2IDEwMGwtNDggODMuMTM4SDUyTDQgMTAwbDQ4LTgzLjEzOHoiLz48cGF0aCBkPSJNMjY0LjUzMyA2ODcuMTc4di0xNi45MTFsLTE1Ljg5My05LjUtMTUuNzAyIDkuMzk3djE3LjExMWwtMTUuNzk4IDguNDg5djE4Ljk5OWwxNi4xNTYgOS4xOTQgMTUuNDQtOC45MzMgMTUuNDM4IDguOTMzIDE2LjE1Ni05LjE5NHYtMTguODk2em0tMy4wMS4wOTUtMTEuMzc3IDYuMjc2di0xMy4wNDhsMTEuMzc3LTYuNjg1em0tMTIuODg4LTIyLjkzMyAxMS4yNDggNi44MzUtMTEuMjM3IDYuNjA2LTEwLjk5NS02LjcyNHptLTI2Ljc4MiAzMi4zMTYgMTIuNTgtNi42NiAxMS4xNTYgNi4zNjMtMTIuMjkgNy4wMjJ6bTEyLjk0NiA5LjQ0NUwyNDcuMjMyIDY5OXYxMy4zMTJsLTEyLjQzMyA3LjI1OHptMTcuMTQ2LTkuODYzIDExLjE4Mi02LjI5MyAxMi41NTYgNi44My0xMS40OTggNi42MDZ6bTI1LjM3NiAxNi42NDgtMTEuNjQgNi42ODRWNzA2LjFsMTEuNjQtNi42ODJ6IiBzdHlsZT0iZmlsbDojZmZmO3N0cm9rZS13aWR0aDoyLjYzMjkwNTQ4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTkxIC02NDIuMzYyKSIvPjwvc3ZnPg==); -} - -.boxout.weblink h3::before { - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjMuMTY4IiBoZWlnaHQ9IjEwNi42NjYiIHZpZXdCb3g9IjAgMCAxMTUuNDcgMTAwIj48cGF0aCB0cmFuc2Zvcm09Im1hdHJpeCgtLjU5MjUgMCAwIC0uNTkyNSAxMTYuOTg1IDEwOS4yNSkiIHN0eWxlPSJmaWxsOiMwMDM4NjU7ZmlsbC1vcGFjaXR5OjE7c3Ryb2tlOiNmZmY7c3Ryb2tlLXdpZHRoOjIuNDk5NTg1NjM7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgZD0iTTE0OCAxNi44NjIgMTk2IDEwMGwtNDggODMuMTM4SDUyTDQgMTAwbDQ4LTgzLjEzOHoiLz48cGF0aCBzdHlsZT0ib3BhY2l0eTouOTg5OTk5OTk7ZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTojZmZmO3N0cm9rZS13aWR0aDozLjc0OTk5OTkzO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1vcGFjaXR5OjEiIGQ9Im0yNjMuODEgNjkyLjM2My0uMTAyIDIyLjY5MUgyMjYuNzV2LTM2Ljk1OWgyMi4wMDgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xOTEgLTY0Mi4zNjIpIi8+PGcgc3R5bGU9InN0cm9rZS13aWR0aDo2LjY5MzU3MzQ7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmUiPjxwYXRoIGQ9Ik0yNjEuNDczIDY2NC43NDdoMTQuODc3djEzLjk1OSIgc3R5bGU9Im9wYWNpdHk6Ljk4OTk5OTk5O2ZpbGw6bm9uZTtmaWxsLW9wYWNpdHk6MTtzdHJva2U6I2ZmZjtzdHJva2Utd2lkdGg6Ni42OTM1NzM0O3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1vcGFjaXR5OjEiIHRyYW5zZm9ybT0ibWF0cml4KC44NDAzNiAwIDAgLjg0MDM2IC0xNTMuMjY2IC01MzAuNTY1KSIvPjxnIHN0eWxlPSJzdHJva2Utd2lkdGg6Ni42OTM1NzM0O3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lIj48cGF0aCBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtcnVsZTpldmVub2RkO3N0cm9rZTojZmZmO3N0cm9rZS13aWR0aDo2LjY5MzU3MzQ7c3Ryb2tlLWxpbmVjYXA6YnV0dDtzdHJva2UtbGluZWpvaW46bWl0ZXI7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MSIgZD0ibTI1Mi41NjkgNjg3LjQ3MyAyMy43ODEtMjIuNzI2IiB0cmFuc2Zvcm09Im1hdHJpeCguODQwMzYgMCAwIC44NDAzNiAtMTUzLjI2NiAtNTMwLjU2NSkiLz48L2c+PGcgc3R5bGU9InN0cm9rZS13aWR0aDo2LjY5MzU3MzQ7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmUiPjxwYXRoIGQ9Im0yNTIuNTY5IDY4Ny40NzMgMjMuNzgxLTIyLjcyNiIgc3R5bGU9ImZpbGw6I2ZmZjtmaWxsLXJ1bGU6ZXZlbm9kZDtzdHJva2U6I2ZmZjtzdHJva2Utd2lkdGg6Ni42OTM1NzM0O3N0cm9rZS1saW5lY2FwOmJ1dHQ7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1vcGFjaXR5OjEiIHRyYW5zZm9ybT0ibWF0cml4KC44NDAzNiAwIDAgLjg0MDM2IC0xNTMuMjY2IC01MzAuNTY1KSIvPjwvZz48L2c+PC9zdmc+); -} - -.boxout.task { - background-color: #e7d9e3; - color: #831262; -} - -.boxout.supplement { - background-color: #dfdfdf; - color: #464646; -} - -svg.pdftex { - display: block; - width: 100%; - height: auto; -} - -.math-inline svg { - vertical-align: middle; -} - diff --git a/compiler/dist/template/main.js b/compiler/dist/template/main.js deleted file mode 100644 index 1d9b13f0..00000000 --- a/compiler/dist/template/main.js +++ /dev/null @@ -1,7 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -var __webpack_exports__ = {}; - -console.log('hey!'); -/******/ })() -; \ No newline at end of file diff --git a/compiler/src/r-markdown/knitr.ts b/compiler/src/r-markdown/knitr.ts index ebadd1d9..cc26e2ba 100644 --- a/compiler/src/r-markdown/knitr.ts +++ b/compiler/src/r-markdown/knitr.ts @@ -15,14 +15,9 @@ export async function processKnitr(files: VFile[], ctx: Context) { } async function knitr(filePath: string, ctx: Context) { - const rFile = path.join(__dirname, 'knitr.R'); - - const cacheDir = path.isAbsolute(ctx.cacheDir) - ? ctx.cacheDir - : path.relative(process.cwd(), ctx.cacheDir); - - const cmd = `Rscript ${rFile} ${filePath} ${cacheDir}/`; return new Promise((resolve, reject) => { + const rFile = path.join(__dirname, 'knitr.R'); + const cmd = `Rscript ${rFile} ${filePath} ${ctx.cacheDir}/`; exec(cmd, (err, response, stdErr) => { if (stdErr) { console.error('STDERR', stdErr); @@ -43,7 +38,7 @@ function formatResponse(response: string) { return response.replace(/\[1\]\s""$/m, '').trim(); } -// attempts at changing knitr output. doesn't work +// attempts at changing knitr output. doesn't completely work // const hooks = ` // knit_hooks$set( // source = function(x, options) { diff --git a/compiler/src/utils/utils.ts b/compiler/src/utils/utils.ts index 6f55ea4c..aaa30642 100644 --- a/compiler/src/utils/utils.ts +++ b/compiler/src/utils/utils.ts @@ -1,4 +1,5 @@ import fs from 'fs'; +import path from 'path'; import rehype from 'rehype-parse'; import unified from 'unified'; @@ -37,11 +38,11 @@ export function rmdir(dirPath: string) { } export function getBuildDir(dirPath: string) { - return `${dirPath}/build`; + return path.join(process.cwd(), dirPath, 'build'); } export function getCacheDir(dirPath: string) { - return `${dirPath}/cache`; + return path.join(process.cwd(), dirPath, 'cache'); } export function combineMdastTrees(mdasts: Node[]): Parent { diff --git a/dev.ts b/dev.ts index 0edce54a..102f1880 100644 --- a/dev.ts +++ b/dev.ts @@ -48,7 +48,7 @@ async function recompile(eventName?: string, path?: string) { // TODO: watch single unit try { await runCommand( - `yarn workspace compiler rmarkdown ../fixtures/${COURSE} --week=1 --noCache --noReport --noDoc` + `yarn rmarkdown fixtures/${COURSE} --week=1 --noCache --noReport --noDoc` ); } finally { console.timeEnd(timerName); diff --git a/fixtures/.gitignore b/fixtures/.gitignore new file mode 100644 index 00000000..e64e6172 --- /dev/null +++ b/fixtures/.gitignore @@ -0,0 +1,2 @@ +build/ +cache/ diff --git a/template/.gitignore b/template/.gitignore new file mode 100644 index 00000000..567609b1 --- /dev/null +++ b/template/.gitignore @@ -0,0 +1 @@ +build/ From 69283dbfcec9028adfad406e61f5a486d0f262c0 Mon Sep 17 00:00:00 2001 From: Dave Star Date: Mon, 21 Jun 2021 17:46:37 +0100 Subject: [PATCH 2/6] try ci --- compiler/src/processors.ts | 12 +++++++++--- compiler/webpack.config.js | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/src/processors.ts b/compiler/src/processors.ts index 63572b76..032a54b7 100644 --- a/compiler/src/processors.ts +++ b/compiler/src/processors.ts @@ -1,3 +1,5 @@ +import path from 'path'; + // @ts-expect-error import lintAltText from '@double-great/remark-lint-alt-text'; // @ts-expect-error @@ -28,10 +30,7 @@ import unified from 'unified'; import { Node } from 'unist'; import { VFile } from 'vfile'; -import templateCss from '../../template/build/template.css'; -import templateJs from '../../template/build/template.js2'; import { codeMod } from './code-mod'; -// import { getTemplateCss, getTemplateJs } from './env'; import { assertTaskAnswerStructure } from './linters/assert-task-answer'; import { assertWeblinkTarget } from './linters/assert-weblink-target'; import { lintLatex } from './linters/lint-latex'; @@ -47,6 +46,7 @@ import { responsiveTables } from './transforms-mdast/responsive-tables'; import { youtubeVideos } from './transforms-mdast/youtube-videos'; import { Context } from './types'; import { createSvg } from './utils/icons'; +import { readFile } from './utils/utils'; // import { inspect } from './utils/utils'; @@ -123,6 +123,12 @@ export async function htmlCompiler( } if (!ctx.options.noDoc) { + const templateCss = await readFile( + path.join(__dirname, 'template.css') + ); + const templateJs = await readFile( + path.join(__dirname, 'template.js2') + ); processor.use(doc, { title: titles.docTitle, style: `\n${templateCss}\n`, diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index 56403f7c..59be5a32 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -50,6 +50,7 @@ module.exports = { new CopyPlugin({ patterns: [ { from: './src/r-markdown/knitr.R', to: './' }, + { from: '../template/build', to: './' }, ], }), ], From 12a7af9ac1e5b1f86c7f806035c6025e8201184a Mon Sep 17 00:00:00 2001 From: Dave Star Date: Tue, 22 Jun 2021 14:40:33 +0100 Subject: [PATCH 3/6] opt in spelling --- compiler/src/cli/cli.ts | 5 +++++ compiler/src/processors.ts | 12 +++++++++--- compiler/src/types.ts | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/compiler/src/cli/cli.ts b/compiler/src/cli/cli.ts index c40c42ac..83d6801c 100644 --- a/compiler/src/cli/cli.ts +++ b/compiler/src/cli/cli.ts @@ -36,6 +36,10 @@ const { argv } = yargs(process.argv.slice(2)) .option('noCache', { type: 'boolean', description: 'No cache', + }) + .option('spelling', { + type: 'boolean', + description: 'Check spelling', }); const dirPath = String(argv._[0] || '.'); @@ -49,6 +53,7 @@ const options = { noReport: argv.noReport, noEmbedAssets: argv.noEmbedAssets, noCache: argv.noCache, + spelling: argv.spelling, }; rMarkdown(dirPath, options); diff --git a/compiler/src/processors.ts b/compiler/src/processors.ts index 032a54b7..fc7ceb36 100644 --- a/compiler/src/processors.ts +++ b/compiler/src/processors.ts @@ -73,14 +73,20 @@ export async function customTransforms( } export async function linter(mdast: Node, ctx: Context, file: VFile) { - const retextProcessor = unified().use(english).use(spell, dictionary); const processor = unified() .use(assertTaskAnswerStructure) .use(assertWeblinkTarget) .use(lintLatex) .use(lintAltText) - .use(lintLinkText) - .use(remark2retext, retextProcessor); + .use(lintLinkText); + + if (ctx.options.spelling) { + const retextProcessor = unified() + .use(english) + .use(spell, { dictionary, max: 1 }); + + processor.use(remark2retext, retextProcessor); + } return processor.run(mdast, file); } diff --git a/compiler/src/types.ts b/compiler/src/types.ts index 650590d0..7cb76e3c 100644 --- a/compiler/src/types.ts +++ b/compiler/src/types.ts @@ -11,6 +11,7 @@ export type Options = { week?: number; watch?: boolean; shouldFail?: boolean; + spelling?: boolean; }; export type Context = { From e576850df42148e5d0ba80676a4887f82772c685 Mon Sep 17 00:00:00 2001 From: Dave Star Date: Tue, 22 Jun 2021 14:41:37 +0100 Subject: [PATCH 4/6] fix caching errors --- compiler/src/utils/cache-to-file.ts | 38 ++++++++++++++++++++--------- compiler/src/utils/report.ts | 5 +++- fixtures/apm/course.yaml | 18 +++++++------- 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/compiler/src/utils/cache-to-file.ts b/compiler/src/utils/cache-to-file.ts index 43db8908..32b44250 100644 --- a/compiler/src/utils/cache-to-file.ts +++ b/compiler/src/utils/cache-to-file.ts @@ -13,13 +13,9 @@ type Options = { json?: boolean; }; -export async function cacheToFile({ - ctx, - prefix, - key, - execFn, - json, -}: Options) { +export async function cacheToFile(options: Options) { + const { ctx, prefix, key, execFn, json } = options; + if (ctx.options.noCache === true) { return execFn(key); } @@ -27,18 +23,36 @@ export async function cacheToFile({ const filePath = `${prefix}-${hashSum(key)}.txt`; const cachedFilePath = path.join(ctx.cacheDir, filePath); const exists = await checkLocalFileExists(cachedFilePath); + if (exists) { const str = await readFile(cachedFilePath); - return json ? JSON.parse(str) : str; + + // auto-heal corrupt json + if (json) { + try { + return JSON.parse(str); + } catch (err) { + return execAndCache(options, cachedFilePath); + } + } + + return str; } + return execAndCache(options, cachedFilePath); +} + +export async function cacheJsonToFile(options: Options) { + return cacheToFile({ ...options, json: true }); +} + +async function execAndCache( + { ctx, key, execFn, json }: Options, + cachedFilePath: string +) { const out = await execFn(key); const str = json ? JSON.stringify(out, null, 2) : (out as string); await mkdir(ctx.cacheDir); await writeFile(cachedFilePath, str); return out; } - -export async function cacheJsonToFile(options: Options) { - return cacheToFile({ ...options, json: true }); -} diff --git a/compiler/src/utils/report.ts b/compiler/src/utils/report.ts index b475b185..98a1b458 100644 --- a/compiler/src/utils/report.ts +++ b/compiler/src/utils/report.ts @@ -55,10 +55,13 @@ function failingMessages(messages: VFileMessage[]) { } function printMessage(message: VFileMessage) { + // console.log(message); const status = message.status as MessageStatus; const position = chalk.grey(`${message.line}:${message.column}`); const reason = formatReason(message.reason, status); - console.log(`${formatStatus(status)} ${position} ${reason}`); + console.log( + `${formatStatus(status)} ${position} [${message.ruleId}] ${reason}` + ); } function getFilePath(filePath: string) { diff --git a/fixtures/apm/course.yaml b/fixtures/apm/course.yaml index 0a7acdb7..c9eedc65 100755 --- a/fixtures/apm/course.yaml +++ b/fixtures/apm/course.yaml @@ -8,13 +8,13 @@ academic_year: 2020-21 start_date: 3/05/2020 units: # - src: introcourse/introcourse.yaml - # - src: week1/week1.yaml + - src: week1/week1.yaml - src: week2/week2.yaml -# - src: week3/week3.yaml -# - src: week4/week4.yaml -# - src: week5/week5.yaml -# - src: week6/week6.yaml -# - src: week7/week7.yaml -# - src: week8/week8.yaml -# - src: week9/week9.yaml -# - src: week10/week10.yaml + - src: week3/week3.yaml + - src: week4/week4.yaml + - src: week5/week5.yaml + - src: week6/week6.yaml + - src: week7/week7.yaml + - src: week8/week8.yaml + - src: week9/week9.yaml + - src: week10/week10.yaml From 49fd5aabedeee353ded8387a9c93ffcbe0a70761 Mon Sep 17 00:00:00 2001 From: Dave Star Date: Tue, 22 Jun 2021 16:48:21 +0100 Subject: [PATCH 5/6] fix reporting --- compiler/src/index.ts | 46 ++-- compiler/src/processors.ts | 26 ++- compiler/src/test-utils/test-processor.ts | 4 +- .../{embed-asset-urls.ts => assets.ts} | 35 ++- .../src/transforms-mdast/youtube-videos.ts | 204 +++++++++--------- compiler/src/utils/report.ts | 4 +- fixtures/apm/week2/week2introGLM.Rmd | 18 -- 7 files changed, 181 insertions(+), 156 deletions(-) rename compiler/src/transforms-mdast/{embed-asset-urls.ts => assets.ts} (50%) diff --git a/compiler/src/index.ts b/compiler/src/index.ts index ec998385..20497a27 100644 --- a/compiler/src/index.ts +++ b/compiler/src/index.ts @@ -1,9 +1,9 @@ import chalk from 'chalk'; +import { codeMod } from './code-mod'; import { collectCoursework } from './course'; import { customCombinedTransforms, - customTransforms, htmlCompiler, linter, markdownParser, @@ -58,18 +58,22 @@ async function createUnit(ctx: Context, unitIdx: number) { export async function buildUnit(ctx: Context, unitIdx: number) { const { files } = ctx.course.units[unitIdx]; - const markdowns = await processKnitr(files, ctx); + // ////////// + // 1 codeMod + // ////////// - const mdasts = await Promise.all( - markdowns.map((file) => markdownParser(file, ctx)) - ); + files.forEach((file) => { + file.contents = codeMod(file.contents as string); + }); - // transforms in parallel with reports back to original files - await Promise.all( - mdasts.map((mdast, idx) => customTransforms(mdast, ctx, files[idx])) + // ////////// + // 2 static analysis + // ////////// + + const mdasts = await Promise.all( + files.map((file) => markdownParser(file, ctx)) ); - // linter in parallel await Promise.all( mdasts.map((mdast, idx) => linter(mdast, ctx, files[idx])) ); @@ -78,15 +82,29 @@ export async function buildUnit(ctx: Context, unitIdx: number) { printReport(files, ctx); } if (reportHasFatalErrors(files, ctx)) { - const options = { ...ctx.options, reportOnlyErrors: true }; - printReport(files, { ...ctx, options }); + if (ctx.options.noReport) { + const options = { ...ctx.options, reportOnlyErrors: true }; + printReport(files, { ...ctx, options }); + } return null; } - // combine mdast trees - const mdast = combineMdastTrees(mdasts); + // ////////// + // 3 knitr Rmarkdown -> markdown + // ////////// + + const markdowns = await processKnitr(files, ctx); + + // ////////// + // 4 markdown -> html + // ////////// + + const mdasts2 = await Promise.all( + markdowns.map((file) => markdownParser(file, ctx)) + ); + + const mdast = combineMdastTrees(mdasts2); - // transforms on the combined tree await customCombinedTransforms(mdast, ctx); const { hast, html } = await htmlCompiler(mdast, ctx, unitIdx); diff --git a/compiler/src/processors.ts b/compiler/src/processors.ts index fc7ceb36..d99c10af 100644 --- a/compiler/src/processors.ts +++ b/compiler/src/processors.ts @@ -30,20 +30,25 @@ import unified from 'unified'; import { Node } from 'unist'; import { VFile } from 'vfile'; -import { codeMod } from './code-mod'; import { assertTaskAnswerStructure } from './linters/assert-task-answer'; import { assertWeblinkTarget } from './linters/assert-weblink-target'; import { lintLatex } from './linters/lint-latex'; import { embedAssets } from './transforms-hast/embed-assets'; import { htmlWrapper } from './transforms-hast/html-wrapper'; import { accessibleTex } from './transforms-mdast/accessible-tex'; +import { + assertAssetExists, + embedAssetUrl, +} from './transforms-mdast/assets'; import { boxouts } from './transforms-mdast/boxouts'; import { codeBlocks } from './transforms-mdast/code-blocks'; -import { embedAssetUrl } from './transforms-mdast/embed-asset-urls'; import { images } from './transforms-mdast/images'; import { responsiveTables } from './transforms-mdast/responsive-tables'; // import { moveAnswersToEnd } from './transforms-mdast/move-answers-to-end'; -import { youtubeVideos } from './transforms-mdast/youtube-videos'; +import { + assertVideoAttributes, + youtubeVideos, +} from './transforms-mdast/youtube-videos'; import { Context } from './types'; import { createSvg } from './utils/icons'; import { readFile } from './utils/utils'; @@ -51,8 +56,6 @@ import { readFile } from './utils/utils'; // import { inspect } from './utils/utils'; export async function markdownParser(file: VFile, ctx: Context) { - file.contents = codeMod(file.contents as string); - const processor = unified() .use(markdown) .use(directive) @@ -63,17 +66,10 @@ export async function markdownParser(file: VFile, ctx: Context) { return processor.run(parsed, file); } -export async function customTransforms( - mdast: Node, - ctx: Context, - file: VFile -) { - const processor = unified().use(embedAssetUrl, ctx).use(youtubeVideos); - return processor.run(mdast, file); -} - export async function linter(mdast: Node, ctx: Context, file: VFile) { const processor = unified() + .use(assertAssetExists) + .use(assertVideoAttributes) .use(assertTaskAnswerStructure) .use(assertWeblinkTarget) .use(lintLatex) @@ -99,6 +95,8 @@ export async function customCombinedTransforms(mdast: Node, ctx: Context) { content: linkIcon, linkProperties: { className: 'link' }, }) + .use(embedAssetUrl) + .use(youtubeVideos) .use(responsiveTables) .use(accessibleTex, ctx) .use(codeBlocks, ctx) diff --git a/compiler/src/test-utils/test-processor.ts b/compiler/src/test-utils/test-processor.ts index 54b51072..b5aa0364 100644 --- a/compiler/src/test-utils/test-processor.ts +++ b/compiler/src/test-utils/test-processor.ts @@ -25,9 +25,7 @@ export async function testProcessor(md: string, options: Options = {}) { await writeFile(filePath, unindentString(md)); - const file = toVFile({ - path: filePath, - }) as VFile; + const file = (await toVFile.read(filePath, 'utf-8')) as VFile; const course = { title: 'Test Course', diff --git a/compiler/src/transforms-mdast/embed-asset-urls.ts b/compiler/src/transforms-mdast/assets.ts similarity index 50% rename from compiler/src/transforms-mdast/embed-asset-urls.ts rename to compiler/src/transforms-mdast/assets.ts index 2faba212..cc0cceb6 100644 --- a/compiler/src/transforms-mdast/embed-asset-urls.ts +++ b/compiler/src/transforms-mdast/assets.ts @@ -4,22 +4,19 @@ import { Node } from 'unist'; import visit from 'unist-util-visit'; import { VFile } from 'vfile'; -import { Context } from '../types'; import { failMessage } from '../utils/message'; import { checkLocalFileExists } from '../utils/utils'; -export function embedAssetUrl(ctx: Context) { +export function assertAssetExists() { async function getAssetUrl(node: Node, file: VFile) { const url = (node.url || '') as string; if (!file.dirname) { throw new Error('VFile dirname undefined'); } - if (!url.startsWith('http') && !path.isAbsolute(url)) { - const fullPath = path.join(process.cwd(), file.dirname, url); + if (!url.startsWith('http')) { + const fullPath = getPath(url, file.dirname); const exists = await checkLocalFileExists(fullPath); - if (exists) { - node.url = fullPath; - } else { + if (!exists) { failMessage(file, `No asset found at ${fullPath}`, node.position); } } @@ -33,3 +30,27 @@ export function embedAssetUrl(ctx: Context) { await Promise.all(transformations); }; } + +export function embedAssetUrl() { + async function getAssetUrl(node: Node, file: VFile) { + const url = (node.url || '') as string; + const dirname = (file.dirname || '') as string; + if (!url.startsWith('http')) { + node.url = getPath(url, dirname); + } + } + + return async (tree: Node, file: VFile) => { + const transformations: Promise[] = []; + visit(tree, 'image', (node) => { + transformations.push(getAssetUrl(node, file)); + }); + await Promise.all(transformations); + }; +} + +function getPath(url: string, dirname: string) { + return path.isAbsolute(url) + ? url + : path.join(process.cwd(), dirname, url); +} diff --git a/compiler/src/transforms-mdast/youtube-videos.ts b/compiler/src/transforms-mdast/youtube-videos.ts index 2bb6990b..e36463b2 100644 --- a/compiler/src/transforms-mdast/youtube-videos.ts +++ b/compiler/src/transforms-mdast/youtube-videos.ts @@ -4,116 +4,126 @@ import { VFile } from 'vfile'; import { failMessage } from '../utils/message'; -export function youtubeVideos() { +export function assertVideoAttributes() { return async (tree: Node, file: VFile) => { visit(tree, 'leafDirective', (node) => { if (node.name === 'video') { - template(node, file); + const attributes = node.attributes as Record; + if (!attributes.id) { + failMessage(file, 'id attribute is required', node.position); + } + if (!attributes.duration) { + failMessage( + file, + 'duration attribute is required', + node.position + ); + } + + const title = getTitle(node); + if (!title) { + failMessage(file, 'title is required', node.position); + } } }); }; } -function template(node: Node, file: VFile) { - const attributes = node.attributes as Record; - if (!attributes.id) { - failMessage(file, 'id attribute is required', node.position); - } - if (!attributes.duration) { - failMessage(file, 'duration attribute is required', node.position); - } - - const title = getTitle(node); - if (!title) { - failMessage(file, 'title is required', node.position); - } - - node.data = { - hName: 'a', - hProperties: { - className: ['boxout', 'video'], - href: getYoutubeUrl(attributes.id), - title: attributes.title || null, - target: '_blank', - }, - hChildren: [ - { - type: 'element', - tagName: 'span', - properties: { - className: 'content', - }, - children: [ - { - type: 'element', - tagName: 'span', - properties: { - className: 'type', - }, - children: [ - { - type: 'text', - value: 'Video', - }, - ], +export function youtubeVideos() { + return async (tree: Node, file: VFile) => { + visit(tree, 'leafDirective', (node) => { + if (node.name === 'video') { + const attributes = node.attributes as Record; + const title = getTitle(node); + node.data = { + hName: 'a', + hProperties: { + className: ['boxout', 'video'], + href: getYoutubeUrl(attributes.id), + title: attributes.title || null, + target: '_blank', }, - { - type: 'element', - tagName: 'span', - properties: { - className: 'title', - }, - children: [ - { - type: 'text', - value: title, + hChildren: [ + { + type: 'element', + tagName: 'span', + properties: { + className: 'content', }, - ], - }, - { - type: 'element', - tagName: 'span', - properties: { - className: 'duration', - }, - children: [ - { - type: 'element', - tagName: 'strong', - children: [ - { - type: 'text', - value: 'Duration', + children: [ + { + type: 'element', + tagName: 'span', + properties: { + className: 'type', }, - ], - }, - { - type: 'text', - value: formatDuration(attributes.duration), + children: [ + { + type: 'text', + value: 'Video', + }, + ], + }, + { + type: 'element', + tagName: 'span', + properties: { + className: 'title', + }, + children: [ + { + type: 'text', + value: title, + }, + ], + }, + { + type: 'element', + tagName: 'span', + properties: { + className: 'duration', + }, + children: [ + { + type: 'element', + tagName: 'strong', + children: [ + { + type: 'text', + value: 'Duration', + }, + ], + }, + { + type: 'text', + value: formatDuration(attributes.duration), + }, + ], + }, + ], + }, + { + type: 'element', + tagName: 'span', + properties: { + className: 'thumbnail', }, - ], - }, - ], - }, - { - type: 'element', - tagName: 'span', - properties: { - className: 'thumbnail', - }, - children: [ - { - type: 'element', - tagName: 'img', - properties: { - src: getYoutubeThumbnailUrl(attributes.id), - alt: '', + children: [ + { + type: 'element', + tagName: 'img', + properties: { + src: getYoutubeThumbnailUrl(attributes.id), + alt: '', + }, + children: [], + }, + ], }, - children: [], - }, - ], - }, - ], + ], + }; + } + }); }; } diff --git a/compiler/src/utils/report.ts b/compiler/src/utils/report.ts index 98a1b458..85e2ba01 100644 --- a/compiler/src/utils/report.ts +++ b/compiler/src/utils/report.ts @@ -59,9 +59,7 @@ function printMessage(message: VFileMessage) { const status = message.status as MessageStatus; const position = chalk.grey(`${message.line}:${message.column}`); const reason = formatReason(message.reason, status); - console.log( - `${formatStatus(status)} ${position} [${message.ruleId}] ${reason}` - ); + console.log(`${formatStatus(status)} ${position} ${reason}`); } function getFilePath(filePath: string) { diff --git a/fixtures/apm/week2/week2introGLM.Rmd b/fixtures/apm/week2/week2introGLM.Rmd index b63386ce..2b8d9442 100644 --- a/fixtures/apm/week2/week2introGLM.Rmd +++ b/fixtures/apm/week2/week2introGLM.Rmd @@ -110,24 +110,6 @@ Using the fitted model equation, predict the gross revenue for a film with a bud *Hint: Remember that the variables have been log-transformed.* -####[answer] -For the *Bollywood box office revenue* example, we can write down the fitted model equation from the `summary(bol.lm)`: -$$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(\text{Budget})$$ - -We can use this equation to predict the gross revenue of a film by simply substituting the relevant budget value, and transforming the result from the log10 scale. Thus: - -(i) budget = 10: - $$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(10) = 0.69406 \Rightarrow \text{Gross}= 10^{0.69406} = 4.94379$$ - - -(ii) budget = 50: - $$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(50) = 1.616386 \Rightarrow \text{Gross}= 10^{1.616386} = 41.34148$$ - - -(iii) budget = 100: - $$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(100) = 2.01361 \Rightarrow \text{Gross}= 10^{2.01361} = 103.1834$$ - -####[/answer] ###[/task] From 12653aced7d74b1415c50ac85e39f62024865f3e Mon Sep 17 00:00:00 2001 From: Dave Star Date: Wed, 23 Jun 2021 15:40:01 +0100 Subject: [PATCH 6/6] refine template and dev environment --- .../html-wrapper/view-options/readability.ts | 10 +- compiler/src/index.ts | 26 +++-- compiler/src/linters/assert-asset-exists.ts | 29 +++++ .../src/linters/assert-video-attributes.ts | 36 ++++++ compiler/src/processors.ts | 16 +-- compiler/src/transforms-mdast/assets.ts | 56 --------- .../src/transforms-mdast/embed-asset-url.ts | 30 +++++ .../src/transforms-mdast/youtube-videos.ts | 27 ----- dev.ts | 22 ++-- fixtures/apm/week2/week2introGLM.Rmd | 18 +++ template/src/styles/structure.scss | 2 - template/src/styles/tables.scss | 1 + template/src/styles/typography.scss | 13 ++- template/src/view-options/readability.ts | 107 ++++++++++-------- template/src/view-options/util.ts | 2 +- 15 files changed, 222 insertions(+), 173 deletions(-) create mode 100644 compiler/src/linters/assert-asset-exists.ts create mode 100644 compiler/src/linters/assert-video-attributes.ts delete mode 100644 compiler/src/transforms-mdast/assets.ts create mode 100644 compiler/src/transforms-mdast/embed-asset-url.ts diff --git a/compiler/src/html-wrapper/view-options/readability.ts b/compiler/src/html-wrapper/view-options/readability.ts index 36a304e0..254ab5d8 100644 --- a/compiler/src/html-wrapper/view-options/readability.ts +++ b/compiler/src/html-wrapper/view-options/readability.ts @@ -24,16 +24,16 @@ const options: ReadabilityItem[] = [ { value: 'letterSpacing', label: 'Letter spacing', - min: 0.6, - max: 2, - increment: 0.1, + min: -0.1, + max: 0.2, + increment: 0.05, }, { value: 'lineWidth', label: 'Line width', min: 0.6, - max: 2, - increment: 0.1, + max: 1.2, + increment: 0.05, }, ]; diff --git a/compiler/src/index.ts b/compiler/src/index.ts index 20497a27..c64fc715 100644 --- a/compiler/src/index.ts +++ b/compiler/src/index.ts @@ -58,17 +58,17 @@ async function createUnit(ctx: Context, unitIdx: number) { export async function buildUnit(ctx: Context, unitIdx: number) { const { files } = ctx.course.units[unitIdx]; - // ////////// - // 1 codeMod - // ////////// + //////////// + // 1 code mod - rewrite old syntax to new syntax with regex + //////////// files.forEach((file) => { file.contents = codeMod(file.contents as string); }); - // ////////// + //////////// // 2 static analysis - // ////////// + //////////// const mdasts = await Promise.all( files.map((file) => markdownParser(file, ctx)) @@ -89,15 +89,21 @@ export async function buildUnit(ctx: Context, unitIdx: number) { return null; } - // ////////// - // 3 knitr Rmarkdown -> markdown - // ////////// + //////////// + // 3 knitr: Rmarkdown -> markdown + //////////// + // needs to re-read original files for easy + // compatibility with Windows Command Prompt const markdowns = await processKnitr(files, ctx); - // ////////// + files.forEach((file) => { + file.contents = codeMod(file.contents as string); + }); + + //////////// // 4 markdown -> html - // ////////// + //////////// const mdasts2 = await Promise.all( markdowns.map((file) => markdownParser(file, ctx)) diff --git a/compiler/src/linters/assert-asset-exists.ts b/compiler/src/linters/assert-asset-exists.ts new file mode 100644 index 00000000..2ea8223d --- /dev/null +++ b/compiler/src/linters/assert-asset-exists.ts @@ -0,0 +1,29 @@ +import { Node } from 'unist'; +import visit from 'unist-util-visit'; +import { VFile } from 'vfile'; + +import { failMessage } from '../utils/message'; +import { checkLocalFileExists } from '../utils/utils'; + +export function assertAssetExists() { + async function getAssetUrl(node: Node, file: VFile) { + const url = (node.url || '') as string; + if (!file.dirname) { + throw new Error('VFile dirname undefined'); + } + if (!url.startsWith('http')) { + const exists = await checkLocalFileExists(url); + if (!exists) { + failMessage(file, `No asset found at ${url}`, node.position); + } + } + } + + return async (tree: Node, file: VFile) => { + const transformations: Promise[] = []; + visit(tree, 'image', (node) => { + transformations.push(getAssetUrl(node, file)); + }); + await Promise.all(transformations); + }; +} diff --git a/compiler/src/linters/assert-video-attributes.ts b/compiler/src/linters/assert-video-attributes.ts new file mode 100644 index 00000000..745e0967 --- /dev/null +++ b/compiler/src/linters/assert-video-attributes.ts @@ -0,0 +1,36 @@ +import { Node } from 'unist'; +import visit from 'unist-util-visit'; +import { VFile } from 'vfile'; + +import { failMessage } from '../utils/message'; + +export function assertVideoAttributes() { + return async (tree: Node, file: VFile) => { + visit(tree, 'leafDirective', (node) => { + if (node.name === 'video') { + const attributes = node.attributes as Record; + if (!attributes.id) { + failMessage(file, 'id attribute is required', node.position); + } + if (!attributes.duration) { + failMessage( + file, + 'duration attribute is required', + node.position + ); + } + + const title = getTitle(node); + if (!title) { + failMessage(file, 'title is required', node.position); + } + } + }); + }; +} + +function getTitle(node: Node) { + const children = node.children as Node[]; + const firstChild = children[0]; + return firstChild.value as string; +} diff --git a/compiler/src/processors.ts b/compiler/src/processors.ts index d99c10af..0acf48e3 100644 --- a/compiler/src/processors.ts +++ b/compiler/src/processors.ts @@ -30,25 +30,21 @@ import unified from 'unified'; import { Node } from 'unist'; import { VFile } from 'vfile'; +import { assertAssetExists } from './linters/assert-asset-exists'; import { assertTaskAnswerStructure } from './linters/assert-task-answer'; +import { assertVideoAttributes } from './linters/assert-video-attributes'; import { assertWeblinkTarget } from './linters/assert-weblink-target'; import { lintLatex } from './linters/lint-latex'; import { embedAssets } from './transforms-hast/embed-assets'; import { htmlWrapper } from './transforms-hast/html-wrapper'; import { accessibleTex } from './transforms-mdast/accessible-tex'; -import { - assertAssetExists, - embedAssetUrl, -} from './transforms-mdast/assets'; import { boxouts } from './transforms-mdast/boxouts'; import { codeBlocks } from './transforms-mdast/code-blocks'; +import { embedAssetUrl } from './transforms-mdast/embed-asset-url'; import { images } from './transforms-mdast/images'; import { responsiveTables } from './transforms-mdast/responsive-tables'; // import { moveAnswersToEnd } from './transforms-mdast/move-answers-to-end'; -import { - assertVideoAttributes, - youtubeVideos, -} from './transforms-mdast/youtube-videos'; +import { youtubeVideos } from './transforms-mdast/youtube-videos'; import { Context } from './types'; import { createSvg } from './utils/icons'; import { readFile } from './utils/utils'; @@ -61,7 +57,8 @@ export async function markdownParser(file: VFile, ctx: Context) { .use(directive) .use(math) .use(gfm) - .use(frontmatter); + .use(frontmatter) + .use(embedAssetUrl); const parsed = processor.parse(file); return processor.run(parsed, file); } @@ -95,7 +92,6 @@ export async function customCombinedTransforms(mdast: Node, ctx: Context) { content: linkIcon, linkProperties: { className: 'link' }, }) - .use(embedAssetUrl) .use(youtubeVideos) .use(responsiveTables) .use(accessibleTex, ctx) diff --git a/compiler/src/transforms-mdast/assets.ts b/compiler/src/transforms-mdast/assets.ts deleted file mode 100644 index cc0cceb6..00000000 --- a/compiler/src/transforms-mdast/assets.ts +++ /dev/null @@ -1,56 +0,0 @@ -import path from 'path'; - -import { Node } from 'unist'; -import visit from 'unist-util-visit'; -import { VFile } from 'vfile'; - -import { failMessage } from '../utils/message'; -import { checkLocalFileExists } from '../utils/utils'; - -export function assertAssetExists() { - async function getAssetUrl(node: Node, file: VFile) { - const url = (node.url || '') as string; - if (!file.dirname) { - throw new Error('VFile dirname undefined'); - } - if (!url.startsWith('http')) { - const fullPath = getPath(url, file.dirname); - const exists = await checkLocalFileExists(fullPath); - if (!exists) { - failMessage(file, `No asset found at ${fullPath}`, node.position); - } - } - } - - return async (tree: Node, file: VFile) => { - const transformations: Promise[] = []; - visit(tree, 'image', (node) => { - transformations.push(getAssetUrl(node, file)); - }); - await Promise.all(transformations); - }; -} - -export function embedAssetUrl() { - async function getAssetUrl(node: Node, file: VFile) { - const url = (node.url || '') as string; - const dirname = (file.dirname || '') as string; - if (!url.startsWith('http')) { - node.url = getPath(url, dirname); - } - } - - return async (tree: Node, file: VFile) => { - const transformations: Promise[] = []; - visit(tree, 'image', (node) => { - transformations.push(getAssetUrl(node, file)); - }); - await Promise.all(transformations); - }; -} - -function getPath(url: string, dirname: string) { - return path.isAbsolute(url) - ? url - : path.join(process.cwd(), dirname, url); -} diff --git a/compiler/src/transforms-mdast/embed-asset-url.ts b/compiler/src/transforms-mdast/embed-asset-url.ts new file mode 100644 index 00000000..4572a755 --- /dev/null +++ b/compiler/src/transforms-mdast/embed-asset-url.ts @@ -0,0 +1,30 @@ +import path from 'path'; + +import { Node } from 'unist'; +import visit from 'unist-util-visit'; +import { VFile } from 'vfile'; + +export function embedAssetUrl() { + async function getAssetUrl(node: Node, file: VFile) { + const url = (node.url || '') as string; + const dirname = (file.dirname || '') as string; + if (!url.startsWith('http')) { + const newUrl = getPath(url, dirname); + node.url = newUrl; + } + } + + return async (tree: Node, file: VFile) => { + const transformations: Promise[] = []; + visit(tree, 'image', (node) => { + transformations.push(getAssetUrl(node, file)); + }); + await Promise.all(transformations); + }; +} + +function getPath(url: string, dirname: string) { + return path.isAbsolute(url) + ? url + : path.join(process.cwd(), dirname, url); +} diff --git a/compiler/src/transforms-mdast/youtube-videos.ts b/compiler/src/transforms-mdast/youtube-videos.ts index e36463b2..88db0230 100644 --- a/compiler/src/transforms-mdast/youtube-videos.ts +++ b/compiler/src/transforms-mdast/youtube-videos.ts @@ -2,33 +2,6 @@ import { Node } from 'unist'; import visit from 'unist-util-visit'; import { VFile } from 'vfile'; -import { failMessage } from '../utils/message'; - -export function assertVideoAttributes() { - return async (tree: Node, file: VFile) => { - visit(tree, 'leafDirective', (node) => { - if (node.name === 'video') { - const attributes = node.attributes as Record; - if (!attributes.id) { - failMessage(file, 'id attribute is required', node.position); - } - if (!attributes.duration) { - failMessage( - file, - 'duration attribute is required', - node.position - ); - } - - const title = getTitle(node); - if (!title) { - failMessage(file, 'title is required', node.position); - } - } - }); - }; -} - export function youtubeVideos() { return async (tree: Node, file: VFile) => { visit(tree, 'leafDirective', (node) => { diff --git a/dev.ts b/dev.ts index 102f1880..06233f60 100644 --- a/dev.ts +++ b/dev.ts @@ -4,23 +4,17 @@ import chokidar from 'chokidar'; import { debounce } from 'lodash'; const COURSE = 'rprog'; -const UNIT = 'week1'; - -const watcherOptions = { - ignoreInitial: true, -}; - -rebuildAndRecompile(); chokidar - .watch( - ['./compiler/src', './compiler/assets', './compiler/knitr.R'], - watcherOptions - ) + .watch(['./compiler/src', './compiler/assets']) .on('all', debounce(rebuildAndRecompile, 300)); chokidar - .watch(`./fixtures/${COURSE}/${UNIT}`, watcherOptions) + .watch(`./fixtures/${COURSE}`, { + ignoreInitial: true, + ignored: (filePath: string) => + !filePath.includes('/build/') && !filePath.includes('/cache/'), + }) .on('all', debounce(recompile, 300)); async function rebuildAndRecompile() { @@ -40,7 +34,7 @@ async function rebuildCompiler() { } async function recompile(eventName?: string, path?: string) { - console.log({ eventName, path }); + // console.log({ eventName, path }); console.log('recompiling...'); const timerName = 'compiling took'; console.time(timerName); @@ -48,7 +42,7 @@ async function recompile(eventName?: string, path?: string) { // TODO: watch single unit try { await runCommand( - `yarn rmarkdown fixtures/${COURSE} --week=1 --noCache --noReport --noDoc` + `yarn rmarkdown fixtures/${COURSE} --week=1 --noReport --noDoc` ); } finally { console.timeEnd(timerName); diff --git a/fixtures/apm/week2/week2introGLM.Rmd b/fixtures/apm/week2/week2introGLM.Rmd index 2b8d9442..b63386ce 100644 --- a/fixtures/apm/week2/week2introGLM.Rmd +++ b/fixtures/apm/week2/week2introGLM.Rmd @@ -110,6 +110,24 @@ Using the fitted model equation, predict the gross revenue for a film with a bud *Hint: Remember that the variables have been log-transformed.* +####[answer] +For the *Bollywood box office revenue* example, we can write down the fitted model equation from the `summary(bol.lm)`: +$$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(\text{Budget})$$ + +We can use this equation to predict the gross revenue of a film by simply substituting the relevant budget value, and transforming the result from the log10 scale. Thus: + +(i) budget = 10: + $$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(10) = 0.69406 \Rightarrow \text{Gross}= 10^{0.69406} = 4.94379$$ + + +(ii) budget = 50: + $$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(50) = 1.616386 \Rightarrow \text{Gross}= 10^{1.616386} = 41.34148$$ + + +(iii) budget = 100: + $$\log10(\text{Gross}) =-0.62549 + 1.31955\times \log10(100) = 2.01361 \Rightarrow \text{Gross}= 10^{2.01361} = 103.1834$$ + +####[/answer] ###[/task] diff --git a/template/src/styles/structure.scss b/template/src/styles/structure.scss index 1e9ae51a..597266d4 100644 --- a/template/src/styles/structure.scss +++ b/template/src/styles/structure.scss @@ -73,8 +73,6 @@ main { } & > .wrapper { - width: 88%; - max-width: 1200px; margin: 0 auto; } } diff --git a/template/src/styles/tables.scss b/template/src/styles/tables.scss index 9b769138..6d05eeae 100644 --- a/template/src/styles/tables.scss +++ b/template/src/styles/tables.scss @@ -21,6 +21,7 @@ table { border: 2px solid var(--boxoutHighlightColor); padding: 0.5rem 2rem 0.5rem 1rem; text-align: left; + vertical-align: top; } td { color: var(--boxoutFadedTextColor); diff --git a/template/src/styles/typography.scss b/template/src/styles/typography.scss index e18e9509..beea1027 100644 --- a/template/src/styles/typography.scss +++ b/template/src/styles/typography.scss @@ -6,8 +6,8 @@ // ------------------------ html { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, - 'Helvetica Neue', sans-serif; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, + Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif; font-size: 14px; font-weight: 400; line-height: 1.75; @@ -35,9 +35,16 @@ html { } } +// readability main { font-size: calc(1rem * var(--fontSize)); - // transition: font-size 0.2s; + line-height: calc(1.75 * var(--lineSpacing)); + letter-spacing: calc(var(--letterSpacing) * 1em); + & > .wrapper { + width: calc(88% * var(--lineWidth)); + max-width: 1200px; + margin: 0 auto; + } } // ------------------------ diff --git a/template/src/view-options/readability.ts b/template/src/view-options/readability.ts index 966d69f8..0e8ad938 100644 --- a/template/src/view-options/readability.ts +++ b/template/src/view-options/readability.ts @@ -1,8 +1,14 @@ import { State, defaultState, saveState, state } from './util'; document.documentElement.style.setProperty('--fontSize', state.fontSize); -document.documentElement.style.setProperty('--lineSpacing', state.lineSpacing); -document.documentElement.style.setProperty('--letterSpacing', state.letterSpacing); +document.documentElement.style.setProperty( + '--lineSpacing', + state.lineSpacing +); +document.documentElement.style.setProperty( + '--letterSpacing', + state.letterSpacing +); document.documentElement.style.setProperty('--lineWidth', state.lineWidth); document.querySelectorAll('#readability .btn.minus').forEach((elem) => { @@ -14,105 +20,116 @@ document.querySelectorAll('#readability .btn.plus').forEach((elem) => { document.querySelectorAll('#readability .btn.reset').forEach((elem) => { elem.addEventListener('click', handleReset); - const { currentValue, defaultValue } = getProps(elem); + const { currentValue, defaultValue } = getProps(elem as HTMLElement); if (currentValue === Number(defaultValue)) { elem.classList.add('disabled'); } }); function handleMinus(e: Event) { - const target = e.target as Element; + const target = e.target as HTMLElement; if (target.classList.contains('disabled')) { return; } const props = getProps(target); - const newValue = Math.max(props.min, props.currentValue - props.increment); - if (newValue === props.min) { - target.classList.add('disabled'); - } else { - target.classList.remove('disabled'); - } + const newValue = Math.max( + props.min, + props.currentValue - props.increment + ); - const strValue = String(newValue); - if (strValue === props.defaultValue) { - props.reset.classList.add('disabled'); - } else { - props.reset.classList.remove('disabled'); - } + setDisabledClasses(newValue, props); + const strValue = String(newValue); document.documentElement.style.setProperty(`--${props.name}`, strValue); state[props.name] = strValue; saveState(state); } function handlePlus(e: Event) { - const target = e.target as Element; + const target = e.target as HTMLElement; if (target.classList.contains('disabled')) { return; } const props = getProps(target); - const newValue = Math.min(props.max, props.currentValue + props.increment); - if (newValue === props.max) { - target.classList.add('disabled'); - } else { - target.classList.remove('disabled'); - } + const newValue = Math.min( + props.max, + props.currentValue + props.increment + ); - const strValue = String(newValue); - if (strValue === defaultState[props.name]) { - props.reset.classList.add('disabled'); - } else { - props.reset.classList.remove('disabled'); - } + setDisabledClasses(newValue, props); + const strValue = String(newValue); document.documentElement.style.setProperty(`--${props.name}`, strValue); state[props.name] = strValue; saveState(state); } function handleReset(e: Event) { - const target = e.target as Element; + const target = e.target as HTMLElement; if (target.classList.contains('disabled')) { return; } const props = getProps(target); - const strValue = defaultState[props.name]; + setDisabledClasses(Number(props.defaultValue), props); + + target.classList.add('disabled'); + document.documentElement.style.setProperty( + `--${props.name}`, + props.defaultValue + ); + state[props.name] = props.defaultValue; + saveState(state); +} + +function setDisabledClasses(newValue: number, props: Props) { + const tolerance = 0.01; - if (props.defaultValue === String(props.min)) { + if (Math.abs(newValue - props.min) < tolerance) { props.minus.classList.add('disabled'); } else { props.minus.classList.remove('disabled'); } - if (props.defaultValue === String(props.max)) { + if (Math.abs(props.max - newValue) < tolerance) { props.plus.classList.add('disabled'); } else { props.plus.classList.remove('disabled'); } - target.classList.add('disabled'); - document.documentElement.style.setProperty(`--${props.name}`, strValue); - state[props.name] = String(strValue); - saveState(state); + if (Math.abs(Number(props.defaultValue) - newValue) < tolerance) { + props.reset.classList.add('disabled'); + } else { + props.reset.classList.remove('disabled'); + } } -function getProps(elem: Element) { - const li = elem.closest('li') as HTMLElement; - const plus = li.querySelector('.btn.plus') as HTMLElement; - const minus = li.querySelector('.btn.minus') as HTMLElement; - const reset = li.querySelector('.btn.reset') as HTMLElement; +type Props = { + li: HTMLLIElement; + name: keyof State; + plus: HTMLElement; + minus: HTMLElement; + reset: HTMLElement; + min: number; + max: number; + increment: number; + currentValue: number; + defaultValue: string; +}; + +function getProps(elem: HTMLElement): Props { + const li = elem.closest('li') as HTMLLIElement; const name = li.classList[0] as keyof State; return { li, name, - plus, - minus, - reset, + plus: li.querySelector('.btn.plus') as HTMLElement, + minus: li.querySelector('.btn.minus') as HTMLElement, + reset: li.querySelector('.btn.reset') as HTMLElement, min: Number(li.dataset.min), max: Number(li.dataset.max), increment: Number(li.dataset.increment), diff --git a/template/src/view-options/util.ts b/template/src/view-options/util.ts index def7249c..47c2c63a 100644 --- a/template/src/view-options/util.ts +++ b/template/src/view-options/util.ts @@ -12,7 +12,7 @@ export const defaultState: State = { font: 'font-default', fontSize: '1', lineSpacing: '1', - letterSpacing: '1', + letterSpacing: '0', lineWidth: '1', };