@scalar/code-highlight 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/chunks/code.js +124 -0
- package/dist/chunks/code.js.map +1 -0
- package/dist/chunks/languages.js +12720 -0
- package/dist/chunks/languages.js.map +1 -0
- package/dist/chunks/lib.js +13688 -0
- package/dist/chunks/lib.js.map +1 -0
- package/dist/chunks/lib2.js +731 -0
- package/dist/chunks/lib2.js.map +1 -0
- package/dist/chunks/markdown.js +20921 -0
- package/dist/chunks/markdown.js.map +1 -0
- package/dist/chunks/rehype-alert.js +74 -0
- package/dist/chunks/rehype-alert.js.map +1 -0
- package/dist/chunks/rehype-highlight.js +2987 -0
- package/dist/chunks/rehype-highlight.js.map +1 -0
- package/dist/code/index.d.ts +1 -1
- package/dist/code/index.js +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -5
- package/dist/languages/index.d.ts +3 -3
- package/dist/languages/index.js +2 -3
- package/dist/markdown/index.d.ts +1 -1
- package/dist/markdown/index.js +3 -1
- package/dist/markdown/markdown.d.ts.map +1 -1
- package/dist/rehype-alert/index.d.ts +1 -1
- package/dist/rehype-alert/index.js +2 -1
- package/dist/rehype-highlight/index.d.ts +1 -1
- package/dist/rehype-highlight/index.js +2 -1
- package/package.json +4 -4
- package/dist/code/highlight.js +0 -62
- package/dist/code/line-numbers.js +0 -94
- package/dist/constants.js +0 -11
- package/dist/languages/basic.js +0 -30
- package/dist/languages/curl.js +0 -86
- package/dist/languages/json-yaml.js +0 -9
- package/dist/languages/standard.js +0 -115
- package/dist/markdown/markdown.js +0 -162
- package/dist/rehype-alert/rehype-alert.js +0 -102
- package/dist/rehype-highlight/rehype-highlight.js +0 -98
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-highlight.js","names":["HighlightJS","emptyOptions","HighlightJs"],"sources":["../../../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js","../../src/constants.ts","../../../../node_modules/.pnpm/unist-util-find-after@5.0.0/node_modules/unist-util-find-after/lib/index.js","../../../../node_modules/.pnpm/hast-util-is-element@3.0.0/node_modules/hast-util-is-element/lib/index.js","../../../../node_modules/.pnpm/hast-util-to-text@4.0.2/node_modules/hast-util-to-text/lib/index.js","../../../../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js","../../../../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/core.js","../../../../node_modules/.pnpm/lowlight@3.3.0/node_modules/lowlight/lib/index.js","../../src/rehype-highlight/rehype-highlight.ts"],"sourcesContent":["export function deprecate(fn) {\n return fn\n}\n\nexport function equal() {}\n\nexport function ok() {}\n\nexport function unreachable() {}\n","/** Map common markdown language shortcuts to lowlight languages */\nexport const lowlightLanguageMappings: Record<string, string> = {\n 'ts': 'typescript',\n 'js': 'javascript',\n 'py': 'python',\n 'py3': 'python',\n 'c#': 'csharp',\n 'c++': 'cpp',\n 'node': 'javascript',\n}\n\n//\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array<any>\n * ? MatchesOne<Value, Check[keyof Check]>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {(\n * Kind extends {children: Array<infer Child>}\n * ? Child\n * : never\n * )} Child\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Kind\n * All node types.\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Find the first node in `parent` after another `node` or after an index,\n * that passes `test`.\n *\n * @param parent\n * Parent node.\n * @param index\n * Child node or index.\n * @param [test=undefined]\n * Test for child to look for (optional).\n * @returns\n * A child (matching `test`, if given) or `undefined`.\n */\nexport const findAfter =\n // Note: overloads like this are needed to support optional generics.\n /**\n * @type {(\n * (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) &\n * (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined)\n * )}\n */\n (\n /**\n * @param {UnistParent} parent\n * @param {UnistNode | number} index\n * @param {Test} [test]\n * @returns {UnistNode | undefined}\n */\n function (parent, index, test) {\n const is = convert(test)\n\n if (!parent || !parent.type || !parent.children) {\n throw new Error('Expected parent node')\n }\n\n if (typeof index === 'number') {\n if (index < 0 || index === Number.POSITIVE_INFINITY) {\n throw new Error('Expected positive finite number as index')\n }\n } else {\n index = parent.children.indexOf(index)\n\n if (index < 0) {\n throw new Error('Expected child node or index')\n }\n }\n\n while (++index < parent.children.length) {\n if (is(parent.children[index], index, parent)) {\n return parent.children[index]\n }\n }\n\n return undefined\n }\n )\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Parents} Parents\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is an element.\n * @param {unknown} this\n * Context object (`this`) to call `test` with\n * @param {unknown} [element]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * Position of `element` in its parent.\n * @param {Parents | null | undefined} [parent]\n * Parent of `element`.\n * @returns {boolean}\n * Whether this is an element and passes a test.\n *\n * @typedef {Array<TestFunction | string> | TestFunction | string | null | undefined} Test\n * Check for an arbitrary element.\n *\n * * when `string`, checks that the element has that tag name\n * * when `function`, see `TestFunction`\n * * when `Array`, checks if one of the subtests pass\n *\n * @callback TestFunction\n * Check if an element passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Element} element\n * An element.\n * @param {number | undefined} [index]\n * Position of `element` in its parent.\n * @param {Parents | undefined} [parent]\n * Parent of `element`.\n * @returns {boolean | undefined | void}\n * Whether this element passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `element` is an `Element` and whether it passes the given test.\n *\n * @param element\n * Thing to check, typically `element`.\n * @param test\n * Check for a specific element.\n * @param index\n * Position of `element` in its parent.\n * @param parent\n * Parent of `element`.\n * @param context\n * Context object (`this`) to call `test` with.\n * @returns\n * Whether `element` is an `Element` and passes a test.\n * @throws\n * When an incorrect `test`, `index`, or `parent` is given; there is no error\n * thrown when `element` is not a node or not an element.\n */\nexport const isElement =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends TestFunction>(element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) &\n * (<Condition extends string>(element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n * ((element?: null | undefined) => false) &\n * ((element: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n * ((element: unknown, test?: Test, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [element]\n * @param {Test | undefined} [test]\n * @param {number | null | undefined} [index]\n * @param {Parents | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (element, test, index, parent, context) {\n const check = convertElement(test)\n\n if (\n index !== null &&\n index !== undefined &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite `index`')\n }\n\n if (\n parent !== null &&\n parent !== undefined &&\n (!parent.type || !parent.children)\n ) {\n throw new Error('Expected valid `parent`')\n }\n\n if (\n (index === null || index === undefined) !==\n (parent === null || parent === undefined)\n ) {\n throw new Error('Expected both `index` and `parent`')\n }\n\n return looksLikeAnElement(element)\n ? check.call(context, element, index, parent)\n : false\n }\n )\n\n/**\n * Generate a check from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * an `element`, `index`, and `parent`.\n *\n * @param test\n * A test for a specific element.\n * @returns\n * A check.\n */\nexport const convertElement =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends TestFunction>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) &\n * (<Condition extends string>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n * ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test | null | undefined} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return element\n }\n\n if (typeof test === 'string') {\n return tagNameFactory(test)\n }\n\n // Assume array.\n if (typeof test === 'object') {\n return anyFactory(test)\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n throw new Error('Expected function, string, or array as `test`')\n }\n )\n\n/**\n * Handle multiple tests.\n *\n * @param {Array<TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convertElement(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn a string into a test for an element with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction tagNameFactory(check) {\n return castFactory(tagName)\n\n /**\n * @param {Element} element\n * @returns {boolean}\n */\n function tagName(element) {\n return element.tagName === check\n }\n}\n\n/**\n * Turn a custom test into a test for an element that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeAnElement(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\n/**\n * Make sure something is an element.\n *\n * @param {unknown} element\n * @returns {element is Element}\n */\nfunction element(element) {\n return Boolean(\n element &&\n typeof element === 'object' &&\n 'type' in element &&\n element.type === 'element' &&\n 'tagName' in element &&\n typeof element.tagName === 'string'\n )\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Element}\n */\nfunction looksLikeAnElement(value) {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'type' in value &&\n 'tagName' in value\n )\n}\n","/**\n * @typedef {import('hast').Comment} Comment\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Nodes} Nodes\n * @typedef {import('hast').Parents} Parents\n * @typedef {import('hast').Text} Text\n * @typedef {import('hast-util-is-element').TestFunction} TestFunction\n */\n\n/**\n * @typedef {'normal' | 'nowrap' | 'pre' | 'pre-wrap'} Whitespace\n * Valid and useful whitespace values (from CSS).\n *\n * @typedef {0 | 1 | 2} BreakNumber\n * Specific break:\n *\n * * `0` — space\n * * `1` — line ending\n * * `2` — blank line\n *\n * @typedef {'\\n'} BreakForce\n * Forced break.\n *\n * @typedef {boolean} BreakValue\n * Whether there was a break.\n *\n * @typedef {BreakNumber | BreakValue | undefined} BreakBefore\n * Any value for a break before.\n *\n * @typedef {BreakForce | BreakNumber | BreakValue | undefined} BreakAfter\n * Any value for a break after.\n *\n * @typedef CollectionInfo\n * Info on current collection.\n * @property {BreakAfter} breakAfter\n * Whether there was a break after.\n * @property {BreakBefore} breakBefore\n * Whether there was a break before.\n * @property {Whitespace} whitespace\n * Current whitespace setting.\n *\n * @typedef Options\n * Configuration.\n * @property {Whitespace | null | undefined} [whitespace='normal']\n * Initial CSS whitespace setting to use (default: `'normal'`).\n */\n\nimport {findAfter} from 'unist-util-find-after'\nimport {convertElement} from 'hast-util-is-element'\n\nconst searchLineFeeds = /\\n/g\nconst searchTabOrSpaces = /[\\t ]+/g\n\nconst br = convertElement('br')\nconst cell = convertElement(isCell)\nconst p = convertElement('p')\nconst row = convertElement('tr')\n\n// Note that we don’t need to include void elements here as they don’t have text.\n// See: <https://github.com/wooorm/html-void-elements>\nconst notRendered = convertElement([\n // List from: <https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements>\n 'datalist',\n 'head',\n 'noembed',\n 'noframes',\n 'noscript', // Act as if we support scripting.\n 'rp',\n 'script',\n 'style',\n 'template',\n 'title',\n // Hidden attribute.\n hidden,\n // From: <https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3>\n closedDialog\n])\n\n// See: <https://html.spec.whatwg.org/multipage/rendering.html#the-css-user-agent-style-sheet-and-presentational-hints>\nconst blockOrCaption = convertElement([\n 'address', // Flow content\n 'article', // Sections and headings\n 'aside', // Sections and headings\n 'blockquote', // Flow content\n 'body', // Page\n 'caption', // `table-caption`\n 'center', // Flow content (legacy)\n 'dd', // Lists\n 'dialog', // Flow content\n 'dir', // Lists (legacy)\n 'dl', // Lists\n 'dt', // Lists\n 'div', // Flow content\n 'figure', // Flow content\n 'figcaption', // Flow content\n 'footer', // Flow content\n 'form,', // Flow content\n 'h1', // Sections and headings\n 'h2', // Sections and headings\n 'h3', // Sections and headings\n 'h4', // Sections and headings\n 'h5', // Sections and headings\n 'h6', // Sections and headings\n 'header', // Flow content\n 'hgroup', // Sections and headings\n 'hr', // Flow content\n 'html', // Page\n 'legend', // Flow content\n 'li', // Lists (as `display: list-item`)\n 'listing', // Flow content (legacy)\n 'main', // Flow content\n 'menu', // Lists\n 'nav', // Sections and headings\n 'ol', // Lists\n 'p', // Flow content\n 'plaintext', // Flow content (legacy)\n 'pre', // Flow content\n 'section', // Sections and headings\n 'ul', // Lists\n 'xmp' // Flow content (legacy)\n])\n\n/**\n * Get the plain-text value of a node.\n *\n * ###### Algorithm\n *\n * * if `tree` is a comment, returns its `value`\n * * if `tree` is a text, applies normal whitespace collapsing to its\n * `value`, as defined by the CSS Text spec\n * * if `tree` is a root or element, applies an algorithm similar to the\n * `innerText` getter as defined by HTML\n *\n * ###### Notes\n *\n * > 👉 **Note**: the algorithm acts as if `tree` is being rendered, and as if\n * > we’re a CSS-supporting user agent, with scripting enabled.\n *\n * * if `tree` is an element that is not displayed (such as a `head`), we’ll\n * still use the `innerText` algorithm instead of switching to `textContent`\n * * if descendants of `tree` are elements that are not displayed, they are\n * ignored\n * * CSS is not considered, except for the default user agent style sheet\n * * a line feed is collapsed instead of ignored in cases where Fullwidth, Wide,\n * or Halfwidth East Asian Width characters are used, the same goes for a case\n * with Chinese, Japanese, or Yi writing systems\n * * replaced elements (such as `audio`) are treated like non-replaced elements\n *\n * @param {Nodes} tree\n * Tree to turn into text.\n * @param {Readonly<Options> | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `tree`.\n */\nexport function toText(tree, options) {\n const options_ = options || {}\n const children = 'children' in tree ? tree.children : []\n const block = blockOrCaption(tree)\n const whitespace = inferWhitespace(tree, {\n whitespace: options_.whitespace || 'normal',\n breakBefore: false,\n breakAfter: false\n })\n\n /** @type {Array<BreakNumber | string>} */\n const results = []\n\n // Treat `text` and `comment` as having normal white-space.\n // This deviates from the spec as in the DOM the node’s `.data` has to be\n // returned.\n // If you want that behavior use `hast-util-to-string`.\n // All other nodes are later handled as if they are `element`s (so the\n // algorithm also works on a `root`).\n // Nodes without children are treated as a void element, so `doctype` is thus\n // ignored.\n if (tree.type === 'text' || tree.type === 'comment') {\n results.push(\n ...collectText(tree, {\n whitespace,\n breakBefore: true,\n breakAfter: true\n })\n )\n }\n\n // 1. If this element is not being rendered, or if the user agent is a\n // non-CSS user agent, then return the same value as the textContent IDL\n // attribute on this element.\n //\n // Note: we’re not supporting stylesheets so we’re acting as if the node\n // is rendered.\n //\n // If you want that behavior use `hast-util-to-string`.\n // Important: we’ll have to account for this later though.\n\n // 2. Let results be a new empty list.\n let index = -1\n\n // 3. For each child node node of this element:\n while (++index < children.length) {\n // 3.1. Let current be the list resulting in running the inner text\n // collection steps with node.\n // Each item in results will either be a JavaScript string or a\n // positive integer (a required line break count).\n // 3.2. For each item item in current, append item to results.\n results.push(\n ...renderedTextCollection(\n children[index],\n // @ts-expect-error: `tree` is a parent if we’re here.\n tree,\n {\n whitespace,\n breakBefore: index ? undefined : block,\n breakAfter:\n index < children.length - 1 ? br(children[index + 1]) : block\n }\n )\n )\n }\n\n // 4. Remove any items from results that are the empty string.\n // 5. Remove any runs of consecutive required line break count items at the\n // start or end of results.\n // 6. Replace each remaining run of consecutive required line break count\n // items with a string consisting of as many U+000A LINE FEED (LF)\n // characters as the maximum of the values in the required line break\n // count items.\n /** @type {Array<string>} */\n const result = []\n /** @type {number | undefined} */\n let count\n\n index = -1\n\n while (++index < results.length) {\n const value = results[index]\n\n if (typeof value === 'number') {\n if (count !== undefined && value > count) count = value\n } else if (value) {\n if (count !== undefined && count > -1) {\n result.push('\\n'.repeat(count) || ' ')\n }\n\n count = -1\n result.push(value)\n }\n }\n\n // 7. Return the concatenation of the string items in results.\n return result.join('')\n}\n\n/**\n * <https://html.spec.whatwg.org/multipage/dom.html#rendered-text-collection-steps>\n *\n * @param {Nodes} node\n * @param {Parents} parent\n * @param {CollectionInfo} info\n * @returns {Array<BreakNumber | string>}\n */\nfunction renderedTextCollection(node, parent, info) {\n if (node.type === 'element') {\n return collectElement(node, parent, info)\n }\n\n if (node.type === 'text') {\n return info.whitespace === 'normal'\n ? collectText(node, info)\n : collectPreText(node)\n }\n\n return []\n}\n\n/**\n * Collect an element.\n *\n * @param {Element} node\n * Element node.\n * @param {Parents} parent\n * @param {CollectionInfo} info\n * Info on current collection.\n * @returns {Array<BreakNumber | string>}\n */\nfunction collectElement(node, parent, info) {\n // First we infer the `white-space` property.\n const whitespace = inferWhitespace(node, info)\n const children = node.children || []\n let index = -1\n /** @type {Array<BreakNumber | string>} */\n let items = []\n\n // We’re ignoring point 3, and exiting without any content here, because we\n // deviated from the spec in `toText` at step 3.\n if (notRendered(node)) {\n return items\n }\n\n /** @type {BreakNumber | undefined} */\n let prefix\n /** @type {BreakForce | BreakNumber | undefined} */\n let suffix\n // Note: we first detect if there is going to be a break before or after the\n // contents, as that changes the white-space handling.\n\n // 2. If node’s computed value of `visibility` is not `visible`, then return\n // items.\n //\n // Note: Ignored, as everything is visible by default user agent styles.\n\n // 3. If node is not being rendered, then return items. [...]\n //\n // Note: We already did this above.\n\n // See `collectText` for step 4.\n\n // 5. If node is a `<br>` element, then append a string containing a single\n // U+000A LINE FEED (LF) character to items.\n if (br(node)) {\n suffix = '\\n'\n }\n\n // 7. If node’s computed value of `display` is `table-row`, and node’s CSS\n // box is not the last `table-row` box of the nearest ancestor `table`\n // box, then append a string containing a single U+000A LINE FEED (LF)\n // character to items.\n //\n // See: <https://html.spec.whatwg.org/multipage/rendering.html#tables-2>\n // Note: needs further investigation as this does not account for implicit\n // rows.\n else if (\n row(node) &&\n // @ts-expect-error: something up with types of parents.\n findAfter(parent, node, row)\n ) {\n suffix = '\\n'\n }\n\n // 8. If node is a `<p>` element, then append 2 (a required line break count)\n // at the beginning and end of items.\n else if (p(node)) {\n prefix = 2\n suffix = 2\n }\n\n // 9. If node’s used value of `display` is block-level or `table-caption`,\n // then append 1 (a required line break count) at the beginning and end of\n // items.\n else if (blockOrCaption(node)) {\n prefix = 1\n suffix = 1\n }\n\n // 1. Let items be the result of running the inner text collection steps with\n // each child node of node in tree order, and then concatenating the\n // results to a single list.\n while (++index < children.length) {\n items = items.concat(\n renderedTextCollection(children[index], node, {\n whitespace,\n breakBefore: index ? undefined : prefix,\n breakAfter:\n index < children.length - 1 ? br(children[index + 1]) : suffix\n })\n )\n }\n\n // 6. If node’s computed value of `display` is `table-cell`, and node’s CSS\n // box is not the last `table-cell` box of its enclosing `table-row` box,\n // then append a string containing a single U+0009 CHARACTER TABULATION\n // (tab) character to items.\n //\n // See: <https://html.spec.whatwg.org/multipage/rendering.html#tables-2>\n if (\n cell(node) &&\n // @ts-expect-error: something up with types of parents.\n findAfter(parent, node, cell)\n ) {\n items.push('\\t')\n }\n\n // Add the pre- and suffix.\n if (prefix) items.unshift(prefix)\n if (suffix) items.push(suffix)\n\n return items\n}\n\n/**\n * 4. If node is a Text node, then for each CSS text box produced by node,\n * in content order, compute the text of the box after application of the\n * CSS `white-space` processing rules and `text-transform` rules, set\n * items to the list of the resulting strings, and return items.\n * The CSS `white-space` processing rules are slightly modified:\n * collapsible spaces at the end of lines are always collapsed, but they\n * are only removed if the line is the last line of the block, or it ends\n * with a br element.\n * Soft hyphens should be preserved.\n *\n * Note: See `collectText` and `collectPreText`.\n * Note: we don’t deal with `text-transform`, no element has that by\n * default.\n *\n * See: <https://drafts.csswg.org/css-text/#white-space-phase-1>\n *\n * @param {Comment | Text} node\n * Text node.\n * @param {CollectionInfo} info\n * Info on current collection.\n * @returns {Array<BreakNumber | string>}\n * Result.\n */\nfunction collectText(node, info) {\n const value = String(node.value)\n /** @type {Array<string>} */\n const lines = []\n /** @type {Array<BreakNumber | string>} */\n const result = []\n let start = 0\n\n while (start <= value.length) {\n searchLineFeeds.lastIndex = start\n\n const match = searchLineFeeds.exec(value)\n const end = match && 'index' in match ? match.index : value.length\n\n lines.push(\n // Any sequence of collapsible spaces and tabs immediately preceding or\n // following a segment break is removed.\n trimAndCollapseSpacesAndTabs(\n // […] ignoring bidi formatting characters (characters with the\n // Bidi_Control property [UAX9]: ALM, LTR, RTL, LRE-RLO, LRI-PDI) as if\n // they were not there.\n value\n .slice(start, end)\n .replace(/[\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]/g, ''),\n start === 0 ? info.breakBefore : true,\n end === value.length ? info.breakAfter : true\n )\n )\n\n start = end + 1\n }\n\n // Collapsible segment breaks are transformed for rendering according to the\n // segment break transformation rules.\n // So here we jump to 4.1.2 of [CSSTEXT]:\n // Any collapsible segment break immediately following another collapsible\n // segment break is removed\n let index = -1\n /** @type {BreakNumber | undefined} */\n let join\n\n while (++index < lines.length) {\n // * If the character immediately before or immediately after the segment\n // break is the zero-width space character (U+200B), then the break is\n // removed, leaving behind the zero-width space.\n if (\n lines[index].charCodeAt(lines[index].length - 1) === 0x20_0b /* ZWSP */ ||\n (index < lines.length - 1 &&\n lines[index + 1].charCodeAt(0) === 0x20_0b) /* ZWSP */\n ) {\n result.push(lines[index])\n join = undefined\n }\n\n // * Otherwise, if the East Asian Width property [UAX11] of both the\n // character before and after the segment break is Fullwidth, Wide, or\n // Halfwidth (not Ambiguous), and neither side is Hangul, then the\n // segment break is removed.\n //\n // Note: ignored.\n // * Otherwise, if the writing system of the segment break is Chinese,\n // Japanese, or Yi, and the character before or after the segment break\n // is punctuation or a symbol (Unicode general category P* or S*) and\n // has an East Asian Width property of Ambiguous, and the character on\n // the other side of the segment break is Fullwidth, Wide, or Halfwidth,\n // and not Hangul, then the segment break is removed.\n //\n // Note: ignored.\n\n // * Otherwise, the segment break is converted to a space (U+0020).\n else if (lines[index]) {\n if (typeof join === 'number') result.push(join)\n result.push(lines[index])\n join = 0\n } else if (index === 0 || index === lines.length - 1) {\n // If this line is empty, and it’s the first or last, add a space.\n // Note that this function is only called in normal whitespace, so we\n // don’t worry about `pre`.\n result.push(0)\n }\n }\n\n return result\n}\n\n/**\n * Collect a text node as “pre” whitespace.\n *\n * @param {Text} node\n * Text node.\n * @returns {Array<BreakNumber | string>}\n * Result.\n */\nfunction collectPreText(node) {\n return [String(node.value)]\n}\n\n/**\n * 3. Every collapsible tab is converted to a collapsible space (U+0020).\n * 4. Any collapsible space immediately following another collapsible\n * space—even one outside the boundary of the inline containing that\n * space, provided both spaces are within the same inline formatting\n * context—is collapsed to have zero advance width. (It is invisible,\n * but retains its soft wrap opportunity, if any.)\n *\n * @param {string} value\n * Value to collapse.\n * @param {BreakBefore} breakBefore\n * Whether there was a break before.\n * @param {BreakAfter} breakAfter\n * Whether there was a break after.\n * @returns {string}\n * Result.\n */\nfunction trimAndCollapseSpacesAndTabs(value, breakBefore, breakAfter) {\n /** @type {Array<string>} */\n const result = []\n let start = 0\n /** @type {number | undefined} */\n let end\n\n while (start < value.length) {\n searchTabOrSpaces.lastIndex = start\n const match = searchTabOrSpaces.exec(value)\n end = match ? match.index : value.length\n\n // If we’re not directly after a segment break, but there was white space,\n // add an empty value that will be turned into a space.\n if (!start && !end && match && !breakBefore) {\n result.push('')\n }\n\n if (start !== end) {\n result.push(value.slice(start, end))\n }\n\n start = match ? end + match[0].length : end\n }\n\n // If we reached the end, there was trailing white space, and there’s no\n // segment break after this node, add an empty value that will be turned\n // into a space.\n if (start !== end && !breakAfter) {\n result.push('')\n }\n\n return result.join(' ')\n}\n\n/**\n * Figure out the whitespace of a node.\n *\n * We don’t support void elements here (so `nobr wbr` -> `normal` is ignored).\n *\n * @param {Nodes} node\n * Node (typically `Element`).\n * @param {CollectionInfo} info\n * Info on current collection.\n * @returns {Whitespace}\n * Applied whitespace.\n */\nfunction inferWhitespace(node, info) {\n if (node.type === 'element') {\n const properties = node.properties || {}\n switch (node.tagName) {\n case 'listing':\n case 'plaintext':\n case 'xmp': {\n return 'pre'\n }\n\n case 'nobr': {\n return 'nowrap'\n }\n\n case 'pre': {\n return properties.wrap ? 'pre-wrap' : 'pre'\n }\n\n case 'td':\n case 'th': {\n return properties.noWrap ? 'nowrap' : info.whitespace\n }\n\n case 'textarea': {\n return 'pre-wrap'\n }\n\n default:\n }\n }\n\n return info.whitespace\n}\n\n/**\n * @type {TestFunction}\n * @param {Element} node\n * @returns {node is {properties: {hidden: true}}}\n */\nfunction hidden(node) {\n return Boolean((node.properties || {}).hidden)\n}\n\n/**\n * @type {TestFunction}\n * @param {Element} node\n * @returns {node is {tagName: 'td' | 'th'}}\n */\nfunction isCell(node) {\n return node.tagName === 'td' || node.tagName === 'th'\n}\n\n/**\n * @type {TestFunction}\n */\nfunction closedDialog(node) {\n return node.tagName === 'dialog' && !(node.properties || {}).open\n}\n","/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record<string,any>[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record<string,any> */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '</span>';\n\n/**\n * Determines if a node needs to be wrapped in <span>\n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += `<span class=\"${className}\">`;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array<string | RegExp | Object> } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial<Mode> & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial<Mode>}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial<Mode>} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record<string,string|string[]> | Array<string>} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array<string>} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record<string, boolean>}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array<RegExp | string>} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record<number,boolean> */\n const emit = {};\n /** @type Record<number,string> */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.11.1\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record<string, Language>} */\n const languages = Object.create(null);\n /** @type {Record<string, string>} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '<unnamed>') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n modeBuffer += \"\\n\";\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record<string,CompiledMode> */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array<string>} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial<HLJSOptions>} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n highlightAll();\n }\n\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n // make sure the event listener is only added once\n if (!wantsHighlight) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n","// https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards\nimport HighlightJS from '../lib/core.js';\nexport { HighlightJS };\nexport default HighlightJS;\n","/**\n * @import {ElementContent, Element, RootData, Root} from 'hast'\n * @import {Emitter, HLJSOptions as HljsOptions, HighlightResult, LanguageFn} from 'highlight.js'\n */\n\n/**\n * @typedef {Object} ExtraOptions\n * Extra fields.\n * @property {ReadonlyArray<string> | null | undefined} [subset]\n * List of allowed languages (default: all registered languages).\n *\n * @typedef Options\n * Configuration for `highlight`.\n * @property {string | null | undefined} [prefix='hljs-']\n * Class prefix (default: `'hljs-'`).\n *\n * @typedef {Options & ExtraOptions} AutoOptions\n * Configuration for `highlightAuto`.\n */\n\nimport {ok as assert} from 'devlop'\nimport HighlightJs from 'highlight.js/lib/core'\n\n/** @type {AutoOptions} */\nconst emptyOptions = {}\n\nconst defaultPrefix = 'hljs-'\n\n/**\n * Create a `lowlight` instance.\n *\n * @param {Readonly<Record<string, LanguageFn>> | null | undefined} [grammars]\n * Grammars to add (optional).\n * @returns\n * Lowlight.\n */\nexport function createLowlight(grammars) {\n const high = HighlightJs.newInstance()\n\n if (grammars) {\n register(grammars)\n }\n\n return {\n highlight,\n highlightAuto,\n listLanguages,\n register,\n registerAlias,\n registered\n }\n\n /**\n * Highlight `value` (code) as `language` (name).\n *\n * @example\n * ```js\n * import {common, createLowlight} from 'lowlight'\n *\n * const lowlight = createLowlight(common)\n *\n * console.log(lowlight.highlight('css', 'em { color: red }'))\n * ```\n *\n * Yields:\n *\n * ```js\n * {type: 'root', children: [Array], data: {language: 'css', relevance: 3}}\n * ```\n *\n * @param {string} language\n * Programming language name.\n * @param {string} value\n * Code to highlight.\n * @param {Readonly<Options> | null | undefined} [options={}]\n * Configuration (optional).\n * @returns {Root}\n * Tree; with the following `data` fields: `language` (`string`), detected\n * programming language name; `relevance` (`number`), how sure lowlight is\n * that the given code is in the language.\n */\n function highlight(language, value, options) {\n assert(typeof language === 'string', 'expected `string` as `name`')\n assert(typeof value === 'string', 'expected `string` as `value`')\n const settings = options || emptyOptions\n const prefix =\n typeof settings.prefix === 'string' ? settings.prefix : defaultPrefix\n\n if (!high.getLanguage(language)) {\n throw new Error('Unknown language: `' + language + '` is not registered')\n }\n\n // See: <https://github.com/highlightjs/highlight.js/issues/3621#issuecomment-1528841888>\n high.configure({__emitter: HastEmitter, classPrefix: prefix})\n\n const result = /** @type {HighlightResult & {_emitter: HastEmitter}} */ (\n high.highlight(value, {ignoreIllegals: true, language})\n )\n\n // `highlight.js` seems to use this (currently) for broken grammars, so let’s\n // keep it in there just to be sure.\n /* c8 ignore next 5 */\n if (result.errorRaised) {\n throw new Error('Could not highlight with `Highlight.js`', {\n cause: result.errorRaised\n })\n }\n\n const root = result._emitter.root\n\n // Cast because it is always defined.\n const data = /** @type {RootData} */ (root.data)\n\n data.language = result.language\n data.relevance = result.relevance\n\n return root\n }\n\n /**\n * Highlight `value` (code) and guess its programming language.\n *\n * @example\n * ```js\n * import {common, createLowlight} from 'lowlight'\n *\n * const lowlight = createLowlight(common)\n *\n * console.log(lowlight.highlightAuto('\"hello, \" + name + \"!\"'))\n * ```\n *\n * Yields:\n *\n * ```js\n * {type: 'root', children: [Array], data: {language: 'arduino', relevance: 2}}\n * ```\n *\n * @param {string} value\n * Code to highlight.\n * @param {Readonly<AutoOptions> | null | undefined} [options={}]\n * Configuration (optional).\n * @returns {Root}\n * Tree; with the following `data` fields: `language` (`string`), detected\n * programming language name; `relevance` (`number`), how sure lowlight is\n * that the given code is in the language.\n */\n function highlightAuto(value, options) {\n assert(typeof value === 'string', 'expected `string` as `value`')\n const settings = options || emptyOptions\n const subset = settings.subset || listLanguages()\n\n let index = -1\n let relevance = 0\n /** @type {Root | undefined} */\n let result\n\n while (++index < subset.length) {\n const name = subset[index]\n\n if (!high.getLanguage(name)) continue\n\n const current = highlight(name, value, options)\n\n if (\n current.data &&\n current.data.relevance !== undefined &&\n current.data.relevance > relevance\n ) {\n relevance = current.data.relevance\n result = current\n }\n }\n\n return (\n result || {\n type: 'root',\n children: [],\n data: {language: undefined, relevance}\n }\n )\n }\n\n /**\n * List registered languages.\n *\n * @example\n * ```js\n * import {createLowlight} from 'lowlight'\n * import markdown from 'highlight.js/lib/languages/markdown'\n *\n * const lowlight = createLowlight()\n *\n * console.log(lowlight.listLanguages()) // => []\n *\n * lowlight.register({markdown})\n *\n * console.log(lowlight.listLanguages()) // => ['markdown']\n * ```\n *\n * @returns {Array<string>}\n * Names of registered language.\n */\n function listLanguages() {\n return high.listLanguages()\n }\n\n /**\n * Register languages.\n *\n * @example\n * ```js\n * import {createLowlight} from 'lowlight'\n * import xml from 'highlight.js/lib/languages/xml'\n *\n * const lowlight = createLowlight()\n *\n * lowlight.register({xml})\n *\n * // Note: `html` is an alias for `xml`.\n * console.log(lowlight.highlight('html', '<em>Emphasis</em>'))\n * ```\n *\n * Yields:\n *\n * ```js\n * {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}\n * ```\n *\n * @overload\n * @param {Readonly<Record<string, LanguageFn>>} grammars\n * @returns {undefined}\n *\n * @overload\n * @param {string} name\n * @param {LanguageFn} grammar\n * @returns {undefined}\n *\n * @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName\n * Grammars or programming language name.\n * @param {LanguageFn | undefined} [grammar]\n * Grammar, if with name.\n * @returns {undefined}\n * Nothing.\n */\n function register(grammarsOrName, grammar) {\n if (typeof grammarsOrName === 'string') {\n assert(grammar !== undefined, 'expected `grammar`')\n high.registerLanguage(grammarsOrName, grammar)\n } else {\n /** @type {string} */\n let name\n\n for (name in grammarsOrName) {\n if (Object.hasOwn(grammarsOrName, name)) {\n high.registerLanguage(name, grammarsOrName[name])\n }\n }\n }\n }\n\n /**\n * Register aliases.\n *\n * @example\n * ```js\n * import {createLowlight} from 'lowlight'\n * import markdown from 'highlight.js/lib/languages/markdown'\n *\n * const lowlight = createLowlight()\n *\n * lowlight.register({markdown})\n *\n * // lowlight.highlight('mdown', '<em>Emphasis</em>')\n * // ^ would throw: Error: Unknown language: `mdown` is not registered\n *\n * lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})\n * lowlight.highlight('mdown', '<em>Emphasis</em>')\n * // ^ Works!\n * ```\n *\n * @overload\n * @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases\n * @returns {undefined}\n *\n * @overload\n * @param {string} language\n * @param {ReadonlyArray<string> | string} alias\n * @returns {undefined}\n *\n * @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName\n * Map of programming language names to one or more aliases, or programming\n * language name.\n * @param {ReadonlyArray<string> | string | undefined} [alias]\n * One or more aliases for the programming language, if with `name`.\n * @returns {undefined}\n * Nothing.\n */\n function registerAlias(aliasesOrName, alias) {\n if (typeof aliasesOrName === 'string') {\n assert(alias !== undefined)\n high.registerAliases(\n // Note: copy needed because hljs doesn’t accept readonly arrays yet.\n typeof alias === 'string' ? alias : [...alias],\n {languageName: aliasesOrName}\n )\n } else {\n /** @type {string} */\n let key\n\n for (key in aliasesOrName) {\n if (Object.hasOwn(aliasesOrName, key)) {\n const aliases = aliasesOrName[key]\n high.registerAliases(\n // Note: copy needed because hljs doesn’t accept readonly arrays yet.\n typeof aliases === 'string' ? aliases : [...aliases],\n {languageName: key}\n )\n }\n }\n }\n }\n\n /**\n * Check whether an alias or name is registered.\n *\n * @example\n * ```js\n * import {createLowlight} from 'lowlight'\n * import javascript from 'highlight.js/lib/languages/javascript'\n *\n * const lowlight = createLowlight({javascript})\n *\n * console.log(lowlight.registered('funkyscript')) // => `false`\n *\n * lowlight.registerAlias({javascript: 'funkyscript'})\n * console.log(lowlight.registered('funkyscript')) // => `true`\n * ```\n *\n * @param {string} aliasOrName\n * Name of a language or alias for one.\n * @returns {boolean}\n * Whether `aliasOrName` is registered.\n */\n function registered(aliasOrName) {\n return Boolean(high.getLanguage(aliasOrName))\n }\n}\n\n/** @type {Emitter} */\nclass HastEmitter {\n /**\n * @param {Readonly<HljsOptions>} options\n * Configuration.\n * @returns\n * Instance.\n */\n constructor(options) {\n /** @type {HljsOptions} */\n this.options = options\n /** @type {Root} */\n this.root = {\n type: 'root',\n children: [],\n data: {language: undefined, relevance: 0}\n }\n /** @type {[Root, ...Array<Element>]} */\n this.stack = [this.root]\n }\n\n /**\n * @param {string} value\n * Text to add.\n * @returns {undefined}\n * Nothing.\n *\n */\n addText(value) {\n if (value === '') return\n\n const current = this.stack[this.stack.length - 1]\n const tail = current.children[current.children.length - 1]\n\n if (tail && tail.type === 'text') {\n tail.value += value\n } else {\n current.children.push({type: 'text', value})\n }\n }\n\n /**\n *\n * @param {unknown} rawName\n * Name to add.\n * @returns {undefined}\n * Nothing.\n */\n startScope(rawName) {\n this.openNode(String(rawName))\n }\n\n /**\n * @returns {undefined}\n * Nothing.\n */\n endScope() {\n this.closeNode()\n }\n\n /**\n * @param {HastEmitter} other\n * Other emitter.\n * @param {string} name\n * Name of the sublanguage.\n * @returns {undefined}\n * Nothing.\n */\n __addSublanguage(other, name) {\n const current = this.stack[this.stack.length - 1]\n // Assume only element content.\n const results = /** @type {Array<ElementContent>} */ (other.root.children)\n\n if (name) {\n current.children.push({\n type: 'element',\n tagName: 'span',\n properties: {className: [name]},\n children: results\n })\n } else {\n current.children.push(...results)\n }\n }\n\n /**\n * @param {string} name\n * Name to add.\n * @returns {undefined}\n * Nothing.\n */\n openNode(name) {\n const self = this\n // First “class” gets the prefix. Rest gets a repeated underscore suffix.\n // See: <https://github.com/highlightjs/highlight.js/commit/51806aa>\n // See: <https://github.com/wooorm/lowlight/issues/43>\n const className = name.split('.').map(function (d, i) {\n return i ? d + '_'.repeat(i) : self.options.classPrefix + d\n })\n const current = this.stack[this.stack.length - 1]\n /** @type {Element} */\n const child = {\n type: 'element',\n tagName: 'span',\n properties: {className},\n children: []\n }\n\n current.children.push(child)\n this.stack.push(child)\n }\n\n /**\n * @returns {undefined}\n * Nothing.\n */\n closeNode() {\n this.stack.pop()\n }\n\n /**\n * @returns {undefined}\n * Nothing.\n */\n finalize() {}\n\n /**\n * @returns {string}\n * Nothing.\n */\n toHTML() {\n return ''\n }\n}\n","import type { Element, ElementContent, Root } from 'hast'\nimport { toText } from 'hast-util-to-text'\nimport { type LanguageFn, createLowlight } from 'lowlight'\nimport { visit } from 'unist-util-visit'\nimport type { VFile } from 'vfile'\n\nimport { lowlightLanguageMappings } from '../constants'\n\ntype HighlightOptions = {\n /** Optional existing lowlight instance to use */\n lowlight?: ReturnType<typeof createLowlight> | undefined\n /** Register more aliases (optional); passed to `lowlight.registerAlias` */\n aliases?: Readonly<Record<string, ReadonlyArray<string> | string>> | null | undefined\n /** Register languages (default: `common`) passed to `lowlight.register` */\n languages?: Readonly<Record<string, LanguageFn>> | null | undefined\n /** List of language names to not highlight (optional). Note: you can also add `no-highlight` classes. */\n plainText?: ReadonlyArray<string> | null | undefined\n /** Class prefix (default: `'hljs-'`) */\n prefix?: string | null | undefined\n /** Names of languages to check when detecting (default: all registered languages) */\n subset?: ReadonlyArray<string> | null | undefined\n /** Option to autodetect languages */\n detect?: boolean\n}\n\nconst emptyOptions: HighlightOptions = {}\n\n/**\n * Lowlight syntax highlighting plugin for rehype pipelines\n *\n * Derived from: @url https://github.com/rehypejs/rehype-highlight/blob/main/lib/index.js\n */\nexport function rehypeHighlight(options?: Readonly<HighlightOptions> | null | undefined) {\n const settings = options || emptyOptions\n const aliases = settings.aliases\n const detect = options?.detect ?? false\n const languages = settings.languages\n const plainText = settings.plainText\n const prefix = settings.prefix\n const subset = settings.subset\n let name = 'hljs'\n\n // Create a lowlight instance if not provided\n const lowlight = options?.lowlight ?? createLowlight(languages)\n\n if (aliases) {\n lowlight.registerAlias(aliases)\n }\n\n if (prefix) {\n const pos = prefix.indexOf('-')\n name = pos > -1 ? prefix.slice(0, pos) : prefix\n }\n\n /** Transform.*/\n return (tree: Root, file: VFile) => {\n visit(tree, 'element', (node, _, parent) => {\n if (node.tagName !== 'code' || !parent || parent.type !== 'element' || parent.tagName !== 'pre') {\n return\n }\n\n const lang = language(node)\n\n if (lang === 'no-highlight' || (!lang && !detect) || (lang && plainText?.includes(lang))) {\n return\n }\n\n if (!Array.isArray(node.properties.className)) {\n node.properties.className = []\n }\n\n if (!node.properties.className.includes(name)) {\n node.properties.className.unshift(name)\n }\n\n let result: Root | undefined\n\n try {\n result = lang\n ? lowlight.highlight(lang, toText(parent), { prefix })\n : lowlight.highlightAuto(toText(parent), { prefix, subset })\n } catch (error) {\n const cause = error as Error\n\n if (lang && /Unknown language/.test(cause.message)) {\n file.message(`Cannot highlight as \\`${lang}\\`, it's not registered`, {\n ancestors: [parent, node],\n cause,\n place: node.position,\n ruleId: 'missing-language',\n source: 'rehype-highlight',\n })\n\n /* c8 ignore next 5 -- throw arbitrary hljs errors */\n return\n }\n\n throw cause\n }\n\n if (!lang && result.data?.language) {\n node.properties.className.push('language-' + result.data.language)\n }\n\n if (result.children.length > 0) {\n node.children = result.children as Array<ElementContent>\n }\n })\n }\n}\n\n/** Get the programming language of `node` or an empty string */\nfunction language(node: Element) {\n const list = node.properties.className\n\n if (!Array.isArray(list)) {\n return ''\n }\n\n const name: string = list.reduce<string>((result, _item) => {\n if (result) {\n return result\n }\n const item = String(_item)\n\n if (item === 'no-highlight' || item === 'nohighlight') {\n return 'no-highlight'\n }\n if (item.slice(0, 5) === 'lang-') {\n return item.slice(5)\n }\n if (item.slice(0, 9) === 'language-') {\n return item.slice(9)\n }\n\n return result\n }, '')\n\n return lowlightLanguageMappings[name || ''] || name\n}\n"],"x_google_ignoreList":[0,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAgB,KAAK;;;;ACLrB,IAAa,2BAAmD;CAC9D,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;CACP,QAAQ;CACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC8ED,IAAa,aAeT,SAAU,QAAQ,OAAO,MAAM;CAC7B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F;;AAGF,UAAM;;AAGR,OAAI,CAAC,QAAQ,OAAO,MAAM,SACxB,MAAK,WAAW,UAAU,KAAK,cAAc,OAAO,KAAK,SAAS;AAGpE,OAAI,OAAO,SAAS,SAAS,EAC3B,MAAK,WAAW,OAAO;IAEzB;;;;AAKN,SAAS,SAAS,MAAe;CAC/B,MAAM,OAAO,KAAK,WAAW;AAE7B,KAAI,CAAC,MAAM,QAAQ,KAAK,CACtB,QAAO;CAGT,MAAM,OAAe,KAAK,QAAgB,QAAQ,UAAU;AAC1D,MAAI,OACF,QAAO;EAET,MAAM,OAAO,OAAO,MAAM;AAE1B,MAAI,SAAS,kBAAkB,SAAS,cACtC,QAAO;AAET,MAAI,KAAK,MAAM,GAAG,EAAE,KAAK,QACvB,QAAO,KAAK,MAAM,EAAE;AAEtB,MAAI,KAAK,MAAM,GAAG,EAAE,KAAK,YACvB,QAAO,KAAK,MAAM,EAAE;AAGtB,SAAO;IACN,GAAG;AAEN,QAAO,yBAAyB,QAAQ,OAAO"}
|
package/dist/code/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { syntaxHighlight } from './highlight
|
|
1
|
+
export { syntaxHighlight } from './highlight';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/code/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { syntaxHighlight } from './code/index.js';
|
|
2
|
-
export { lowlightLanguageMappings } from './constants
|
|
2
|
+
export { lowlightLanguageMappings } from './constants';
|
|
3
3
|
export { basicLanguages, jsonYamlLanguages, standardLanguages } from './languages/index.js';
|
|
4
4
|
export { type Node, htmlFromMarkdown, isHeading, textFromNode } from './markdown/index.js';
|
|
5
5
|
export { rehypeHighlight } from './rehype-highlight/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { i as lowlightLanguageMappings, t as rehypeHighlight } from "./chunks/rehype-highlight.js";
|
|
2
|
+
import "./chunks/lib.js";
|
|
3
|
+
import { n as jsonYamlLanguages, r as basicLanguages, t as standardLanguages } from "./chunks/languages.js";
|
|
4
|
+
import { t as syntaxHighlight } from "./chunks/code.js";
|
|
5
|
+
import { a as textFromNode, n as htmlFromMarkdown, r as isHeading } from "./chunks/markdown.js";
|
|
6
|
+
export { basicLanguages, htmlFromMarkdown, isHeading, jsonYamlLanguages, lowlightLanguageMappings, rehypeHighlight, standardLanguages, syntaxHighlight, textFromNode };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { basicLanguages } from './basic
|
|
2
|
-
export { jsonYamlLanguages } from './json-yaml
|
|
3
|
-
export { standardLanguages } from './standard
|
|
1
|
+
export { basicLanguages } from './basic';
|
|
2
|
+
export { jsonYamlLanguages } from './json-yaml';
|
|
3
|
+
export { standardLanguages } from './standard';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/languages/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export { jsonYamlLanguages }
|
|
3
|
-
export { standardLanguages } from './standard.js';
|
|
1
|
+
import { n as jsonYamlLanguages, r as basicLanguages, t as standardLanguages } from "../chunks/languages.js";
|
|
2
|
+
export { basicLanguages, jsonYamlLanguages, standardLanguages };
|
package/dist/markdown/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getHeadings, htmlFromMarkdown, isHeading, splitContent, textFromNode, type Node } from './markdown
|
|
1
|
+
export { getHeadings, htmlFromMarkdown, isHeading, splitContent, textFromNode, type Node } from './markdown';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/markdown/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunks/lib.js";
|
|
2
|
+
import { a as textFromNode, i as splitContent, n as htmlFromMarkdown, r as isHeading, t as getHeadings } from "../chunks/markdown.js";
|
|
3
|
+
export { getHeadings, htmlFromMarkdown, isHeading, splitContent, textFromNode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/markdown/markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/markdown/markdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsD,IAAI,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAuB/G,YAAY,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,OAE9C,CAAA;AAiGD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,UAyDF;AASD;;GAEG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAU,GAChB;IACD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,EAAE,CAiBF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,MAAM,CAUpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,YAgC5C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { rehypeAlert } from './rehype-alert
|
|
1
|
+
export { rehypeAlert } from './rehype-alert';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as rehypeAlert } from "../chunks/rehype-alert.js";
|
|
2
|
+
export { rehypeAlert };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { rehypeHighlight } from './rehype-highlight
|
|
1
|
+
export { rehypeHighlight } from './rehype-highlight';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as rehypeHighlight } from "../chunks/rehype-highlight.js";
|
|
2
|
+
export { rehypeHighlight };
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lowlight",
|
|
17
17
|
"highlightjs"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.3.
|
|
19
|
+
"version": "0.3.5",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"@types/mdast": "^4.0.4",
|
|
93
93
|
"vfile": "^6.0.3",
|
|
94
94
|
"vite": "8.0.0",
|
|
95
|
-
"@scalar/themes": "0.
|
|
95
|
+
"@scalar/themes": "0.16.0"
|
|
96
96
|
},
|
|
97
97
|
"scripts": {
|
|
98
|
-
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && shx cp -r src/css dist/css",
|
|
98
|
+
"build": "vite build && tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json && shx cp -r src/css dist/css",
|
|
99
99
|
"dev": "vite",
|
|
100
100
|
"test": "vitest --run",
|
|
101
|
-
"types:check": "
|
|
101
|
+
"types:check": "tsgo --noEmit"
|
|
102
102
|
}
|
|
103
103
|
}
|
package/dist/code/highlight.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import rehypeParse from 'rehype-parse';
|
|
2
|
-
import rehypeStringify from 'rehype-stringify';
|
|
3
|
-
import { unified } from 'unified';
|
|
4
|
-
import { visit } from 'unist-util-visit';
|
|
5
|
-
import { lowlightLanguageMappings } from '../constants.js';
|
|
6
|
-
import { rehypeHighlight } from '../rehype-highlight/index.js';
|
|
7
|
-
import { codeBlockLinesPlugin } from './line-numbers.js';
|
|
8
|
-
/**
|
|
9
|
-
* Syntax highlights a code string using the `rehype-highlight` library.
|
|
10
|
-
*/
|
|
11
|
-
export function syntaxHighlight(codeString, options) {
|
|
12
|
-
// Simple restriction on credentials to prevent unexpected behavior
|
|
13
|
-
const credentials = (typeof options?.maskCredentials === 'string' ? [options.maskCredentials] : (options?.maskCredentials ?? [])).filter((c) => {
|
|
14
|
-
// Credentials must be at least 3 characters to mask.
|
|
15
|
-
if (c.length < 3) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
19
|
-
});
|
|
20
|
-
// Classname is used by lowlight to select the language model
|
|
21
|
-
const className = `language-${lowlightLanguageMappings[options.lang] ?? options.lang}`;
|
|
22
|
-
// biome-ignore lint/suspicious/noEmptyBlockStatements: empty plugin
|
|
23
|
-
const nullPlugin = (() => { });
|
|
24
|
-
const html = unified()
|
|
25
|
-
// Parses markdown
|
|
26
|
-
.use(rehypeParse, { fragment: true })
|
|
27
|
-
// Raw code string must be injected after initial hast parsing
|
|
28
|
-
// so that HTML code is not parsed into the hast tree
|
|
29
|
-
.use(injectRawCodeStringPlugin(codeString))
|
|
30
|
-
// Syntax highlighting
|
|
31
|
-
.use(rehypeHighlight, {
|
|
32
|
-
languages: options.languages,
|
|
33
|
-
})
|
|
34
|
-
.use(options?.lineNumbers ? codeBlockLinesPlugin : nullPlugin)
|
|
35
|
-
// Converts the HTML AST to a string
|
|
36
|
-
.use(rehypeStringify)
|
|
37
|
-
// Run the pipeline
|
|
38
|
-
.processSync(`<pre><code class="${className}"></code></pre>`);
|
|
39
|
-
const htmlString = html.toString();
|
|
40
|
-
// Replace any credentials with a wrapper element
|
|
41
|
-
return credentials.length
|
|
42
|
-
? credentials.reduce((acc, credential) => acc
|
|
43
|
-
.split(credential)
|
|
44
|
-
.join(`<span class="credential"><span class="credential-value">${credential}</span></span>`), htmlString)
|
|
45
|
-
: htmlString;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* To prevent unified from parsing any content of the code string we inject
|
|
49
|
-
* it as a raw text node into the AST tree as a child of the code element
|
|
50
|
-
*/
|
|
51
|
-
function injectRawCodeStringPlugin(rawCodeString) {
|
|
52
|
-
return () => (tree) => {
|
|
53
|
-
visit(tree, 'element', (node) => {
|
|
54
|
-
if (node.tagName === 'code') {
|
|
55
|
-
node.children.push({
|
|
56
|
-
type: 'text',
|
|
57
|
-
value: rawCodeString,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|