- * ^
- * |
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return effects.attempt(blankLine, ok, nok)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/code-fenced.js
-/**
- * @typedef {import('micromark-util-types').Code} Code
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-/** @type {Construct} */
-const nonLazyContinuation = {
- tokenize: tokenizeNonLazyContinuation,
- partial: true
-}
-
-/** @type {Construct} */
-const codeFenced = {
- name: 'codeFenced',
- tokenize: tokenizeCodeFenced,
- concrete: true
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeCodeFenced(effects, ok, nok) {
- const self = this
- /** @type {Construct} */
- const closeStart = {
- tokenize: tokenizeCloseStart,
- partial: true
- }
- let initialPrefix = 0
- let sizeOpen = 0
- /** @type {NonNullable
} */
- let marker
- return start
-
- /**
- * Start of code.
- *
- * ```markdown
- * > | ~~~js
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function start(code) {
- // To do: parse whitespace like `markdown-rs`.
- return beforeSequenceOpen(code)
- }
-
- /**
- * In opening fence, after prefix, at sequence.
- *
- * ```markdown
- * > | ~~~js
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function beforeSequenceOpen(code) {
- const tail = self.events[self.events.length - 1]
- initialPrefix =
- tail && tail[1].type === 'linePrefix'
- ? tail[2].sliceSerialize(tail[1], true).length
- : 0
- marker = code
- effects.enter('codeFenced')
- effects.enter('codeFencedFence')
- effects.enter('codeFencedFenceSequence')
- return sequenceOpen(code)
- }
-
- /**
- * In opening fence sequence.
- *
- * ```markdown
- * > | ~~~js
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function sequenceOpen(code) {
- if (code === marker) {
- sizeOpen++
- effects.consume(code)
- return sequenceOpen
- }
- if (sizeOpen < 3) {
- return nok(code)
- }
- effects.exit('codeFencedFenceSequence')
- return markdownSpace(code)
- ? factorySpace(effects, infoBefore, 'whitespace')(code)
- : infoBefore(code)
- }
-
- /**
- * In opening fence, after the sequence (and optional whitespace), before info.
- *
- * ```markdown
- * > | ~~~js
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function infoBefore(code) {
- if (code === null || markdownLineEnding(code)) {
- effects.exit('codeFencedFence')
- return self.interrupt
- ? ok(code)
- : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
- }
- effects.enter('codeFencedFenceInfo')
- effects.enter('chunkString', {
- contentType: 'string'
- })
- return info(code)
- }
-
- /**
- * In info.
- *
- * ```markdown
- * > | ~~~js
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function info(code) {
- if (code === null || markdownLineEnding(code)) {
- effects.exit('chunkString')
- effects.exit('codeFencedFenceInfo')
- return infoBefore(code)
- }
- if (markdownSpace(code)) {
- effects.exit('chunkString')
- effects.exit('codeFencedFenceInfo')
- return factorySpace(effects, metaBefore, 'whitespace')(code)
- }
- if (code === 96 && code === marker) {
- return nok(code)
- }
- effects.consume(code)
- return info
- }
-
- /**
- * In opening fence, after info and whitespace, before meta.
- *
- * ```markdown
- * > | ~~~js eval
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function metaBefore(code) {
- if (code === null || markdownLineEnding(code)) {
- return infoBefore(code)
- }
- effects.enter('codeFencedFenceMeta')
- effects.enter('chunkString', {
- contentType: 'string'
- })
- return meta(code)
- }
-
- /**
- * In meta.
- *
- * ```markdown
- * > | ~~~js eval
- * ^
- * | alert(1)
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function meta(code) {
- if (code === null || markdownLineEnding(code)) {
- effects.exit('chunkString')
- effects.exit('codeFencedFenceMeta')
- return infoBefore(code)
- }
- if (code === 96 && code === marker) {
- return nok(code)
- }
- effects.consume(code)
- return meta
- }
-
- /**
- * At eol/eof in code, before a non-lazy closing fence or content.
- *
- * ```markdown
- * > | ~~~js
- * ^
- * > | alert(1)
- * ^
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function atNonLazyBreak(code) {
- return effects.attempt(closeStart, after, contentBefore)(code)
- }
-
- /**
- * Before code content, not a closing fence, at eol.
- *
- * ```markdown
- * | ~~~js
- * > | alert(1)
- * ^
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function contentBefore(code) {
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return contentStart
- }
-
- /**
- * Before code content, not a closing fence.
- *
- * ```markdown
- * | ~~~js
- * > | alert(1)
- * ^
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function contentStart(code) {
- return initialPrefix > 0 && markdownSpace(code)
- ? factorySpace(
- effects,
- beforeContentChunk,
- 'linePrefix',
- initialPrefix + 1
- )(code)
- : beforeContentChunk(code)
- }
-
- /**
- * Before code content, after optional prefix.
- *
- * ```markdown
- * | ~~~js
- * > | alert(1)
- * ^
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function beforeContentChunk(code) {
- if (code === null || markdownLineEnding(code)) {
- return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
- }
- effects.enter('codeFlowValue')
- return contentChunk(code)
- }
-
- /**
- * In code content.
- *
- * ```markdown
- * | ~~~js
- * > | alert(1)
- * ^^^^^^^^
- * | ~~~
- * ```
- *
- * @type {State}
- */
- function contentChunk(code) {
- if (code === null || markdownLineEnding(code)) {
- effects.exit('codeFlowValue')
- return beforeContentChunk(code)
- }
- effects.consume(code)
- return contentChunk
- }
-
- /**
- * After code.
- *
- * ```markdown
- * | ~~~js
- * | alert(1)
- * > | ~~~
- * ^
- * ```
- *
- * @type {State}
- */
- function after(code) {
- effects.exit('codeFenced')
- return ok(code)
- }
-
- /**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
- function tokenizeCloseStart(effects, ok, nok) {
- let size = 0
- return startBefore
-
- /**
- *
- *
- * @type {State}
- */
- function startBefore(code) {
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return start
- }
-
- /**
- * Before closing fence, at optional whitespace.
- *
- * ```markdown
- * | ~~~js
- * | alert(1)
- * > | ~~~
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- // Always populated by defaults.
-
- // To do: `enter` here or in next state?
- effects.enter('codeFencedFence')
- return markdownSpace(code)
- ? factorySpace(
- effects,
- beforeSequenceClose,
- 'linePrefix',
- self.parser.constructs.disable.null.includes('codeIndented')
- ? undefined
- : 4
- )(code)
- : beforeSequenceClose(code)
- }
-
- /**
- * In closing fence, after optional whitespace, at sequence.
- *
- * ```markdown
- * | ~~~js
- * | alert(1)
- * > | ~~~
- * ^
- * ```
- *
- * @type {State}
- */
- function beforeSequenceClose(code) {
- if (code === marker) {
- effects.enter('codeFencedFenceSequence')
- return sequenceClose(code)
- }
- return nok(code)
- }
-
- /**
- * In closing fence sequence.
- *
- * ```markdown
- * | ~~~js
- * | alert(1)
- * > | ~~~
- * ^
- * ```
- *
- * @type {State}
- */
- function sequenceClose(code) {
- if (code === marker) {
- size++
- effects.consume(code)
- return sequenceClose
- }
- if (size >= sizeOpen) {
- effects.exit('codeFencedFenceSequence')
- return markdownSpace(code)
- ? factorySpace(effects, sequenceCloseAfter, 'whitespace')(code)
- : sequenceCloseAfter(code)
- }
- return nok(code)
- }
-
- /**
- * After closing fence sequence, after optional whitespace.
- *
- * ```markdown
- * | ~~~js
- * | alert(1)
- * > | ~~~
- * ^
- * ```
- *
- * @type {State}
- */
- function sequenceCloseAfter(code) {
- if (code === null || markdownLineEnding(code)) {
- effects.exit('codeFencedFence')
- return ok(code)
- }
- return nok(code)
- }
- }
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeNonLazyContinuation(effects, ok, nok) {
- const self = this
- return start
-
- /**
- *
- *
- * @type {State}
- */
- function start(code) {
- if (code === null) {
- return nok(code)
- }
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return lineStart
- }
-
- /**
- *
- *
- * @type {State}
- */
- function lineStart(code) {
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/character-entities/index.js
-/**
- * Map of named character references.
- *
- * @type {Record}
- */
-const characterEntities = {
- AElig: 'Æ',
- AMP: '&',
- Aacute: 'Á',
- Abreve: 'Ă',
- Acirc: 'Â',
- Acy: 'А',
- Afr: '𝔄',
- Agrave: 'À',
- Alpha: 'Α',
- Amacr: 'Ā',
- And: '⩓',
- Aogon: 'Ą',
- Aopf: '𝔸',
- ApplyFunction: '',
- Aring: 'Å',
- Ascr: '𝒜',
- Assign: '≔',
- Atilde: 'Ã',
- Auml: 'Ä',
- Backslash: '∖',
- Barv: '⫧',
- Barwed: '⌆',
- Bcy: 'Б',
- Because: '∵',
- Bernoullis: 'ℬ',
- Beta: 'Β',
- Bfr: '𝔅',
- Bopf: '𝔹',
- Breve: '˘',
- Bscr: 'ℬ',
- Bumpeq: '≎',
- CHcy: 'Ч',
- COPY: '©',
- Cacute: 'Ć',
- Cap: '⋒',
- CapitalDifferentialD: 'ⅅ',
- Cayleys: 'ℭ',
- Ccaron: 'Č',
- 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: 'Ŋ',
- ETH: 'Ð',
- Eacute: 'É',
- Ecaron: 'Ě',
- Ecirc: 'Ê',
- Ecy: 'Э',
- Edot: 'Ė',
- Efr: '𝔈',
- Egrave: 'È',
- Element: '∈',
- Emacr: 'Ē',
- EmptySmallSquare: '◻',
- EmptyVerySmallSquare: '▫',
- Eogon: 'Ę',
- Eopf: '𝔼',
- Epsilon: 'Ε',
- Equal: '⩵',
- EqualTilde: '≂',
- Equilibrium: '⇌',
- Escr: 'ℰ',
- Esim: '⩳',
- Eta: 'Η',
- Euml: 'Ë',
- Exists: '∃',
- ExponentialE: 'ⅇ',
- Fcy: 'Ф',
- Ffr: '𝔉',
- FilledSmallSquare: '◼',
- FilledVerySmallSquare: '▪',
- Fopf: '𝔽',
- ForAll: '∀',
- Fouriertrf: 'ℱ',
- Fscr: 'ℱ',
- GJcy: 'Ѓ',
- 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: 'Ё',
- Iacute: 'Í',
- Icirc: 'Î',
- Icy: 'И',
- Idot: 'İ',
- Ifr: 'ℑ',
- Igrave: 'Ì',
- Im: 'ℑ',
- Imacr: 'Ī',
- ImaginaryI: 'ⅈ',
- Implies: '⇒',
- Int: '∬',
- Integral: '∫',
- Intersection: '⋂',
- InvisibleComma: '',
- InvisibleTimes: '',
- Iogon: 'Į',
- Iopf: '𝕀',
- Iota: 'Ι',
- Iscr: 'ℐ',
- Itilde: 'Ĩ',
- Iukcy: 'І',
- Iuml: 'Ï',
- Jcirc: 'Ĵ',
- Jcy: 'Й',
- Jfr: '𝔍',
- Jopf: '𝕁',
- Jscr: '𝒥',
- Jsercy: 'Ј',
- Jukcy: 'Є',
- KHcy: 'Х',
- KJcy: 'Ќ',
- Kappa: 'Κ',
- Kcedil: 'Ķ',
- Kcy: 'К',
- Kfr: '𝔎',
- Kopf: '𝕂',
- Kscr: '𝒦',
- LJcy: 'Љ',
- 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: '𝒩',
- Ntilde: 'Ñ',
- Nu: 'Ν',
- OElig: 'Œ',
- Oacute: 'Ó',
- Ocirc: 'Ô',
- Ocy: 'О',
- Odblac: 'Ő',
- Ofr: '𝔒',
- Ograve: 'Ò',
- Omacr: 'Ō',
- Omega: 'Ω',
- Omicron: 'Ο',
- Oopf: '𝕆',
- OpenCurlyDoubleQuote: '“',
- OpenCurlyQuote: '‘',
- Or: '⩔',
- Oscr: '𝒪',
- Oslash: 'Ø',
- Otilde: 'Õ',
- Otimes: '⨷',
- Ouml: 'Ö',
- OverBar: '‾',
- OverBrace: '⏞',
- OverBracket: '⎴',
- OverParenthesis: '⏜',
- PartialD: '∂',
- Pcy: 'П',
- Pfr: '𝔓',
- Phi: 'Φ',
- Pi: 'Π',
- PlusMinus: '±',
- Poincareplane: 'ℌ',
- Popf: 'ℙ',
- Pr: '⪻',
- Precedes: '≺',
- PrecedesEqual: '⪯',
- PrecedesSlantEqual: '≼',
- PrecedesTilde: '≾',
- Prime: '″',
- Product: '∏',
- Proportion: '∷',
- Proportional: '∝',
- Pscr: '𝒫',
- Psi: 'Ψ',
- QUOT: '"',
- Qfr: '𝔔',
- Qopf: 'ℚ',
- Qscr: '𝒬',
- RBarr: '⤐',
- 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: '⋑',
- THORN: 'Þ',
- TRADE: '™',
- TSHcy: 'Ћ',
- TScy: 'Ц',
- Tab: '\t',
- Tau: 'Τ',
- Tcaron: 'Ť',
- Tcedil: 'Ţ',
- Tcy: 'Т',
- Tfr: '𝔗',
- Therefore: '∴',
- Theta: 'Θ',
- ThickSpace: ' ',
- ThinSpace: ' ',
- Tilde: '∼',
- TildeEqual: '≃',
- TildeFullEqual: '≅',
- TildeTilde: '≈',
- Topf: '𝕋',
- TripleDot: '⃛',
- Tscr: '𝒯',
- Tstrok: 'Ŧ',
- Uacute: 'Ú',
- Uarr: '↟',
- Uarrocir: '⥉',
- Ubrcy: 'Ў',
- Ubreve: 'Ŭ',
- Ucirc: 'Û',
- Ucy: 'У',
- Udblac: 'Ű',
- Ufr: '𝔘',
- 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: 'Ũ',
- 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: 'Ю',
- Yacute: 'Ý',
- Ycirc: 'Ŷ',
- Ycy: 'Ы',
- Yfr: '𝔜',
- Yopf: '𝕐',
- Yscr: '𝒴',
- Yuml: 'Ÿ',
- ZHcy: 'Ж',
- Zacute: 'Ź',
- Zcaron: 'Ž',
- Zcy: 'З',
- Zdot: 'Ż',
- ZeroWidthSpace: '',
- Zeta: 'Ζ',
- Zfr: 'ℨ',
- Zopf: 'ℤ',
- Zscr: '𝒵',
- aacute: 'á',
- abreve: 'ă',
- ac: '∾',
- acE: '∾̳',
- acd: '∿',
- acirc: 'â',
- acute: '´',
- acy: 'а',
- aelig: 'æ',
- af: '',
- afr: '𝔞',
- agrave: 'à',
- alefsym: 'ℵ',
- aleph: 'ℵ',
- alpha: 'α',
- amacr: 'ā',
- amalg: '⨿',
- 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: '≊',
- aring: 'å',
- ascr: '𝒶',
- ast: '*',
- asymp: '≈',
- asympeq: '≍',
- atilde: 'ã',
- 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: '˘',
- 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: 'č',
- ccedil: 'ç',
- ccirc: 'ĉ',
- ccups: '⩌',
- ccupssm: '⩐',
- cdot: 'ċ',
- cedil: '¸',
- cemptyv: '⦲',
- 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: '∐',
- 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: '⋏',
- curren: '¤',
- curvearrowleft: '↶',
- curvearrowright: '↷',
- cuvee: '⋎',
- cuwed: '⋏',
- cwconint: '∲',
- cwint: '∱',
- cylcty: '⌭',
- dArr: '⇓',
- dHar: '⥥',
- dagger: '†',
- daleth: 'ℸ',
- darr: '↓',
- dash: '‐',
- dashv: '⊣',
- dbkarow: '⤏',
- dblac: '˝',
- dcaron: 'ď',
- dcy: 'д',
- dd: 'ⅆ',
- ddagger: '‡',
- ddarr: '⇊',
- ddotseq: '⩷',
- deg: '°',
- delta: 'δ',
- demptyv: '⦱',
- dfisht: '⥿',
- dfr: '𝔡',
- dharl: '⇃',
- dharr: '⇂',
- diam: '⋄',
- diamond: '⋄',
- diamondsuit: '♦',
- diams: '♦',
- die: '¨',
- digamma: 'ϝ',
- disin: '⋲',
- div: '÷',
- 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: '≑',
- eacute: 'é',
- easter: '⩮',
- ecaron: 'ě',
- ecir: '≖',
- ecirc: 'ê',
- ecolon: '≕',
- ecy: 'э',
- edot: 'ė',
- ee: 'ⅇ',
- efDot: '≒',
- efr: '𝔢',
- eg: '⪚',
- 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: 'η',
- eth: 'ð',
- 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: '⨍',
- frac12: '½',
- frac13: '⅓',
- frac14: '¼',
- frac15: '⅕',
- frac16: '⅙',
- frac18: '⅛',
- frac23: '⅔',
- frac25: '⅖',
- 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: '⪐',
- 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: '‐',
- iacute: 'í',
- ic: '',
- icirc: 'î',
- icy: 'и',
- iecy: 'е',
- iexcl: '¡',
- iff: '⇔',
- ifr: '𝔦',
- 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: '⨼',
- iquest: '¿',
- iscr: '𝒾',
- isin: '∈',
- isinE: '⋹',
- isindot: '⋵',
- isins: '⋴',
- isinsv: '⋳',
- isinv: '∈',
- it: '',
- itilde: 'ĩ',
- iukcy: 'і',
- 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: '⪅',
- 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: 'ł',
- lt: '<',
- ltcc: '⪦',
- ltcir: '⩹',
- ltdot: '⋖',
- lthree: '⋋',
- ltimes: '⋉',
- ltlarr: '⥶',
- ltquest: '⩻',
- ltrPar: '⦖',
- ltri: '◃',
- ltrie: '⊴',
- ltrif: '◂',
- lurdshar: '⥊',
- luruhar: '⥦',
- lvertneqq: '≨︀',
- lvnE: '≨︀',
- mDDot: '∺',
- macr: '¯',
- male: '♂',
- malt: '✠',
- maltese: '✠',
- map: '↦',
- mapsto: '↦',
- mapstodown: '↧',
- mapstoleft: '↤',
- mapstoup: '↥',
- marker: '▮',
- mcomma: '⨩',
- mcy: 'м',
- mdash: '—',
- measuredangle: '∡',
- mfr: '𝔪',
- mho: '℧',
- micro: 'µ',
- mid: '∣',
- midast: '*',
- midcir: '⫰',
- 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: 'ℕ',
- 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: '𝕟',
- 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: '≹',
- 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: 'Ⓢ',
- oacute: 'ó',
- oast: '⊛',
- ocir: '⊚',
- ocirc: 'ô',
- ocy: 'о',
- odash: '⊝',
- odblac: 'ő',
- odiv: '⨸',
- odot: '⊙',
- odsold: '⦼',
- oelig: 'œ',
- ofcir: '⦿',
- ofr: '𝔬',
- ogon: '˛',
- 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: 'ℴ',
- oslash: 'ø',
- osol: '⊘',
- otilde: 'õ',
- otimes: '⊗',
- otimesas: '⨶',
- 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: '⩲',
- plusmn: '±',
- plussim: '⨦',
- plustwo: '⨧',
- pm: '±',
- pointint: '⨕',
- popf: '𝕡',
- 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: '≟',
- quot: '"',
- rAarr: '⇛',
- rArr: '⇒',
- rAtail: '⤜',
- rBarr: '⤏',
- rHar: '⥤',
- race: '∽̱',
- racute: 'ŕ',
- radic: '√',
- raemptyv: '⦳',
- rang: '⟩',
- rangd: '⦒',
- range: '⦥',
- rangle: '⟩',
- 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: '▭',
- 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: '↘',
- sect: '§',
- semi: ';',
- seswar: '⤩',
- setminus: '∖',
- setmn: '∖',
- sext: '✶',
- sfr: '𝔰',
- sfrown: '⌢',
- sharp: '♯',
- shchcy: 'щ',
- shcy: 'ш',
- shortmid: '∣',
- shortparallel: '∥',
- 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: '♪',
- sup1: '¹',
- sup2: '²',
- sup3: '³',
- sup: '⊃',
- 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: '⤪',
- szlig: 'ß',
- target: '⌖',
- tau: 'τ',
- tbrk: '⎴',
- tcaron: 'ť',
- tcedil: 'ţ',
- tcy: 'т',
- tdot: '⃛',
- telrec: '⌕',
- tfr: '𝔱',
- there4: '∴',
- therefore: '∴',
- theta: 'θ',
- thetasym: 'ϑ',
- thetav: 'ϑ',
- thickapprox: '≈',
- thicksim: '∼',
- thinsp: ' ',
- thkap: '≈',
- thksim: '∼',
- thorn: 'þ',
- tilde: '˜',
- 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: '⥣',
- uacute: 'ú',
- uarr: '↑',
- ubrcy: 'ў',
- ubreve: 'ŭ',
- ucirc: 'û',
- ucy: 'у',
- udarr: '⇅',
- udblac: 'ű',
- udhar: '⥮',
- ufisht: '⥾',
- ufr: '𝔲',
- ugrave: 'ù',
- uharl: '↿',
- uharr: '↾',
- uhblk: '▀',
- ulcorn: '⌜',
- ulcorner: '⌜',
- ulcrop: '⌏',
- ultri: '◸',
- umacr: 'ū',
- uml: '¨',
- uogon: 'ų',
- uopf: '𝕦',
- uparrow: '↑',
- updownarrow: '↕',
- upharpoonleft: '↿',
- upharpoonright: '↾',
- uplus: '⊎',
- upsi: 'υ',
- upsih: 'ϒ',
- upsilon: 'υ',
- upuparrows: '⇈',
- urcorn: '⌝',
- urcorner: '⌝',
- urcrop: '⌎',
- uring: 'ů',
- urtri: '◹',
- uscr: '𝓊',
- utdot: '⋰',
- utilde: 'ũ',
- utri: '▵',
- utrif: '▴',
- uuarr: '⇈',
- 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: '⋀',
- yacute: 'ý',
- yacy: 'я',
- ycirc: 'ŷ',
- ycy: 'ы',
- yen: '¥',
- yfr: '𝔶',
- yicy: 'ї',
- yopf: '𝕪',
- yscr: '𝓎',
- yucy: 'ю',
- yuml: 'ÿ',
- zacute: 'ź',
- zcaron: 'ž',
- zcy: 'з',
- zdot: 'ż',
- zeetrf: 'ℨ',
- zeta: 'ζ',
- zfr: '𝔷',
- zhcy: 'ж',
- zigrarr: '⇝',
- zopf: '𝕫',
- zscr: '𝓏',
- zwj: '',
- zwnj: ''
-}
-
-;// CONCATENATED MODULE: ./node_modules/decode-named-character-reference/index.js
-
-
-const own = {}.hasOwnProperty
-
-/**
- * Decode a single character reference (without the `&` or `;`).
- * You probably only need this when you’re building parsers yourself that follow
- * different rules compared to HTML.
- * This is optimized to be tiny in browsers.
- *
- * @param {string} value
- * `notin` (named), `#123` (deci), `#x123` (hexa).
- * @returns {string|false}
- * Decoded reference.
- */
-function decodeNamedCharacterReference(value) {
- return own.call(characterEntities, value) ? characterEntities[value] : false
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/character-reference.js
-/**
- * @typedef {import('micromark-util-types').Code} Code
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-/** @type {Construct} */
-const characterReference = {
- name: 'characterReference',
- tokenize: tokenizeCharacterReference
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeCharacterReference(effects, ok, nok) {
- const self = this
- let size = 0
- /** @type {number} */
- let max
- /** @type {(code: Code) => boolean} */
- let test
- return start
-
- /**
- * Start of character reference.
- *
- * ```markdown
- * > | a&b
- * ^
- * > | a{b
- * ^
- * > | a b
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('characterReference')
- effects.enter('characterReferenceMarker')
- effects.consume(code)
- effects.exit('characterReferenceMarker')
- return open
- }
-
- /**
- * After `&`, at `#` for numeric references or alphanumeric for named
- * references.
- *
- * ```markdown
- * > | a&b
- * ^
- * > | a{b
- * ^
- * > | a b
- * ^
- * ```
- *
- * @type {State}
- */
- 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)
- }
-
- /**
- * After `#`, at `x` for hexadecimals or digit for decimals.
- *
- * ```markdown
- * > | a{b
- * ^
- * > | a b
- * ^
- * ```
- *
- * @type {State}
- */
- 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)
- }
-
- /**
- * After markers (``, ``, or `&`), in value, before `;`.
- *
- * The character reference kind defines what and how many characters are
- * allowed.
- *
- * ```markdown
- * > | a&b
- * ^^^
- * > | a{b
- * ^^^
- * > | a b
- * ^
- * ```
- *
- * @type {State}
- */
- function value(code) {
- if (code === 59 && size) {
- const token = effects.exit('characterReferenceValue')
- if (
- test === asciiAlphanumeric &&
- !decodeNamedCharacterReference(self.sliceSerialize(token))
- ) {
- return nok(code)
- }
-
- // To do: `markdown-rs` uses a different name:
- // `CharacterReferenceMarkerSemi`.
- 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)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/character-escape.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-/** @type {Construct} */
-const characterEscape = {
- name: 'characterEscape',
- tokenize: tokenizeCharacterEscape
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeCharacterEscape(effects, ok, nok) {
- return start
-
- /**
- * Start of character escape.
- *
- * ```markdown
- * > | a\*b
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('characterEscape')
- effects.enter('escapeMarker')
- effects.consume(code)
- effects.exit('escapeMarker')
- return inside
- }
-
- /**
- * After `\`, at punctuation.
- *
- * ```markdown
- * > | a\*b
- * ^
- * ```
- *
- * @type {State}
- */
- function inside(code) {
- // ASCII punctuation.
- if (asciiPunctuation(code)) {
- effects.enter('characterEscapeValue')
- effects.consume(code)
- effects.exit('characterEscapeValue')
- effects.exit('characterEscape')
- return ok
- }
- return nok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/line-ending.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-/** @type {Construct} */
-const lineEnding = {
- name: 'lineEnding',
- tokenize: tokenizeLineEnding
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeLineEnding(effects, ok) {
- return start
-
- /** @type {State} */
- function start(code) {
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return factorySpace(effects, ok, 'linePrefix')
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/label-end.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').Event} Event
- * @typedef {import('micromark-util-types').Resolver} Resolver
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').Token} Token
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-
-
-
-
-
-
-/** @type {Construct} */
-const labelEnd = {
- name: 'labelEnd',
- tokenize: tokenizeLabelEnd,
- resolveTo: resolveToLabelEnd,
- resolveAll: resolveAllLabelEnd
-}
-
-/** @type {Construct} */
-const resourceConstruct = {
- tokenize: tokenizeResource
-}
-/** @type {Construct} */
-const referenceFullConstruct = {
- tokenize: tokenizeReferenceFull
-}
-/** @type {Construct} */
-const referenceCollapsedConstruct = {
- tokenize: tokenizeReferenceCollapsed
-}
-
-/** @type {Resolver} */
-function resolveAllLabelEnd(events) {
- let index = -1
- while (++index < events.length) {
- const token = events[index][1]
- if (
- 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
-}
-
-/** @type {Resolver} */
-function resolveToLabelEnd(events, context) {
- let index = events.length
- let offset = 0
- /** @type {Token} */
- let token
- /** @type {number | undefined} */
- let open
- /** @type {number | undefined} */
- let close
- /** @type {Array} */
- let 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
- }
- }
- const group = {
- type: events[open][1].type === 'labelLink' ? 'link' : 'image',
- start: Object.assign({}, events[open][1].start),
- end: Object.assign({}, events[events.length - 1][1].end)
- }
- const label = {
- type: 'label',
- start: Object.assign({}, events[open][1].start),
- end: Object.assign({}, events[close][1].end)
- }
- const text = {
- type: 'labelText',
- start: Object.assign({}, events[open + offset + 2][1].end),
- end: Object.assign({}, events[close - 2][1].start)
- }
- media = [
- ['enter', group, context],
- ['enter', label, context]
- ]
-
- // Opening marker.
- media = push(media, events.slice(open + 1, open + offset + 3))
-
- // Text open.
- media = push(media, [['enter', text, context]])
-
- // Always populated by defaults.
-
- // Between.
- media = push(
- media,
- resolveAll(
- context.parser.constructs.insideSpan.null,
- events.slice(open + offset + 4, close - 3),
- context
- )
- )
-
- // Text close, marker close, label close.
- media = push(media, [
- ['exit', text, context],
- events[close - 2],
- events[close - 1],
- ['exit', label, context]
- ])
-
- // Reference, resource, or so.
- media = push(media, events.slice(close + 1))
-
- // Media close.
- media = push(media, [['exit', group, context]])
- splice(events, open, events.length, media)
- return events
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeLabelEnd(effects, ok, nok) {
- const self = this
- let index = self.events.length
- /** @type {Token} */
- let labelStart
- /** @type {boolean} */
- let 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
-
- /**
- * Start of label end.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * > | [a][b] c
- * ^
- * > | [a][] b
- * ^
- * > | [a] b
- * ```
- *
- * @type {State}
- */
- function start(code) {
- // If there is not an okay opening.
- if (!labelStart) {
- return nok(code)
- }
-
- // If the corresponding label (link) start is marked as inactive,
- // it means we’d be wrapping a link, like this:
- //
- // ```markdown
- // > | a [b [c](d) e](f) g.
- // ^
- // ```
- //
- // We can’t have that, so it’s just balanced brackets.
- if (labelStart._inactive) {
- return labelEndNok(code)
- }
- defined = self.parser.defined.includes(
- normalizeIdentifier(
- self.sliceSerialize({
- start: labelStart.end,
- end: self.now()
- })
- )
- )
- effects.enter('labelEnd')
- effects.enter('labelMarker')
- effects.consume(code)
- effects.exit('labelMarker')
- effects.exit('labelEnd')
- return after
- }
-
- /**
- * After `]`.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * > | [a][b] c
- * ^
- * > | [a][] b
- * ^
- * > | [a] b
- * ^
- * ```
- *
- * @type {State}
- */
- function after(code) {
- // Note: `markdown-rs` also parses GFM footnotes here, which for us is in
- // an extension.
-
- // Resource (`[asd](fgh)`)?
- if (code === 40) {
- return effects.attempt(
- resourceConstruct,
- labelEndOk,
- defined ? labelEndOk : labelEndNok
- )(code)
- }
-
- // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?
- if (code === 91) {
- return effects.attempt(
- referenceFullConstruct,
- labelEndOk,
- defined ? referenceNotFull : labelEndNok
- )(code)
- }
-
- // Shortcut (`[asd]`) reference?
- return defined ? labelEndOk(code) : labelEndNok(code)
- }
-
- /**
- * After `]`, at `[`, but not at a full reference.
- *
- * > 👉 **Note**: we only get here if the label is defined.
- *
- * ```markdown
- * > | [a][] b
- * ^
- * > | [a] b
- * ^
- * ```
- *
- * @type {State}
- */
- function referenceNotFull(code) {
- return effects.attempt(
- referenceCollapsedConstruct,
- labelEndOk,
- labelEndNok
- )(code)
- }
-
- /**
- * Done, we found something.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * > | [a][b] c
- * ^
- * > | [a][] b
- * ^
- * > | [a] b
- * ^
- * ```
- *
- * @type {State}
- */
- function labelEndOk(code) {
- // Note: `markdown-rs` does a bunch of stuff here.
- return ok(code)
- }
-
- /**
- * Done, it’s nothing.
- *
- * There was an okay opening, but we didn’t match anything.
- *
- * ```markdown
- * > | [a](b c
- * ^
- * > | [a][b c
- * ^
- * > | [a] b
- * ^
- * ```
- *
- * @type {State}
- */
- function labelEndNok(code) {
- labelStart._balanced = true
- return nok(code)
- }
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeResource(effects, ok, nok) {
- return resourceStart
-
- /**
- * At a resource.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceStart(code) {
- effects.enter('resource')
- effects.enter('resourceMarker')
- effects.consume(code)
- effects.exit('resourceMarker')
- return resourceBefore
- }
-
- /**
- * In resource, after `(`, at optional whitespace.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceBefore(code) {
- return markdownLineEndingOrSpace(code)
- ? factoryWhitespace(effects, resourceOpen)(code)
- : resourceOpen(code)
- }
-
- /**
- * In resource, after optional whitespace, at `)` or a destination.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceOpen(code) {
- if (code === 41) {
- return resourceEnd(code)
- }
- return factoryDestination(
- effects,
- resourceDestinationAfter,
- resourceDestinationMissing,
- 'resourceDestination',
- 'resourceDestinationLiteral',
- 'resourceDestinationLiteralMarker',
- 'resourceDestinationRaw',
- 'resourceDestinationString',
- 32
- )(code)
- }
-
- /**
- * In resource, after destination, at optional whitespace.
- *
- * ```markdown
- * > | [a](b) c
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceDestinationAfter(code) {
- return markdownLineEndingOrSpace(code)
- ? factoryWhitespace(effects, resourceBetween)(code)
- : resourceEnd(code)
- }
-
- /**
- * At invalid destination.
- *
- * ```markdown
- * > | [a](<<) b
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceDestinationMissing(code) {
- return nok(code)
- }
-
- /**
- * In resource, after destination and whitespace, at `(` or title.
- *
- * ```markdown
- * > | [a](b ) c
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceBetween(code) {
- if (code === 34 || code === 39 || code === 40) {
- return factoryTitle(
- effects,
- resourceTitleAfter,
- nok,
- 'resourceTitle',
- 'resourceTitleMarker',
- 'resourceTitleString'
- )(code)
- }
- return resourceEnd(code)
- }
-
- /**
- * In resource, after title, at optional whitespace.
- *
- * ```markdown
- * > | [a](b "c") d
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceTitleAfter(code) {
- return markdownLineEndingOrSpace(code)
- ? factoryWhitespace(effects, resourceEnd)(code)
- : resourceEnd(code)
- }
-
- /**
- * In resource, at `)`.
- *
- * ```markdown
- * > | [a](b) d
- * ^
- * ```
- *
- * @type {State}
- */
- function resourceEnd(code) {
- if (code === 41) {
- effects.enter('resourceMarker')
- effects.consume(code)
- effects.exit('resourceMarker')
- effects.exit('resource')
- return ok
- }
- return nok(code)
- }
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeReferenceFull(effects, ok, nok) {
- const self = this
- return referenceFull
-
- /**
- * In a reference (full), at the `[`.
- *
- * ```markdown
- * > | [a][b] d
- * ^
- * ```
- *
- * @type {State}
- */
- function referenceFull(code) {
- return factoryLabel.call(
- self,
- effects,
- referenceFullAfter,
- referenceFullMissing,
- 'reference',
- 'referenceMarker',
- 'referenceString'
- )(code)
- }
-
- /**
- * In a reference (full), after `]`.
- *
- * ```markdown
- * > | [a][b] d
- * ^
- * ```
- *
- * @type {State}
- */
- function referenceFullAfter(code) {
- return self.parser.defined.includes(
- normalizeIdentifier(
- self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
- )
- )
- ? ok(code)
- : nok(code)
- }
-
- /**
- * In reference (full) that was missing.
- *
- * ```markdown
- * > | [a][b d
- * ^
- * ```
- *
- * @type {State}
- */
- function referenceFullMissing(code) {
- return nok(code)
- }
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeReferenceCollapsed(effects, ok, nok) {
- return referenceCollapsedStart
-
- /**
- * In reference (collapsed), at `[`.
- *
- * > 👉 **Note**: we only get here if the label is defined.
- *
- * ```markdown
- * > | [a][] d
- * ^
- * ```
- *
- * @type {State}
- */
- function referenceCollapsedStart(code) {
- // We only attempt a collapsed label if there’s a `[`.
-
- effects.enter('reference')
- effects.enter('referenceMarker')
- effects.consume(code)
- effects.exit('referenceMarker')
- return referenceCollapsedOpen
- }
-
- /**
- * In reference (collapsed), at `]`.
- *
- * > 👉 **Note**: we only get here if the label is defined.
- *
- * ```markdown
- * > | [a][] d
- * ^
- * ```
- *
- * @type {State}
- */
- function referenceCollapsedOpen(code) {
- if (code === 93) {
- effects.enter('referenceMarker')
- effects.consume(code)
- effects.exit('referenceMarker')
- effects.exit('reference')
- return ok
- }
- return nok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/label-start-image.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-/** @type {Construct} */
-const labelStartImage = {
- name: 'labelStartImage',
- tokenize: tokenizeLabelStartImage,
- resolveAll: labelEnd.resolveAll
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeLabelStartImage(effects, ok, nok) {
- const self = this
- return start
-
- /**
- * Start of label (image) start.
- *
- * ```markdown
- * > | a ![b] c
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('labelImage')
- effects.enter('labelImageMarker')
- effects.consume(code)
- effects.exit('labelImageMarker')
- return open
- }
-
- /**
- * After `!`, at `[`.
- *
- * ```markdown
- * > | a ![b] c
- * ^
- * ```
- *
- * @type {State}
- */
- function open(code) {
- if (code === 91) {
- effects.enter('labelMarker')
- effects.consume(code)
- effects.exit('labelMarker')
- effects.exit('labelImage')
- return after
- }
- return nok(code)
- }
-
- /**
- * After `![`.
- *
- * ```markdown
- * > | a ![b] c
- * ^
- * ```
- *
- * This is needed in because, when GFM footnotes are enabled, images never
- * form when started with a `^`.
- * Instead, links form:
- *
- * ```markdown
- * ![^a](b)
- *
- * ![^a][b]
- *
- * [b]: c
- * ```
- *
- * ```html
- * !^a
- * !^a
- * ```
- *
- * @type {State}
- */
- function after(code) {
- // To do: use a new field to do this, this is still needed for
- // `micromark-extension-gfm-footnote`, but the `label-start-link`
- // behavior isn’t.
- // Hidden footnotes hook.
- /* c8 ignore next 3 */
- return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
- ? nok(code)
- : ok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-classify-character/index.js
-/**
- * @typedef {import('micromark-util-types').Code} Code
- */
-
-
-/**
- * Classify whether a code represents whitespace, punctuation, or something
- * else.
- *
- * Used for attention (emphasis, strong), whose sequences can open or close
- * based on the class of surrounding characters.
- *
- * > 👉 **Note**: eof (`null`) is seen as whitespace.
- *
- * @param {Code} code
- * Code.
- * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
- * Group.
- */
-function classifyCharacter(code) {
- if (
- code === null ||
- markdownLineEndingOrSpace(code) ||
- unicodeWhitespace(code)
- ) {
- return 1
- }
- if (unicodePunctuation(code)) {
- return 2
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/attention.js
-/**
- * @typedef {import('micromark-util-types').Code} Code
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').Event} Event
- * @typedef {import('micromark-util-types').Point} Point
- * @typedef {import('micromark-util-types').Resolver} Resolver
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').Token} Token
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-
-/** @type {Construct} */
-const attention = {
- name: 'attention',
- tokenize: tokenizeAttention,
- resolveAll: resolveAllAttention
-}
-
-/**
- * Take all events and resolve attention to emphasis or strong.
- *
- * @type {Resolver}
- */
-function resolveAllAttention(events, context) {
- let index = -1
- /** @type {number} */
- let open
- /** @type {Token} */
- let group
- /** @type {Token} */
- let text
- /** @type {Token} */
- let openingSequence
- /** @type {Token} */
- let closingSequence
- /** @type {number} */
- let use
- /** @type {Array} */
- let nextEvents
- /** @type {number} */
- let 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
- const start = Object.assign({}, events[open][1].end)
- const end = Object.assign({}, events[index][1].start)
- movePoint(start, -use)
- movePoint(end, use)
- openingSequence = {
- type: use > 1 ? 'strongSequence' : 'emphasisSequence',
- start,
- end: Object.assign({}, events[open][1].end)
- }
- closingSequence = {
- type: use > 1 ? 'strongSequence' : 'emphasisSequence',
- start: Object.assign({}, events[index][1].start),
- end
- }
- text = {
- type: use > 1 ? 'strongText' : 'emphasisText',
- start: Object.assign({}, events[open][1].end),
- end: Object.assign({}, events[index][1].start)
- }
- group = {
- type: use > 1 ? 'strong' : 'emphasis',
- start: Object.assign({}, openingSequence.start),
- end: Object.assign({}, closingSequence.end)
- }
- events[open][1].end = Object.assign({}, openingSequence.start)
- events[index][1].start = Object.assign({}, 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 = push(nextEvents, [
- ['enter', events[open][1], context],
- ['exit', events[open][1], context]
- ])
- }
-
- // Opening.
- nextEvents = push(nextEvents, [
- ['enter', group, context],
- ['enter', openingSequence, context],
- ['exit', openingSequence, context],
- ['enter', text, context]
- ])
-
- // Always populated by defaults.
-
- // Between.
- nextEvents = push(
- nextEvents,
- resolveAll(
- context.parser.constructs.insideSpan.null,
- events.slice(open + 1, index),
- context
- )
- )
-
- // Closing.
- nextEvents = push(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 = push(nextEvents, [
- ['enter', events[index][1], context],
- ['exit', events[index][1], context]
- ])
- } else {
- offset = 0
- }
- splice(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
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeAttention(effects, ok) {
- const attentionMarkers = this.parser.constructs.attentionMarkers.null
- const previous = this.previous
- const before = classifyCharacter(previous)
-
- /** @type {NonNullable} */
- let marker
- return start
-
- /**
- * Before a sequence.
- *
- * ```markdown
- * > | **
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- marker = code
- effects.enter('attentionSequence')
- return inside(code)
- }
-
- /**
- * In a sequence.
- *
- * ```markdown
- * > | **
- * ^^
- * ```
- *
- * @type {State}
- */
- function inside(code) {
- if (code === marker) {
- effects.consume(code)
- return inside
- }
- const token = effects.exit('attentionSequence')
-
- // To do: next major: move this to resolver, just like `markdown-rs`.
- const after = classifyCharacter(code)
-
- // Always populated by defaults.
-
- const open =
- !after || (after === 2 && before) || attentionMarkers.includes(code)
- const close =
- !before || (before === 2 && after) || attentionMarkers.includes(previous)
- token._open = Boolean(marker === 42 ? open : open && (before || !close))
- token._close = Boolean(marker === 42 ? close : close && (after || !open))
- return ok(code)
- }
-}
-
-/**
- * Move a point a bit.
- *
- * Note: `move` only works inside lines! It’s not possible to move past other
- * chunks (replacement characters, tabs, or line endings).
- *
- * @param {Point} point
- * @param {number} offset
- * @returns {void}
- */
-function movePoint(point, offset) {
- point.column += offset
- point.offset += offset
- point._bufferIndex += offset
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/autolink.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-/** @type {Construct} */
-const autolink = {
- name: 'autolink',
- tokenize: tokenizeAutolink
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeAutolink(effects, ok, nok) {
- let size = 0
- return start
-
- /**
- * Start of an autolink.
- *
- * ```markdown
- * > | ab
- * ^
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('autolink')
- effects.enter('autolinkMarker')
- effects.consume(code)
- effects.exit('autolinkMarker')
- effects.enter('autolinkProtocol')
- return open
- }
-
- /**
- * After `<`, at protocol or atext.
- *
- * ```markdown
- * > | ab
- * ^
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function open(code) {
- if (asciiAlpha(code)) {
- effects.consume(code)
- return schemeOrEmailAtext
- }
- return emailAtext(code)
- }
-
- /**
- * At second byte of protocol or atext.
- *
- * ```markdown
- * > | ab
- * ^
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function schemeOrEmailAtext(code) {
- // ASCII alphanumeric and `+`, `-`, and `.`.
- if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
- // Count the previous alphabetical from `open` too.
- size = 1
- return schemeInsideOrEmailAtext(code)
- }
- return emailAtext(code)
- }
-
- /**
- * In ambiguous protocol or atext.
- *
- * ```markdown
- * > | ab
- * ^
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function schemeInsideOrEmailAtext(code) {
- if (code === 58) {
- effects.consume(code)
- size = 0
- return urlInside
- }
-
- // ASCII alphanumeric and `+`, `-`, and `.`.
- if (
- (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) &&
- size++ < 32
- ) {
- effects.consume(code)
- return schemeInsideOrEmailAtext
- }
- size = 0
- return emailAtext(code)
- }
-
- /**
- * After protocol, in URL.
- *
- * ```markdown
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function urlInside(code) {
- if (code === 62) {
- effects.exit('autolinkProtocol')
- effects.enter('autolinkMarker')
- effects.consume(code)
- effects.exit('autolinkMarker')
- effects.exit('autolink')
- return ok
- }
-
- // ASCII control, space, or `<`.
- if (code === null || code === 32 || code === 60 || asciiControl(code)) {
- return nok(code)
- }
- effects.consume(code)
- return urlInside
- }
-
- /**
- * In email atext.
- *
- * ```markdown
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function emailAtext(code) {
- if (code === 64) {
- effects.consume(code)
- return emailAtSignOrDot
- }
- if (asciiAtext(code)) {
- effects.consume(code)
- return emailAtext
- }
- return nok(code)
- }
-
- /**
- * In label, after at-sign or dot.
- *
- * ```markdown
- * > | ab
- * ^ ^
- * ```
- *
- * @type {State}
- */
- function emailAtSignOrDot(code) {
- return asciiAlphanumeric(code) ? emailLabel(code) : nok(code)
- }
-
- /**
- * In label, where `.` and `>` are allowed.
- *
- * ```markdown
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function emailLabel(code) {
- if (code === 46) {
- effects.consume(code)
- size = 0
- return emailAtSignOrDot
- }
- if (code === 62) {
- // Exit, then change the token type.
- effects.exit('autolinkProtocol').type = 'autolinkEmail'
- effects.enter('autolinkMarker')
- effects.consume(code)
- effects.exit('autolinkMarker')
- effects.exit('autolink')
- return ok
- }
- return emailValue(code)
- }
-
- /**
- * In label, where `.` and `>` are *not* allowed.
- *
- * Though, this is also used in `emailLabel` to parse other values.
- *
- * ```markdown
- * > | ab
- * ^
- * ```
- *
- * @type {State}
- */
- function emailValue(code) {
- // ASCII alphanumeric or `-`.
- if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
- const next = code === 45 ? emailValue : emailLabel
- effects.consume(code)
- return next
- }
- return nok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/html-text.js
-/**
- * @typedef {import('micromark-util-types').Code} Code
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-/** @type {Construct} */
-const htmlText = {
- name: 'htmlText',
- tokenize: tokenizeHtmlText
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeHtmlText(effects, ok, nok) {
- const self = this
- /** @type {NonNullable | undefined} */
- let marker
- /** @type {number} */
- let index
- /** @type {State} */
- let returnState
- return start
-
- /**
- * Start of HTML (text).
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('htmlText')
- effects.enter('htmlTextData')
- effects.consume(code)
- return open
- }
-
- /**
- * After `<`, at tag name or other stuff.
- *
- * ```markdown
- * > | a c
- * ^
- * > | a c
- * ^
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- 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
- }
-
- // ASCII alphabetical.
- if (asciiAlpha(code)) {
- effects.consume(code)
- return tagOpen
- }
- return nok(code)
- }
-
- /**
- * After ` | a c
- * ^
- * > | a c
- * ^
- * > | a &<]]> c
- * ^
- * ```
- *
- * @type {State}
- */
- function declarationOpen(code) {
- if (code === 45) {
- effects.consume(code)
- return commentOpenInside
- }
- if (code === 91) {
- effects.consume(code)
- index = 0
- return cdataOpenInside
- }
- if (asciiAlpha(code)) {
- effects.consume(code)
- return declaration
- }
- return nok(code)
- }
-
- /**
- * In a comment, after ` | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function commentOpenInside(code) {
- if (code === 45) {
- effects.consume(code)
- return commentEnd
- }
- return nok(code)
- }
-
- /**
- * In comment.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function comment(code) {
- if (code === null) {
- return nok(code)
- }
- if (code === 45) {
- effects.consume(code)
- return commentClose
- }
- if (markdownLineEnding(code)) {
- returnState = comment
- return lineEndingBefore(code)
- }
- effects.consume(code)
- return comment
- }
-
- /**
- * In comment, after `-`.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function commentClose(code) {
- if (code === 45) {
- effects.consume(code)
- return commentEnd
- }
- return comment(code)
- }
-
- /**
- * In comment, after `--`.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function commentEnd(code) {
- return code === 62
- ? end(code)
- : code === 45
- ? commentClose(code)
- : comment(code)
- }
-
- /**
- * After ` | a &<]]> b
- * ^^^^^^
- * ```
- *
- * @type {State}
- */
- function cdataOpenInside(code) {
- const value = 'CDATA['
- if (code === value.charCodeAt(index++)) {
- effects.consume(code)
- return index === value.length ? cdata : cdataOpenInside
- }
- return nok(code)
- }
-
- /**
- * In CDATA.
- *
- * ```markdown
- * > | a &<]]> b
- * ^^^
- * ```
- *
- * @type {State}
- */
- function cdata(code) {
- if (code === null) {
- return nok(code)
- }
- if (code === 93) {
- effects.consume(code)
- return cdataClose
- }
- if (markdownLineEnding(code)) {
- returnState = cdata
- return lineEndingBefore(code)
- }
- effects.consume(code)
- return cdata
- }
-
- /**
- * In CDATA, after `]`, at another `]`.
- *
- * ```markdown
- * > | a &<]]> b
- * ^
- * ```
- *
- * @type {State}
- */
- function cdataClose(code) {
- if (code === 93) {
- effects.consume(code)
- return cdataEnd
- }
- return cdata(code)
- }
-
- /**
- * In CDATA, after `]]`, at `>`.
- *
- * ```markdown
- * > | a &<]]> b
- * ^
- * ```
- *
- * @type {State}
- */
- function cdataEnd(code) {
- if (code === 62) {
- return end(code)
- }
- if (code === 93) {
- effects.consume(code)
- return cdataEnd
- }
- return cdata(code)
- }
-
- /**
- * In declaration.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function declaration(code) {
- if (code === null || code === 62) {
- return end(code)
- }
- if (markdownLineEnding(code)) {
- returnState = declaration
- return lineEndingBefore(code)
- }
- effects.consume(code)
- return declaration
- }
-
- /**
- * In instruction.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function instruction(code) {
- if (code === null) {
- return nok(code)
- }
- if (code === 63) {
- effects.consume(code)
- return instructionClose
- }
- if (markdownLineEnding(code)) {
- returnState = instruction
- return lineEndingBefore(code)
- }
- effects.consume(code)
- return instruction
- }
-
- /**
- * In instruction, after `?`, at `>`.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function instructionClose(code) {
- return code === 62 ? end(code) : instruction(code)
- }
-
- /**
- * After ``, in closing tag, at tag name.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function tagCloseStart(code) {
- // ASCII alphabetical.
- if (asciiAlpha(code)) {
- effects.consume(code)
- return tagClose
- }
- return nok(code)
- }
-
- /**
- * After ` | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function tagClose(code) {
- // ASCII alphanumerical and `-`.
- if (code === 45 || asciiAlphanumeric(code)) {
- effects.consume(code)
- return tagClose
- }
- return tagCloseBetween(code)
- }
-
- /**
- * In closing tag, after tag name.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function tagCloseBetween(code) {
- if (markdownLineEnding(code)) {
- returnState = tagCloseBetween
- return lineEndingBefore(code)
- }
- if (markdownSpace(code)) {
- effects.consume(code)
- return tagCloseBetween
- }
- return end(code)
- }
-
- /**
- * After ` | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpen(code) {
- // ASCII alphanumerical and `-`.
- if (code === 45 || asciiAlphanumeric(code)) {
- effects.consume(code)
- return tagOpen
- }
- if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
- return tagOpenBetween(code)
- }
- return nok(code)
- }
-
- /**
- * In opening tag, after tag name.
- *
- * ```markdown
- * > | a c
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpenBetween(code) {
- if (code === 47) {
- effects.consume(code)
- return end
- }
-
- // ASCII alphabetical and `:` and `_`.
- if (code === 58 || code === 95 || asciiAlpha(code)) {
- effects.consume(code)
- return tagOpenAttributeName
- }
- if (markdownLineEnding(code)) {
- returnState = tagOpenBetween
- return lineEndingBefore(code)
- }
- if (markdownSpace(code)) {
- effects.consume(code)
- return tagOpenBetween
- }
- return end(code)
- }
-
- /**
- * In attribute name.
- *
- * ```markdown
- * > | a d
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpenAttributeName(code) {
- // ASCII alphabetical and `-`, `.`, `:`, and `_`.
- if (
- code === 45 ||
- code === 46 ||
- code === 58 ||
- code === 95 ||
- asciiAlphanumeric(code)
- ) {
- effects.consume(code)
- return tagOpenAttributeName
- }
- return tagOpenAttributeNameAfter(code)
- }
-
- /**
- * After attribute name, before initializer, the end of the tag, or
- * whitespace.
- *
- * ```markdown
- * > | a d
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpenAttributeNameAfter(code) {
- if (code === 61) {
- effects.consume(code)
- return tagOpenAttributeValueBefore
- }
- if (markdownLineEnding(code)) {
- returnState = tagOpenAttributeNameAfter
- return lineEndingBefore(code)
- }
- if (markdownSpace(code)) {
- effects.consume(code)
- return tagOpenAttributeNameAfter
- }
- return tagOpenBetween(code)
- }
-
- /**
- * Before unquoted, double quoted, or single quoted attribute value, allowing
- * whitespace.
- *
- * ```markdown
- * > | a e
- * ^
- * ```
- *
- * @type {State}
- */
- 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 lineEndingBefore(code)
- }
- if (markdownSpace(code)) {
- effects.consume(code)
- return tagOpenAttributeValueBefore
- }
- effects.consume(code)
- return tagOpenAttributeValueUnquoted
- }
-
- /**
- * In double or single quoted attribute value.
- *
- * ```markdown
- * > | a e
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpenAttributeValueQuoted(code) {
- if (code === marker) {
- effects.consume(code)
- marker = undefined
- return tagOpenAttributeValueQuotedAfter
- }
- if (code === null) {
- return nok(code)
- }
- if (markdownLineEnding(code)) {
- returnState = tagOpenAttributeValueQuoted
- return lineEndingBefore(code)
- }
- effects.consume(code)
- return tagOpenAttributeValueQuoted
- }
-
- /**
- * In unquoted attribute value.
- *
- * ```markdown
- * > | a e
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpenAttributeValueUnquoted(code) {
- if (
- code === null ||
- code === 34 ||
- code === 39 ||
- code === 60 ||
- code === 61 ||
- code === 96
- ) {
- return nok(code)
- }
- if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
- return tagOpenBetween(code)
- }
- effects.consume(code)
- return tagOpenAttributeValueUnquoted
- }
-
- /**
- * After double or single quoted attribute value, before whitespace or the end
- * of the tag.
- *
- * ```markdown
- * > | a e
- * ^
- * ```
- *
- * @type {State}
- */
- function tagOpenAttributeValueQuotedAfter(code) {
- if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
- return tagOpenBetween(code)
- }
- return nok(code)
- }
-
- /**
- * In certain circumstances of a tag where only an `>` is allowed.
- *
- * ```markdown
- * > | a e
- * ^
- * ```
- *
- * @type {State}
- */
- function end(code) {
- if (code === 62) {
- effects.consume(code)
- effects.exit('htmlTextData')
- effects.exit('htmlText')
- return ok
- }
- return nok(code)
- }
-
- /**
- * At eol.
- *
- * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
- * > empty tokens.
- *
- * ```markdown
- * > | a
- * ```
- *
- * @type {State}
- */
- function lineEndingBefore(code) {
- effects.exit('htmlTextData')
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return lineEndingAfter
- }
-
- /**
- * After eol, at optional whitespace.
- *
- * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
- * > empty tokens.
- *
- * ```markdown
- * | a
- * ^
- * ```
- *
- * @type {State}
- */
- function lineEndingAfter(code) {
- // Always populated by defaults.
-
- return markdownSpace(code)
- ? factorySpace(
- effects,
- lineEndingAfterPrefix,
- 'linePrefix',
- self.parser.constructs.disable.null.includes('codeIndented')
- ? undefined
- : 4
- )(code)
- : lineEndingAfterPrefix(code)
- }
-
- /**
- * After eol, after optional whitespace.
- *
- * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
- * > empty tokens.
- *
- * ```markdown
- * | a
- * ^
- * ```
- *
- * @type {State}
- */
- function lineEndingAfterPrefix(code) {
- effects.enter('htmlTextData')
- return returnState(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/label-start-link.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-
-/** @type {Construct} */
-const labelStartLink = {
- name: 'labelStartLink',
- tokenize: tokenizeLabelStartLink,
- resolveAll: labelEnd.resolveAll
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeLabelStartLink(effects, ok, nok) {
- const self = this
- return start
-
- /**
- * Start of label (link) start.
- *
- * ```markdown
- * > | a [b] c
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('labelLink')
- effects.enter('labelMarker')
- effects.consume(code)
- effects.exit('labelMarker')
- effects.exit('labelLink')
- return after
- }
-
- /** @type {State} */
- function after(code) {
- // To do: this isn’t needed in `micromark-extension-gfm-footnote`,
- // remove.
- // Hidden footnotes hook.
- /* c8 ignore next 3 */
- return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
- ? nok(code)
- : ok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-/** @type {Construct} */
-const hardBreakEscape = {
- name: 'hardBreakEscape',
- tokenize: tokenizeHardBreakEscape
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeHardBreakEscape(effects, ok, nok) {
- return start
-
- /**
- * Start of a hard break (escape).
- *
- * ```markdown
- * > | a\
- * ^
- * | b
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('hardBreakEscape')
- effects.consume(code)
- return after
- }
-
- /**
- * After `\`, at eol.
- *
- * ```markdown
- * > | a\
- * ^
- * | b
- * ```
- *
- * @type {State}
- */
- function after(code) {
- if (markdownLineEnding(code)) {
- effects.exit('hardBreakEscape')
- return ok(code)
- }
- return nok(code)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-core-commonmark/lib/code-text.js
-/**
- * @typedef {import('micromark-util-types').Construct} Construct
- * @typedef {import('micromark-util-types').Previous} Previous
- * @typedef {import('micromark-util-types').Resolver} Resolver
- * @typedef {import('micromark-util-types').State} State
- * @typedef {import('micromark-util-types').Token} Token
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
- */
-
-
-/** @type {Construct} */
-const codeText = {
- name: 'codeText',
- tokenize: tokenizeCodeText,
- resolve: resolveCodeText,
- previous
-}
-
-// To do: next major: don’t resolve, like `markdown-rs`.
-/** @type {Resolver} */
-function resolveCodeText(events) {
- let tailExitIndex = events.length - 4
- let headEnterIndex = 3
- /** @type {number} */
- let index
- /** @type {number | undefined} */
- let 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[headEnterIndex][1].type = 'codeTextPadding'
- events[tailExitIndex][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
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Previous}
- */
-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'
- )
-}
-
-/**
- * @this {TokenizeContext}
- * @type {Tokenizer}
- */
-function tokenizeCodeText(effects, ok, nok) {
- const self = this
- let sizeOpen = 0
- /** @type {number} */
- let size
- /** @type {Token} */
- let token
- return start
-
- /**
- * Start of code (text).
- *
- * ```markdown
- * > | `a`
- * ^
- * > | \`a`
- * ^
- * ```
- *
- * @type {State}
- */
- function start(code) {
- effects.enter('codeText')
- effects.enter('codeTextSequence')
- return sequenceOpen(code)
- }
-
- /**
- * In opening sequence.
- *
- * ```markdown
- * > | `a`
- * ^
- * ```
- *
- * @type {State}
- */
- function sequenceOpen(code) {
- if (code === 96) {
- effects.consume(code)
- sizeOpen++
- return sequenceOpen
- }
- effects.exit('codeTextSequence')
- return between(code)
- }
-
- /**
- * Between something and something else.
- *
- * ```markdown
- * > | `a`
- * ^^
- * ```
- *
- * @type {State}
- */
- function between(code) {
- // EOF.
- if (code === null) {
- return nok(code)
- }
-
- // To do: next major: don’t do spaces in resolve, but when compiling,
- // like `markdown-rs`.
- // Tabs don’t work, and virtual spaces don’t make sense.
- if (code === 32) {
- effects.enter('space')
- effects.consume(code)
- effects.exit('space')
- return between
- }
-
- // Closing fence? Could also be data.
- if (code === 96) {
- token = effects.enter('codeTextSequence')
- size = 0
- return sequenceClose(code)
- }
- if (markdownLineEnding(code)) {
- effects.enter('lineEnding')
- effects.consume(code)
- effects.exit('lineEnding')
- return between
- }
-
- // Data.
- effects.enter('codeTextData')
- return data(code)
- }
-
- /**
- * In data.
- *
- * ```markdown
- * > | `a`
- * ^
- * ```
- *
- * @type {State}
- */
- function data(code) {
- if (
- code === null ||
- code === 32 ||
- code === 96 ||
- markdownLineEnding(code)
- ) {
- effects.exit('codeTextData')
- return between(code)
- }
- effects.consume(code)
- return data
- }
-
- /**
- * In closing sequence.
- *
- * ```markdown
- * > | `a`
- * ^
- * ```
- *
- * @type {State}
- */
- function sequenceClose(code) {
- // More.
- if (code === 96) {
- effects.consume(code)
- size++
- return sequenceClose
- }
-
- // 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)
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark/lib/constructs.js
-/**
- * @typedef {import('micromark-util-types').Extension} Extension
- */
-
-
-
-
-/** @satisfies {Extension['document']} */
-const constructs_document = {
- [42]: list,
- [43]: list,
- [45]: list,
- [48]: list,
- [49]: list,
- [50]: list,
- [51]: list,
- [52]: list,
- [53]: list,
- [54]: list,
- [55]: list,
- [56]: list,
- [57]: list,
- [62]: blockQuote
-}
-
-/** @satisfies {Extension['contentInitial']} */
-const contentInitial = {
- [91]: definition
-}
-
-/** @satisfies {Extension['flowInitial']} */
-const flowInitial = {
- [-2]: codeIndented,
- [-1]: codeIndented,
- [32]: codeIndented
-}
-
-/** @satisfies {Extension['flow']} */
-const constructs_flow = {
- [35]: headingAtx,
- [42]: thematicBreak,
- [45]: [setextUnderline, thematicBreak],
- [60]: htmlFlow,
- [61]: setextUnderline,
- [95]: thematicBreak,
- [96]: codeFenced,
- [126]: codeFenced
-}
-
-/** @satisfies {Extension['string']} */
-const constructs_string = {
- [38]: characterReference,
- [92]: characterEscape
-}
-
-/** @satisfies {Extension['text']} */
-const constructs_text = {
- [-5]: lineEnding,
- [-4]: lineEnding,
- [-3]: lineEnding,
- [33]: labelStartImage,
- [38]: characterReference,
- [42]: attention,
- [60]: [autolink, htmlText],
- [91]: labelStartLink,
- [92]: [hardBreakEscape, characterEscape],
- [93]: labelEnd,
- [95]: attention,
- [96]: codeText
-}
-
-/** @satisfies {Extension['insideSpan']} */
-const insideSpan = {
- null: [attention, resolver]
-}
-
-/** @satisfies {Extension['attentionMarkers']} */
-const attentionMarkers = {
- null: [42, 95]
-}
-
-/** @satisfies {Extension['disable']} */
-const disable = {
- null: []
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark/lib/parse.js
-/**
- * @typedef {import('micromark-util-types').Create} Create
- * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension
- * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
- * @typedef {import('micromark-util-types').ParseContext} ParseContext
- * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
- */
-
-
-
-
-
-
-
-
-
-/**
- * @param {ParseOptions | null | undefined} [options]
- * @returns {ParseContext}
- */
-function parse(options) {
- const settings = options || {}
- const constructs =
- /** @type {FullNormalizedExtension} */
- combineExtensions([constructs_namespaceObject, ...(settings.extensions || [])])
-
- /** @type {ParseContext} */
- const parser = {
- defined: [],
- lazy: {},
- constructs,
- content: create(content),
- document: create(document_document),
- flow: create(flow),
- string: create(string),
- text: create(text_text)
- }
- return parser
-
- /**
- * @param {InitialConstruct} initial
- */
- function create(initial) {
- return creator
- /** @type {Create} */
- function creator(from) {
- return createTokenizer(parser, initial, from)
- }
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark/lib/preprocess.js
-/**
- * @typedef {import('micromark-util-types').Chunk} Chunk
- * @typedef {import('micromark-util-types').Code} Code
- * @typedef {import('micromark-util-types').Encoding} Encoding
- * @typedef {import('micromark-util-types').Value} Value
- */
-
-/**
- * @callback Preprocessor
- * @param {Value} value
- * @param {Encoding | null | undefined} [encoding]
- * @param {boolean | null | undefined} [end=false]
- * @returns {Array}
- */
-
-const search = /[\0\t\n\r]/g
-
-/**
- * @returns {Preprocessor}
- */
-function preprocess() {
- let column = 1
- let buffer = ''
- /** @type {boolean | undefined} */
- let start = true
- /** @type {boolean | undefined} */
- let atCarriageReturn
- return preprocessor
-
- /** @type {Preprocessor} */
- function preprocessor(value, encoding, end) {
- /** @type {Array} */
- const chunks = []
- /** @type {RegExpMatchArray | null} */
- let match
- /** @type {number} */
- let next
- /** @type {number} */
- let startPosition
- /** @type {number} */
- let endPosition
- /** @type {Code} */
- let code
-
- // @ts-expect-error `Buffer` does allow an encoding.
- value = buffer + value.toString(encoding)
- startPosition = 0
- buffer = ''
- if (start) {
- // To do: `markdown-rs` actually parses BOMs (byte order mark).
- if (value.charCodeAt(0) === 65279) {
- startPosition++
- }
- start = undefined
- }
- while (startPosition < value.length) {
- search.lastIndex = startPosition
- match = search.exec(value)
- endPosition =
- match && match.index !== undefined ? 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
- }
- switch (code) {
- case 0: {
- chunks.push(65533)
- column++
- break
- }
- case 9: {
- next = Math.ceil(column / 4) * 4
- chunks.push(-2)
- while (column++ < next) chunks.push(-1)
- break
- }
- case 10: {
- chunks.push(-4)
- column = 1
- break
- }
- default: {
- atCarriageReturn = true
- column = 1
- }
- }
- }
- startPosition = endPosition + 1
- }
- if (end) {
- if (atCarriageReturn) chunks.push(-5)
- if (buffer) chunks.push(buffer)
- chunks.push(null)
- }
- return chunks
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark/lib/postprocess.js
-/**
- * @typedef {import('micromark-util-types').Event} Event
- */
-
-
-
-/**
- * @param {Array} events
- * @returns {Array}
- */
-function postprocess(events) {
- while (!subtokenize(events)) {
- // Empty
- }
- return events
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-decode-numeric-character-reference/index.js
-/**
- * Turn the number (in string form as either hexa- or plain decimal) coming from
- * a numeric character reference into a character.
- *
- * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes
- * non-characters and control characters safe.
- *
- * @param {string} value
- * Value to decode.
- * @param {number} base
- * Numeric base.
- * @returns {string}
- * Character.
- */
-function decodeNumericCharacterReference(value, base) {
- const code = Number.parseInt(value, base)
- if (
- // C0 except for HT, LF, FF, CR, space.
- code < 9 ||
- code === 11 ||
- (code > 13 && code < 32) ||
- // Control character (DEL) of C0, and C1 controls.
- (code > 126 && code < 160) ||
- // Lone high surrogates and low surrogates.
- (code > 55295 && code < 57344) ||
- // Noncharacters.
- (code > 64975 && code < 65008) /* eslint-disable no-bitwise */ ||
- (code & 65535) === 65535 ||
- (code & 65535) === 65534 /* eslint-enable no-bitwise */ ||
- // Out of range
- code > 1114111
- ) {
- return '\uFFFD'
- }
- return String.fromCharCode(code)
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/micromark-util-decode-string/index.js
-
-
-const characterEscapeOrReference =
- /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi
-
-/**
- * Decode markdown strings (which occur in places such as fenced code info
- * strings, destinations, labels, and titles).
- *
- * The “string” content type allows character escapes and -references.
- * This decodes those.
- *
- * @param {string} value
- * Value to decode.
- * @returns {string}
- * Decoded value.
- */
-function decodeString(value) {
- return value.replace(characterEscapeOrReference, decode)
-}
-
-/**
- * @param {string} $0
- * @param {string} $1
- * @param {string} $2
- * @returns {string}
- */
-function decode($0, $1, $2) {
- if ($1) {
- // Escape.
- return $1
- }
-
- // Reference.
- const head = $2.charCodeAt(0)
- if (head === 35) {
- const head = $2.charCodeAt(1)
- const hex = head === 120 || head === 88
- return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)
- }
- return decodeNamedCharacterReference($2) || $0
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/unist-util-stringify-position/lib/index.js
-/**
- * @typedef {import('unist').Node} Node
- * @typedef {import('unist').Point} Point
- * @typedef {import('unist').Position} Position
- */
-
-/**
- * @typedef NodeLike
- * @property {string} type
- * @property {PositionLike | null | undefined} [position]
- *
- * @typedef PositionLike
- * @property {PointLike | null | undefined} [start]
- * @property {PointLike | null | undefined} [end]
- *
- * @typedef PointLike
- * @property {number | null | undefined} [line]
- * @property {number | null | undefined} [column]
- * @property {number | null | undefined} [offset]
- */
-
-/**
- * Serialize the positional info of a point, position (start and end points),
- * or node.
- *
- * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]
- * Node, position, or point.
- * @returns {string}
- * Pretty printed positional info of a node (`string`).
- *
- * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
- * or a point `l:c` (when given `point`), where `l` stands for line, `c` for
- * column, `s` for `start`, and `e` for end.
- * An empty string (`''`) is returned if the given value is neither `node`,
- * `position`, nor `point`.
- */
-function stringifyPosition(value) {
- // Nothing.
- if (!value || typeof value !== 'object') {
- return ''
- }
-
- // Node.
- if ('position' in value || 'type' in value) {
- return position(value.position)
- }
-
- // Position.
- if ('start' in value || 'end' in value) {
- return position(value)
- }
-
- // Point.
- if ('line' in value || 'column' in value) {
- return point(value)
- }
-
- // ?
- return ''
-}
-
-/**
- * @param {Point | PointLike | null | undefined} point
- * @returns {string}
- */
-function point(point) {
- return index(point && point.line) + ':' + index(point && point.column)
-}
-
-/**
- * @param {Position | PositionLike | null | undefined} pos
- * @returns {string}
- */
-function position(pos) {
- return point(pos && pos.start) + '-' + point(pos && pos.end)
-}
-
-/**
- * @param {number | null | undefined} value
- * @returns {number}
- */
-function index(value) {
- return value && typeof value === 'number' ? value : 1
-}
-
-;// CONCATENATED MODULE: ./node_modules/mermaid/node_modules/mdast-util-from-markdown/lib/index.js
-/**
- * @typedef {import('micromark-util-types').Encoding} Encoding
- * @typedef {import('micromark-util-types').Event} Event
- * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
- * @typedef {import('micromark-util-types').Token} Token
- * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
- * @typedef {import('micromark-util-types').Value} Value
- *
- * @typedef {import('unist').Parent} UnistParent
- * @typedef {import('unist').Point} Point
- *
- * @typedef {import('mdast').PhrasingContent} PhrasingContent
- * @typedef {import('mdast').StaticPhrasingContent} StaticPhrasingContent
- * @typedef {import('mdast').Content} Content
- * @typedef {import('mdast').Break} Break
- * @typedef {import('mdast').Blockquote} Blockquote
- * @typedef {import('mdast').Code} Code
- * @typedef {import('mdast').Definition} Definition
- * @typedef {import('mdast').Emphasis} Emphasis
- * @typedef {import('mdast').Heading} Heading
- * @typedef {import('mdast').HTML} HTML
- * @typedef {import('mdast').Image} Image
- * @typedef {import('mdast').ImageReference} ImageReference
- * @typedef {import('mdast').InlineCode} InlineCode
- * @typedef {import('mdast').Link} Link
- * @typedef {import('mdast').LinkReference} LinkReference
- * @typedef {import('mdast').List} List
- * @typedef {import('mdast').ListItem} ListItem
- * @typedef {import('mdast').Paragraph} Paragraph
- * @typedef {import('mdast').Root} Root
- * @typedef {import('mdast').Strong} Strong
- * @typedef {import('mdast').Text} Text
- * @typedef {import('mdast').ThematicBreak} ThematicBreak
- * @typedef {import('mdast').ReferenceType} ReferenceType
- * @typedef {import('../index.js').CompileData} CompileData
- */
-
-/**
- * @typedef {Root | Content} Node
- * @typedef {Extract} Parent
- *
- * @typedef {Omit & {type: 'fragment', children: Array}} Fragment
- */
-
-/**
- * @callback Transform
- * Extra transform, to change the AST afterwards.
- * @param {Root} tree
- * Tree to transform.
- * @returns {Root | undefined | null | void}
- * New tree or nothing (in which case the current tree is used).
- *
- * @callback Handle
- * Handle a token.
- * @param {CompileContext} this
- * Context.
- * @param {Token} token
- * Current token.
- * @returns {void}
- * Nothing.
- *
- * @typedef {Record} Handles
- * Token types mapping to handles
- *
- * @callback OnEnterError
- * Handle the case where the `right` token is open, but it is closed (by the
- * `left` token) or because we reached the end of the document.
- * @param {Omit} this
- * Context.
- * @param {Token | undefined} left
- * Left token.
- * @param {Token} right
- * Right token.
- * @returns {void}
- * Nothing.
- *
- * @callback OnExitError
- * Handle the case where the `right` token is open but it is closed by
- * exiting the `left` token.
- * @param {Omit} this
- * Context.
- * @param {Token} left
- * Left token.
- * @param {Token} right
- * Right token.
- * @returns {void}
- * Nothing.
- *
- * @typedef {[Token, OnEnterError | undefined]} TokenTuple
- * Open token on the stack, with an optional error handler for when
- * that token isn’t closed properly.
- */
-
-/**
- * @typedef Config
- * Configuration.
- *
- * We have our defaults, but extensions will add more.
- * @property {Array} canContainEols
- * Token types where line endings are used.
- * @property {Handles} enter
- * Opening handles.
- * @property {Handles} exit
- * Closing handles.
- * @property {Array} transforms
- * Tree transforms.
- *
- * @typedef {Partial} Extension
- * Change how markdown tokens from micromark are turned into mdast.
- *
- * @typedef CompileContext
- * mdast compiler context.
- * @property {Array} stack
- * Stack of nodes.
- * @property {Array} tokenStack
- * Stack of tokens.
- * @property {(key: Key) => CompileData[Key]} getData
- * Get data from the key/value store.
- * @property {(key: Key, value?: CompileData[Key]) => void} setData
- * Set data into the key/value store.
- * @property {(this: CompileContext) => void} buffer
- * Capture some of the output data.
- * @property {(this: CompileContext) => string} resume
- * Stop capturing and access the output data.
- * @property {(this: CompileContext, node: Kind, token: Token, onError?: OnEnterError) => Kind} enter
- * Enter a token.
- * @property {(this: CompileContext, token: Token, onError?: OnExitError) => Node} exit
- * Exit a token.
- * @property {TokenizeContext['sliceSerialize']} sliceSerialize
- * Get the string value of a token.
- * @property {Config} config
- * Configuration.
- *
- * @typedef FromMarkdownOptions
- * Configuration for how to build mdast.
- * @property {Array> | null | undefined} [mdastExtensions]
- * Extensions for this utility to change how tokens are turned into a tree.
- *
- * @typedef {ParseOptions & FromMarkdownOptions} Options
- * Configuration.
- */
-
-// To do: micromark: create a registry of tokens?
-// To do: next major: don’t return given `Node` from `enter`.
-// To do: next major: remove setter/getter.
-
-
-
-
-
-
-
-
-
-
-const lib_own = {}.hasOwnProperty
-
-/**
- * @param value
- * Markdown to parse.
- * @param encoding
- * Character encoding for when `value` is `Buffer`.
- * @param options
- * Configuration.
- * @returns
- * mdast tree.
- */
-const fromMarkdown =
- /**
- * @type {(
- * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &
- * ((value: Value, options?: Options | null | undefined) => Root)
- * )}
- */
-
- /**
- * @param {Value} value
- * @param {Encoding | Options | null | undefined} [encoding]
- * @param {Options | null | undefined} [options]
- * @returns {Root}
- */
- function (value, encoding, options) {
- if (typeof encoding !== 'string') {
- options = encoding
- encoding = undefined
- }
- return compiler(options)(
- postprocess(
- parse(options).document().write(preprocess()(value, encoding, true))
- )
- )
- }
-
-/**
- * Note this compiler only understand complete buffering, not streaming.
- *
- * @param {Options | null | undefined} [options]
- */
-function compiler(options) {
- /** @type {Config} */
- const config = {
- 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()
- }
- }
- configure(config, (options || {}).mdastExtensions || [])
-
- /** @type {CompileData} */
- const data = {}
- return compile
-
- /**
- * Turn micromark events into an mdast tree.
- *
- * @param {Array} events
- * Events.
- * @returns {Root}
- * mdast tree.
- */
- function compile(events) {
- /** @type {Root} */
- let tree = {
- type: 'root',
- children: []
- }
- /** @type {Omit} */
- const context = {
- stack: [tree],
- tokenStack: [],
- config,
- enter,
- exit,
- buffer,
- resume,
- setData,
- getData
- }
- /** @type {Array} */
- const listStack = []
- let index = -1
- 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 {
- const tail = listStack.pop()
- index = prepareList(events, tail, index)
- }
- }
- }
- index = -1
- while (++index < events.length) {
- const handler = config[events[index][0]]
- if (lib_own.call(handler, events[index][1].type)) {
- handler[events[index][1].type].call(
- Object.assign(
- {
- sliceSerialize: events[index][2].sliceSerialize
- },
- context
- ),
- events[index][1]
- )
- }
- }
-
- // Handle tokens still being open.
- if (context.tokenStack.length > 0) {
- const tail = context.tokenStack[context.tokenStack.length - 1]
- const handler = tail[1] || defaultOnError
- handler.call(context, undefined, tail[0])
- }
-
- // Figure out `root` position.
- tree.position = {
- start: lib_point(
- events.length > 0
- ? events[0][1].start
- : {
- line: 1,
- column: 1,
- offset: 0
- }
- ),
- end: lib_point(
- events.length > 0
- ? events[events.length - 2][1].end
- : {
- line: 1,
- column: 1,
- offset: 0
- }
- )
- }
-
- // Call transforms.
- index = -1
- while (++index < config.transforms.length) {
- tree = config.transforms[index](tree) || tree
- }
- return tree
- }
-
- /**
- * @param {Array} events
- * @param {number} start
- * @param {number} length
- * @returns {number}
- */
- function prepareList(events, start, length) {
- let index = start - 1
- let containerBalance = -1
- let listSpread = false
- /** @type {Token | undefined} */
- let listItem
- /** @type {number | undefined} */
- let lineIndex
- /** @type {number | undefined} */
- let firstBlankLineIndex
- /** @type {boolean | undefined} */
- let atMarker
- while (++index <= length) {
- const 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) {
- let tailIndex = index
- lineIndex = undefined
- while (tailIndex--) {
- const 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 = Object.assign(
- {},
- 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: Object.assign({}, event[1].start),
- // @ts-expect-error: we’ll add `end` in a second.
- end: undefined
- }
- // @ts-expect-error: `listItem` is most definitely defined, TS...
- events.splice(index, 0, ['enter', listItem, event[2]])
- index++
- length++
- firstBlankLineIndex = undefined
- atMarker = true
- }
- }
- }
- events[start][1]._spread = listSpread
- return length
- }
-
- /**
- * Set data.
- *
- * @template {keyof CompileData} Key
- * Field type.
- * @param {Key} key
- * Key of field.
- * @param {CompileData[Key]} [value]
- * New value.
- * @returns {void}
- * Nothing.
- */
- function setData(key, value) {
- data[key] = value
- }
-
- /**
- * Get data.
- *
- * @template {keyof CompileData} Key
- * Field type.
- * @param {Key} key
- * Key of field.
- * @returns {CompileData[Key]}
- * Value.
- */
- function getData(key) {
- return data[key]
- }
-
- /**
- * Create an opener handle.
- *
- * @param {(token: Token) => Node} create
- * Create a node.
- * @param {Handle} [and]
- * Optional function to also run.
- * @returns {Handle}
- * Handle.
- */
- function opener(create, and) {
- return open
-
- /**
- * @this {CompileContext}
- * @param {Token} token
- * @returns {void}
- */
- function open(token) {
- enter.call(this, create(token), token)
- if (and) and.call(this, token)
- }
- }
-
- /**
- * @this {CompileContext}
- * @returns {void}
- */
- function buffer() {
- this.stack.push({
- type: 'fragment',
- children: []
- })
- }
-
- /**
- * @template {Node} Kind
- * Node type.
- * @this {CompileContext}
- * Context.
- * @param {Kind} node
- * Node to enter.
- * @param {Token} token
- * Corresponding token.
- * @param {OnEnterError | undefined} [errorHandler]
- * Handle the case where this token is open, but it is closed by something else.
- * @returns {Kind}
- * The given node.
- */
- function enter(node, token, errorHandler) {
- const parent = this.stack[this.stack.length - 1]
- // @ts-expect-error: Assume `Node` can exist as a child of `parent`.
- parent.children.push(node)
- this.stack.push(node)
- this.tokenStack.push([token, errorHandler])
- // @ts-expect-error: `end` will be patched later.
- node.position = {
- start: lib_point(token.start)
- }
- return node
- }
-
- /**
- * Create a closer handle.
- *
- * @param {Handle} [and]
- * Optional function to also run.
- * @returns {Handle}
- * Handle.
- */
- function closer(and) {
- return close
-
- /**
- * @this {CompileContext}
- * @param {Token} token
- * @returns {void}
- */
- function close(token) {
- if (and) and.call(this, token)
- exit.call(this, token)
- }
- }
-
- /**
- * @this {CompileContext}
- * Context.
- * @param {Token} token
- * Corresponding token.
- * @param {OnExitError | undefined} [onExitError]
- * Handle the case where another token is open.
- * @returns {Node}
- * The closed node.
- */
- function exit(token, onExitError) {
- const node = this.stack.pop()
- const 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[0].type !== token.type) {
- if (onExitError) {
- onExitError.call(this, token, open[0])
- } else {
- const handler = open[1] || defaultOnError
- handler.call(this, token, open[0])
- }
- }
- node.position.end = lib_point(token.end)
- return node
- }
-
- /**
- * @this {CompileContext}
- * @returns {string}
- */
- function resume() {
- return lib_toString(this.stack.pop())
- }
-
- //
- // Handlers.
- //
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onenterlistordered() {
- setData('expectingFirstListItemValue', true)
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onenterlistitemvalue(token) {
- if (getData('expectingFirstListItemValue')) {
- const ancestor = this.stack[this.stack.length - 2]
- ancestor.start = Number.parseInt(this.sliceSerialize(token), 10)
- setData('expectingFirstListItemValue')
- }
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitcodefencedfenceinfo() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.lang = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitcodefencedfencemeta() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.meta = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitcodefencedfence() {
- // Exit if this is the closing fence.
- if (getData('flowCodeInside')) return
- this.buffer()
- setData('flowCodeInside', true)
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitcodefenced() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, '')
- setData('flowCodeInside')
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitcodeindented() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.value = data.replace(/(\r?\n|\r)$/g, '')
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitdefinitionlabelstring(token) {
- const label = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.label = label
- node.identifier = normalizeIdentifier(
- this.sliceSerialize(token)
- ).toLowerCase()
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitdefinitiontitlestring() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.title = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitdefinitiondestinationstring() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.url = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitatxheadingsequence(token) {
- const node = this.stack[this.stack.length - 1]
- if (!node.depth) {
- const depth = this.sliceSerialize(token).length
- node.depth = depth
- }
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitsetextheadingtext() {
- setData('setextHeadingSlurpLineEnding', true)
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitsetextheadinglinesequence(token) {
- const node = this.stack[this.stack.length - 1]
- node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
- function onexitsetextheading() {
- setData('setextHeadingSlurpLineEnding')
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onenterdata(token) {
- const node = this.stack[this.stack.length - 1]
- let tail = node.children[node.children.length - 1]
- if (!tail || tail.type !== 'text') {
- // Add a new text node.
- tail = text()
- // @ts-expect-error: we’ll add `end` later.
- tail.position = {
- start: lib_point(token.start)
- }
- // @ts-expect-error: Assume `parent` accepts `text`.
- node.children.push(tail)
- }
- this.stack.push(tail)
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitdata(token) {
- const tail = this.stack.pop()
- tail.value += this.sliceSerialize(token)
- tail.position.end = lib_point(token.end)
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitlineending(token) {
- const context = this.stack[this.stack.length - 1]
- // If we’re at a hard break, include the line ending in there.
- if (getData('atHardBreak')) {
- const tail = context.children[context.children.length - 1]
- tail.position.end = lib_point(token.end)
- setData('atHardBreak')
- return
- }
- if (
- !getData('setextHeadingSlurpLineEnding') &&
- config.canContainEols.includes(context.type)
- ) {
- onenterdata.call(this, token)
- onexitdata.call(this, token)
- }
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexithardbreak() {
- setData('atHardBreak', true)
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexithtmlflow() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.value = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexithtmltext() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.value = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitcodetext() {
- const data = this.resume()
- const node = this.stack[this.stack.length - 1]
- node.value = data
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitlink() {
- const node = this.stack[this.stack.length - 1]
- // Note: there are also `identifier` and `label` fields on this link node!
- // These are used / cleaned here.
- // To do: clean.
- if (getData('inReference')) {
- /** @type {ReferenceType} */
- const referenceType = getData('referenceType') || 'shortcut'
- node.type += 'Reference'
- // @ts-expect-error: mutate.
- node.referenceType = referenceType
- // @ts-expect-error: mutate.
- delete node.url
- delete node.title
- } else {
- // @ts-expect-error: mutate.
- delete node.identifier
- // @ts-expect-error: mutate.
- delete node.label
- }
- setData('referenceType')
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitimage() {
- const node = this.stack[this.stack.length - 1]
- // Note: there are also `identifier` and `label` fields on this link node!
- // These are used / cleaned here.
- // To do: clean.
- if (getData('inReference')) {
- /** @type {ReferenceType} */
- const referenceType = getData('referenceType') || 'shortcut'
- node.type += 'Reference'
- // @ts-expect-error: mutate.
- node.referenceType = referenceType
- // @ts-expect-error: mutate.
- delete node.url
- delete node.title
- } else {
- // @ts-expect-error: mutate.
- delete node.identifier
- // @ts-expect-error: mutate.
- delete node.label
- }
- setData('referenceType')
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitlabeltext(token) {
- const string = this.sliceSerialize(token)
- const ancestor = this.stack[this.stack.length - 2]
- // @ts-expect-error: stash this on the node, as it might become a reference
- // later.
- ancestor.label = decodeString(string)
- // @ts-expect-error: same as above.
- ancestor.identifier = normalizeIdentifier(string).toLowerCase()
- }
-
- /**
- * @this {CompileContext}
- * @type {Handle}
- */
-
- function onexitlabel() {
- const fragment = this.stack[this.stack.length - 1]
- const value = this.resume()
- const node = this.stack[this.stack.length - 1]
- // Assume a reference.
- setData('inReference', true)
- if (node.type === 'link') {
- /** @type {Array