markdown-it
Version:
Markdown-it - modern pluggable markdown parser.
1 lines • 258 kB
Source Map (JSON)
{"version":3,"file":"markdown-it.mjs","names":[],"sources":["../src/common/utils.ts","../src/helpers/parse_link_label.ts","../src/helpers/parse_link_destination.ts","../src/helpers/parse_link_title.ts","../src/helpers/index.ts","../src/token.ts","../src/ruler.ts","../src/renderer.ts","../src/rules_core/state_core.ts","../src/rules_core/normalize.ts","../src/rules_core/block.ts","../src/rules_core/strip_references.ts","../src/rules_core/inline.ts","../src/rules_core/linkify.ts","../src/rules_core/replacements.ts","../src/rules_core/smartquotes.ts","../src/rules_core/text_join.ts","../src/parser_core.ts","../src/rules_block/state_block.ts","../src/rules_block/table.ts","../src/rules_block/code.ts","../src/rules_block/fence.ts","../src/rules_block/blockquote.ts","../src/rules_block/hr.ts","../src/rules_block/list.ts","../src/rules_block/reference.ts","../src/common/html_blocks.ts","../src/common/html_re.ts","../src/rules_block/html_block.ts","../src/rules_block/heading.ts","../src/rules_block/lheading.ts","../src/rules_block/paragraph.ts","../src/parser_block.ts","../src/rules_inline/state_inline.ts","../src/rules_inline/text.ts","../src/rules_inline/linkify.ts","../src/rules_inline/newline.ts","../src/rules_inline/escape.ts","../src/rules_inline/backticks.ts","../src/rules_inline/strikethrough.ts","../src/rules_inline/emphasis.ts","../src/rules_inline/link.ts","../src/rules_inline/image.ts","../src/rules_inline/autolink.ts","../src/rules_inline/html_inline.ts","../src/rules_inline/entity.ts","../src/rules_inline/balance_pairs.ts","../src/rules_inline/fragments_join.ts","../src/parser_inline.ts","../src/presets/default.ts","../src/presets/zero.ts","../src/presets/commonmark.ts","../src/markdownit.ts","../src/index.ts"],"sourcesContent":["/**\n * Common utility functions exposed through `md.utils` for use by plugins.\n *\n * @module md.utils\n */\n\nimport * as mdurl from 'mdurl'\nimport * as ucmicro from 'uc.micro'\nimport { decodeHTMLStrict } from 'entities'\n\n/** @hidden */\ntype ClassToWrap = new (...args: any[]) => object\n\n/** Wraps a class so it can be called with or without `new`. */\nfunction callable<T extends ClassToWrap> (\n cls: T\n): T & ((...args: ConstructorParameters<T>) => InstanceType<T>)\nfunction callable<T extends ClassToWrap> (cls: T) {\n const wrapper = function (...args: ConstructorParameters<T>) {\n const newTarget =\n new.target && new.target !== wrapper\n ? new.target\n : cls\n\n return Reflect.construct(cls, args, newTarget)\n }\n\n Object.defineProperty(wrapper, 'name', { value: cls.name })\n Object.setPrototypeOf(wrapper, cls)\n wrapper.prototype = cls.prototype\n\n return wrapper\n}\n\n/**\n * Returns a copy of a token array with the token at `pos` replaced by\n * `newElements`. Used to transform token streams without modifying the\n * original array.\n */\nfunction arrayReplaceAt<T> (src: T[], pos: number, newElements: T[]): T[] {\n return ([] as T[]).concat(src.slice(0, pos), newElements, src.slice(pos + 1))\n}\n\n/** Checks whether a code point can be decoded from a numeric HTML entity. */\nfunction isValidEntityCode (c: number) {\n // broken sequence\n if (c >= 0xD800 && c <= 0xDFFF) { return false }\n // never used\n if (c >= 0xFDD0 && c <= 0xFDEF) { return false }\n if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false }\n // control codes\n if (c >= 0x00 && c <= 0x08) { return false }\n if (c === 0x0B) { return false }\n if (c >= 0x0E && c <= 0x1F) { return false }\n if (c >= 0x7F && c <= 0x9F) { return false }\n // out of range\n if (c > 0x10FFFF) { return false }\n return true\n}\n\n/**\n * Converts a Unicode code point to a string, like `String.fromCodePoint()`,\n * but does not throw for invalid input.\n */\nfunction fromCodePoint (c: number) {\n /* eslint no-bitwise:0 */\n if (c > 0xffff) {\n c -= 0x10000\n const surrogate1 = 0xd800 + (c >> 10)\n const surrogate2 = 0xdc00 + (c & 0x3ff)\n\n return String.fromCharCode(surrogate1, surrogate2)\n }\n return String.fromCharCode(c)\n}\n\nconst UNESCAPE_MD_RE = /\\\\([!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~])/g\nconst ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi\nconst UNESCAPE_ALL_RE = new RegExp(`${UNESCAPE_MD_RE.source}|${ENTITY_RE.source}`, 'gi')\n\nconst DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i\n\nfunction replaceEntityPattern (match: string, name: string) {\n if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {\n const code = name[1].toLowerCase() === 'x'\n ? parseInt(name.slice(2), 16)\n : parseInt(name.slice(1), 10)\n\n if (isValidEntityCode(code)) {\n return fromCodePoint(code)\n }\n\n return match\n }\n\n const decoded = decodeHTMLStrict(match)\n if (decoded !== match) {\n return decoded\n }\n\n return match\n}\n\n/** Decodes Markdown backslash escapes. */\nfunction unescapeMd (str: string) {\n if (str.indexOf('\\\\') < 0) { return str }\n return str.replace(UNESCAPE_MD_RE, '$1')\n}\n\n/**\n * Decodes Markdown backslash escapes and HTML character references in link\n * destinations, link titles, and fenced code info strings.\n */\nfunction unescapeAll (str: string) {\n if (str.indexOf('\\\\') < 0 && str.indexOf('&') < 0) { return str }\n\n return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {\n if (escaped) { return escaped }\n return replaceEntityPattern(match, entity)\n })\n}\n\nconst HTML_ESCAPE_TEST_RE = /[&<>\"]/\nconst HTML_ESCAPE_REPLACE_RE = /[&<>\"]/g\nconst HTML_REPLACEMENTS = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"'\n}\n\nfunction replaceUnsafeChar (ch: string): string {\n return HTML_REPLACEMENTS[ch as keyof typeof HTML_REPLACEMENTS]\n}\n\n/** Escapes HTML special characters in a string. */\nfunction escapeHtml (str: string) {\n if (HTML_ESCAPE_TEST_RE.test(str)) {\n return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar)\n }\n return str\n}\n\nconst REGEXP_ESCAPE_RE = /[.?*+^$[\\]\\\\(){}|-]/g\n\n/** Escapes regular expression metacharacters in a string. */\nfunction escapeRE (str: string) {\n return str.replace(REGEXP_ESCAPE_RE, '\\\\$&')\n}\n\n/** Checks whether a character code is an ASCII space or tab. */\nfunction isSpace (code: number) {\n switch (code) {\n case 0x09:\n case 0x20:\n return true\n }\n return false\n}\n\n/**\n * Checks whether a character code is whitespace recognized by Markdown.\n *\n * Matches the Unicode `Zs` category or `\\t`, `\\f`, `\\v`, `\\r`, `\\n`.\n */\nfunction isWhiteSpace (code: number) {\n if (code >= 0x2000 && code <= 0x200A) { return true }\n switch (code) {\n case 0x09: // \\t\n case 0x0A: // \\n\n case 0x0B: // \\v\n case 0x0C: // \\f\n case 0x0D: // \\r\n case 0x20:\n case 0xA0:\n case 0x1680:\n case 0x202F:\n case 0x205F:\n case 0x3000:\n return true\n }\n return false\n}\n\n/**\n * Checks whether a character is Unicode punctuation or a symbol.\n *\n * Does not support astral characters.\n */\nfunction isPunctChar (ch: string) {\n return ucmicro.P.test(ch) || ucmicro.S.test(ch)\n}\n\n/** Checks whether a Unicode code point is punctuation or a symbol. */\nfunction isPunctCharCode (code: number) {\n return isPunctChar(fromCodePoint(code))\n}\n\n/**\n * Markdown ASCII punctuation characters.\n *\n * !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @,\n * [, \\, ], ^, _, `, {, |, }, or ~\n *\n * http://spec.commonmark.org/0.15/#ascii-punctuation-character\n *\n * Don't confuse with Unicode punctuation. It lacks some characters in the\n * ASCII range.\n */\nfunction isMdAsciiPunct (ch: number) {\n switch (ch) {\n case 0x21/* ! */:\n case 0x22/* \" */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x27/* ' */:\n case 0x28/* ( */:\n case 0x29/* ) */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2C/* , */:\n case 0x2D/* - */:\n case 0x2E/* . */:\n case 0x2F/* / */:\n case 0x3A/* : */:\n case 0x3B/* ; */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x3F/* ? */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7C/* | */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true\n default:\n return false\n }\n}\n\n/** Normalizes `[reference labels]` for case-insensitive lookup. */\nfunction normalizeReference (str: string) {\n // Trim and collapse whitespace\n //\n str = str.trim().replace(/\\s+/g, ' ')\n\n // .toLowerCase().toUpperCase() should get rid of all differences\n // between letter variants.\n //\n // Simple .toLowerCase() doesn't normalize 125 code points correctly,\n // and .toUpperCase doesn't normalize 6 of them (list of exceptions:\n // İ, ϴ, ẞ, Ω, K, Å - those are already uppercased, but have differently\n // uppercased versions).\n //\n // Here's an example showing how it happens. Lets take greek letter omega:\n // uppercase U+0398 (Θ), U+03f4 (ϴ) and lowercase U+03b8 (θ), U+03d1 (ϑ)\n //\n // Unicode entries:\n // 0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8;\n // 03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398\n // 03D1;GREEK THETA SYMBOL;Ll;0;L;<compat> 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398\n // 03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L;<compat> 0398;;;;N;;;;03B8;\n //\n // Case-insensitive comparison should treat all of them as equivalent.\n //\n // But .toLowerCase() doesn't change ϑ (it's already lowercase),\n // and .toUpperCase() doesn't change ϴ (already uppercase).\n //\n // Applying first lower then upper case normalizes any character:\n // '\\u0398\\u03f4\\u03b8\\u03d1'.toLowerCase().toUpperCase() === '\\u0398\\u0398\\u0398\\u0398'\n //\n // Note: this is equivalent to unicode case folding; unicode normalization\n // is a different step that is not required here.\n //\n // Final result should be uppercased, because it's later stored in an object\n // (this avoid a conflict with Object.prototype members,\n // most notably, `__proto__`)\n //\n return str.toLowerCase().toUpperCase()\n}\n\nfunction isAsciiTrimmable (c: number) {\n return c === 0x20 || c === 0x09 || c === 0x0a || c === 0x0d\n}\n\n/**\n * \"Light\" `.trim()` for blocks (headings, paragraphs), where Unicode spaces\n * should be preserved.\n */\nfunction asciiTrim (str: string) {\n let start = 0\n for (; start < str.length; start++) {\n if (!isAsciiTrimmable(str.charCodeAt(start))) {\n break\n }\n }\n let end = str.length - 1\n for (; end >= start; end--) {\n if (!isAsciiTrimmable(str.charCodeAt(end))) {\n break\n }\n }\n return str.slice(start, end + 1)\n}\n\n/**\n * Libraries commonly used by markdown-it and its plugins, re-exported to\n * reduce duplicate dependencies in browser bundles.\n */\nconst lib = { mdurl, ucmicro }\n\nexport {\n lib,\n callable,\n unescapeMd,\n unescapeAll,\n isValidEntityCode,\n fromCodePoint,\n escapeHtml,\n arrayReplaceAt,\n isSpace,\n isWhiteSpace,\n isMdAsciiPunct,\n isPunctChar,\n isPunctCharCode,\n escapeRE,\n normalizeReference,\n asciiTrim\n}\n","import type StateInline from '../rules_inline/state_inline.ts'\n\n/** Finds the end of a link or image label (`[label]`). */\nexport default function parseLinkLabel (state: StateInline, start: number, disableNested?: boolean): number {\n let level, found, marker, prevPos\n\n const max = state.posMax\n const oldPos = state.pos\n\n state.pos = start + 1\n level = 1\n\n while (state.pos < max) {\n marker = state.src.charCodeAt(state.pos)\n if (marker === 0x5D /* ] */) {\n level--\n if (level === 0) {\n found = true\n break\n }\n }\n\n prevPos = state.pos\n state.md.inline.skipToken(state)\n if (marker === 0x5B /* [ */) {\n if (prevPos === state.pos - 1) {\n // increase level if we find text `[`, which is not a part of any token\n level++\n } else if (disableNested) {\n state.pos = oldPos\n return -1\n }\n }\n }\n\n let labelEnd = -1\n\n if (found) {\n labelEnd = state.pos\n }\n\n // restore old state\n state.pos = oldPos\n\n return labelEnd\n}\n","import { unescapeAll } from '../common/utils.ts'\n\n/** Parses the destination in `[label](destination \"title\")`. */\nexport default function parseLinkDestination (str: string, start: number, max: number) {\n let code\n let pos = start\n\n const result = {\n ok: false,\n pos: 0,\n str: ''\n }\n\n if (str.charCodeAt(pos) === 0x3C /* < */) {\n pos++\n while (pos < max) {\n code = str.charCodeAt(pos)\n if (code === 0x0A /* \\n */) { return result }\n if (code === 0x3C /* < */) { return result }\n if (code === 0x3E /* > */) {\n result.pos = pos + 1\n result.str = unescapeAll(str.slice(start + 1, pos))\n result.ok = true\n return result\n }\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2\n continue\n }\n\n pos++\n }\n\n // no closing '>'\n return result\n }\n\n // this should be ... } else { ... branch\n\n let level = 0\n while (pos < max) {\n code = str.charCodeAt(pos)\n\n if (code === 0x20) { break }\n\n // ascii control characters\n if (code < 0x20 || code === 0x7F) { break }\n\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n if (str.charCodeAt(pos + 1) === 0x20) { pos++; continue }\n pos += 2\n continue\n }\n\n if (code === 0x28 /* ( */) {\n level++\n if (level > 32) { return result }\n }\n\n if (code === 0x29 /* ) */) {\n if (level === 0) { break }\n level--\n }\n\n pos++\n }\n\n if (start === pos) { return result }\n if (level !== 0) { return result }\n\n result.str = unescapeAll(str.slice(start, pos))\n result.pos = pos\n result.ok = true\n return result\n}\n","import { unescapeAll } from '../common/utils.ts'\n\n/** @inline */\ninterface ParseLinkTitleResult {\n ok: boolean\n can_continue: boolean\n pos: number\n str: string\n marker: number\n}\n\n/**\n * Parses the optional title in `[label](destination \"title\")` or\n * `[label]: destination \"title\"`.\n *\n * `prev_state` continues a reference title on the next source line.\n */\nexport default function parseLinkTitle (\n str: string,\n start: number,\n max: number,\n prev_state?: ParseLinkTitleResult\n): ParseLinkTitleResult {\n let code\n let pos = start\n\n const state = {\n // if `true`, this is a valid link title\n ok: false,\n // if `true`, this link can be continued on the next line\n can_continue: false,\n // if `ok`, it's the position of the first character after the closing marker\n pos: 0,\n // if `ok`, it's the unescaped title\n str: '',\n // expected closing marker character code\n marker: 0\n }\n\n if (prev_state) {\n // this is a continuation of a previous parseLinkTitle call on the next line,\n // used in reference links only\n state.str = prev_state.str\n state.marker = prev_state.marker\n } else {\n if (pos >= max) { return state }\n\n let marker = str.charCodeAt(pos)\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return state }\n\n start++\n pos++\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) { marker = 0x29 }\n\n state.marker = marker\n }\n\n while (pos < max) {\n code = str.charCodeAt(pos)\n if (code === state.marker) {\n state.pos = pos + 1\n state.str += unescapeAll(str.slice(start, pos))\n state.ok = true\n return state\n } else if (code === 0x28 /* ( */ && state.marker === 0x29 /* ) */) {\n return state\n } else if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos++\n }\n\n pos++\n }\n\n // no closing marker found, but this link title may continue on the next line (for references)\n state.can_continue = true\n state.str += unescapeAll(str.slice(start, pos))\n return state\n}\n","/**\n * Functions used to parse links and images, split out of parser rules because\n * of their size.\n *\n * @module md.helpers\n */\n\n// Just a shortcut for bulk export\n\nimport parseLinkLabel from './parse_link_label.ts'\nimport parseLinkDestination from './parse_link_destination.ts'\nimport parseLinkTitle from './parse_link_title.ts'\n\nexport {\n parseLinkLabel,\n parseLinkDestination,\n parseLinkTitle\n}\n","// Token class\n\n/** @inline */\ntype TokenNesting = -1 | 0 | 1\n\n/** @inline */\ntype TokenAttribute = [name: string, value: string | number]\n\n/**\n * Represents one item in the parsed token stream, storing parsed data and\n * providing helpers for managing HTML attributes.\n */\nclass Token {\n /**\n * Type of the token (string, e.g. \"paragraph_open\")\n */\n declare type: string\n\n /**\n * html tag name, e.g. \"p\"\n */\n declare tag: string\n\n /** Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]` */\n declare attrs: TokenAttribute[] | null\n\n /**\n * Source map info. Format: `[ line_begin, line_end ]`\n */\n map: [number, number] | null = null\n\n /**\n * Level change (number in {-1, 0, 1} set), where:\n *\n * - `1` means the tag is opening\n * - `0` means the tag is self-closing\n * - `-1` means the tag is closing\n */\n declare nesting: TokenNesting\n\n /**\n * nesting level, the same as `state.level`\n */\n level = 0\n\n /**\n * An array of child nodes (inline and img tokens)\n */\n children: Token[] | null = null\n\n /**\n * In a case of self-closing tag (code, html, fence, etc.),\n * it has contents of this tag.\n */\n content = ''\n\n /**\n * '*' or '_' for emphasis, fence string for fence, etc.\n */\n markup = ''\n\n /**\n * Additional information:\n *\n * - Info string for \"fence\" tokens\n * - The value \"auto\" for autolink \"link_open\" and \"link_close\" tokens\n * - The string value of the item marker for ordered-list \"list_item_open\" tokens\n */\n info = ''\n\n /** A place for plugins to store an arbitrary data */\n declare meta: Record<string, unknown> | null\n\n /**\n * True for block-level tokens, false for inline tokens.\n * Used in renderer to calculate line breaks\n */\n block = false\n\n /**\n * If it's true, ignore this element when rendering. Used for tight lists\n * to hide paragraphs.\n */\n hidden = false\n\n constructor (type: string, tag: string, nesting: TokenNesting) {\n this.type = type\n this.tag = tag\n\n this.attrs = null\n\n this.nesting = nesting\n\n this.meta = null\n }\n\n /**\n * Search attribute index by name.\n */\n attrIndex (name: string): number {\n if (!this.attrs) { return -1 }\n\n const attrs = this.attrs\n\n for (let i = 0, len = attrs.length; i < len; i++) {\n if (attrs[i][0] === name) { return i }\n }\n return -1\n }\n\n /**\n * Add `[ name, value ]` attribute to list. Init attrs if necessary\n */\n attrPush (attrData: TokenAttribute): void {\n if (this.attrs) {\n this.attrs.push(attrData)\n } else {\n this.attrs = [attrData]\n }\n }\n\n /**\n * Set `name` attribute to `value`. Override old value if exists.\n */\n attrSet (name: string, value: string | number): void {\n const idx = this.attrIndex(name)\n const attrData: TokenAttribute = [name, value]\n\n if (idx < 0) {\n this.attrPush(attrData)\n } else {\n this.attrs![idx] = attrData\n }\n }\n\n /**\n * Get the value of attribute `name`, or null if it does not exist.\n */\n attrGet (name: string): string | number | null {\n const idx = this.attrIndex(name)\n let value = null\n if (idx >= 0) {\n value = this.attrs![idx][1]\n }\n return value\n }\n\n /**\n * Join value to existing attribute via space. Or create new attribute if not\n * exists. Useful to operate with token classes.\n */\n attrJoin (name: string, value: string | number): void {\n const idx = this.attrIndex(name)\n\n if (idx < 0) {\n this.attrPush([name, value])\n } else {\n this.attrs![idx][1] = `${this.attrs![idx][1]} ${value}`\n }\n }\n}\n\nexport default Token\n","/** @inline */\ntype RuleOptions = { alt?: string[] }\n\n/**\n * Helper class, used by {@link MarkdownIt.core}, {@link MarkdownIt.block} and\n * {@link MarkdownIt.inline} to manage sequences of functions (rules):\n *\n * - keep rules in defined order\n * - assign the name to each rule\n * - enable/disable rules\n * - add/replace rules\n * - allow assign rules to additional named chains (in the same)\n * - cacheing lists of active rules\n *\n * You will not need use this class directly until write plugins. For simple\n * rules control use {@link MarkdownIt.disable}, {@link MarkdownIt.enable} and\n * {@link MarkdownIt.use}.\n */\nclass Ruler<Args extends unknown[], Result> {\n /** @internal */\n __rules__: Array<{\n name: string\n enabled: boolean\n fn: (...args: Args) => Result\n alt: string[]\n }> = []\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n /** @internal */\n __cache__: Record<string, Array<(...args: Args) => Result>> | null = null\n\n /** @internal */\n __find__ (name: string): number {\n for (let i = 0; i < this.__rules__.length; i++) {\n if (this.__rules__[i].name === name) {\n return i\n }\n }\n return -1\n }\n\n /** @internal */\n __compile__ (): void {\n const chains = new Set<string>()\n\n // collect unique names\n this.__rules__.forEach(rule => {\n if (!rule.enabled) return\n rule.alt.forEach(altName => {\n if (altName) chains.add(altName)\n })\n })\n\n this.__cache__ = Object.create(null)\n\n // Collect default chain\n this.__cache__![''] = []\n this.__rules__.forEach(rule => {\n if (rule.enabled) this.__cache__![''].push(rule.fn)\n })\n\n // Collect alt chains\n chains.forEach(chain => {\n this.__cache__![chain] = []\n\n this.__rules__.forEach(rule => {\n if (rule.enabled && rule.alt.indexOf(chain) >= 0) {\n this.__cache__![chain].push(rule.fn)\n }\n })\n })\n }\n\n /**\n * Replace rule by name with new function & options. Throws error if name not\n * found.\n *\n * @example Replace existing typographer replacement rule with new one\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * md.core.ruler.at('replacements', function replace(state) {\n * //...\n * });\n * ```\n */\n at (name: string, fn: (...args: Args) => Result, options: RuleOptions = {}): void {\n const index = this.__find__(name)\n\n if (index === -1) { throw new Error(`Parser rule not found: ${name}`) }\n\n this.__rules__[index].fn = fn\n this.__rules__[index].alt = options.alt || []\n this.__cache__ = null\n }\n\n /**\n * Add new rule to chain before one with given name. See also\n * {@link Ruler.after}, {@link Ruler.push}.\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n */\n before (beforeName: string, ruleName: string, fn: (...args: Args) => Result, options: RuleOptions = {}): void {\n const index = this.__find__(beforeName)\n\n if (index === -1) { throw new Error(`Parser rule not found: ${beforeName}`) }\n\n this.__rules__.splice(index, 0, {\n name: ruleName,\n enabled: true,\n fn,\n alt: options.alt || []\n })\n\n this.__cache__ = null\n }\n\n /**\n * Add new rule to chain after one with given name. See also\n * {@link Ruler.before}, {@link Ruler.push}.\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * md.inline.ruler.after('text', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n */\n after (afterName: string, ruleName: string, fn: (...args: Args) => Result, options: RuleOptions = {}): void {\n const index = this.__find__(afterName)\n\n if (index === -1) { throw new Error(`Parser rule not found: ${afterName}`) }\n\n this.__rules__.splice(index + 1, 0, {\n name: ruleName,\n enabled: true,\n fn,\n alt: options.alt || []\n })\n\n this.__cache__ = null\n }\n\n /**\n * Push new rule to the end of chain. See also\n * {@link Ruler.before}, {@link Ruler.after}.\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * md.core.ruler.push('my_rule', function replace(state) {\n * //...\n * });\n * ```\n */\n push (ruleName: string, fn: (...args: Args) => Result, options: RuleOptions = {}): void {\n this.__rules__.push({\n name: ruleName,\n enabled: true,\n fn,\n alt: options.alt || []\n })\n\n this.__cache__ = null\n }\n\n /**\n * Enable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * See also {@link Ruler.disable}, {@link Ruler.enableOnly}.\n *\n * Returns list of found rule names (if no exception happened).\n */\n enable (list: string | string[], ignoreInvalid = false): string[] {\n if (!Array.isArray(list)) { list = [list] }\n\n const result: string[] = []\n\n // Search by name and enable\n list.forEach(name => {\n const idx = this.__find__(name)\n\n if (idx < 0) {\n if (ignoreInvalid) { return }\n throw new Error(`Rules manager: invalid rule name ${name}`)\n }\n this.__rules__[idx].enabled = true\n result.push(name)\n })\n\n this.__cache__ = null\n return result\n }\n\n /**\n * Enable rules with given names, and disable everything else. If any rule name\n * not found - throw Error. Errors can be disabled by second param.\n *\n * See also {@link Ruler.disable}, {@link Ruler.enable}.\n */\n enableOnly (list: string | string[], ignoreInvalid = false): void {\n if (!Array.isArray(list)) { list = [list] }\n\n this.__rules__.forEach(rule => { rule.enabled = false })\n\n this.enable(list, ignoreInvalid)\n }\n\n /**\n * Disable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * See also {@link Ruler.enable}, {@link Ruler.enableOnly}.\n *\n * Returns list of found rule names (if no exception happened).\n */\n disable (list: string | string[], ignoreInvalid = false): string[] {\n if (!Array.isArray(list)) { list = [list] }\n\n const result: string[] = []\n\n // Search by name and disable\n list.forEach(name => {\n const idx = this.__find__(name)\n\n if (idx < 0) {\n if (ignoreInvalid) { return }\n throw new Error(`Rules manager: invalid rule name ${name}`)\n }\n this.__rules__[idx].enabled = false\n result.push(name)\n })\n\n this.__cache__ = null\n return result\n }\n\n /**\n * Return array of active functions (rules) for given chain name. It analyzes\n * rules configuration, compiles caches if not exists and returns result.\n *\n * Default chain name is `''` (empty string). It can't be skipped. That's\n * done intentionally, to keep signature monomorphic for high speed.\n */\n getRules (chainName: string): Array<(...args: Args) => Result> {\n if (!this.__cache__) this.__compile__()\n\n // Chain can be empty, if rules disabled. But we still have to return Array.\n return this.__cache__![chainName] || []\n }\n}\n\nexport default Ruler\n","import { unescapeAll, escapeHtml } from './common/utils.ts'\nimport type Token from './token.ts'\nimport type { Env, MarkdownItOptions } from './types.ts'\n\n/** Function that renders a token at a given position in a token stream. */\nexport type RendererRule = (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>,\n env: Env | undefined,\n renderer: Renderer\n) => string\n\nconst default_rules: Record<string, RendererRule> = {}\n\ndefault_rules.code_inline = function (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>,\n env: Env | undefined,\n slf: Renderer\n): string {\n const token = tokens[idx]\n\n return `<code${slf.renderAttrs(token)}>${escapeHtml(token.content)}</code>`\n}\n\ndefault_rules.code_block = function (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>,\n env: Env | undefined,\n slf: Renderer\n): string {\n const token = tokens[idx]\n\n return `<pre${slf.renderAttrs(token)}><code>${escapeHtml(tokens[idx].content)}</code></pre>\\n`\n}\n\ndefault_rules.fence = function (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>,\n env: Env | undefined,\n slf: Renderer\n): string {\n const token = tokens[idx]\n const info = token.info ? unescapeAll(token.info).trim() : ''\n let langName = ''\n let langAttrs = ''\n\n if (info) {\n const arr = info.split(/(\\s+)/g)\n langName = arr[0]\n langAttrs = arr.slice(2).join('')\n }\n\n let highlighted\n if (options.highlight) {\n highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content)\n } else {\n highlighted = escapeHtml(token.content)\n }\n\n if (highlighted.indexOf('<pre') === 0) {\n return highlighted + '\\n'\n }\n\n // If language exists, inject class gently, without modifying original token.\n // May be, one day we will add .deepClone() for token and simplify this part, but\n // now we prefer to keep things local.\n if (info) {\n const i = token.attrIndex('class')\n const tmpAttrs = token.attrs ? token.attrs.slice() : []\n\n if (i < 0) {\n tmpAttrs.push(['class', `${options.langPrefix}${langName}`])\n } else {\n tmpAttrs[i] = [tmpAttrs[i][0], tmpAttrs[i][1]] // shallow clone\n tmpAttrs[i][1] += ` ${options.langPrefix}${langName}`\n }\n\n // Fake token just to render attributes\n const tmpToken = {\n attrs: tmpAttrs\n }\n\n return `<pre><code${slf.renderAttrs(tmpToken)}>${highlighted}</code></pre>\\n`\n }\n\n return `<pre><code${slf.renderAttrs(token)}>${highlighted}</code></pre>\\n`\n}\n\ndefault_rules.image = function (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>,\n env: Env | undefined,\n slf: Renderer\n): string {\n const token = tokens[idx]\n\n // \"alt\" attr MUST be set, even if empty. Because it's mandatory and\n // should be placed on proper position for tests.\n //\n // Replace content with actual value\n\n token.attrs![token.attrIndex('alt')][1] =\n slf.renderInlineAsText(token.children!, options, env)\n\n return slf.renderToken(tokens, idx, options)\n}\n\ndefault_rules.hardbreak = function (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>\n): string {\n return options.xhtmlOut ? '<br />\\n' : '<br>\\n'\n}\ndefault_rules.softbreak = function (\n tokens: Token[],\n idx: number,\n options: Required<MarkdownItOptions>\n): string {\n return options.breaks ? (options.xhtmlOut ? '<br />\\n' : '<br>\\n') : '\\n'\n}\n\ndefault_rules.text = function (tokens: Token[], idx: number): string {\n return escapeHtml(tokens[idx].content)\n}\n\ndefault_rules.html_block = function (tokens: Token[], idx: number): string {\n return tokens[idx].content\n}\ndefault_rules.html_inline = function (tokens: Token[], idx: number): string {\n return tokens[idx].content\n}\n\n/**\n * Generates HTML from parsed token stream. Each instance has independent\n * copy of rules. Those can be rewritten with ease. Also, you can add new\n * rules if you create plugin and adds new token types.\n *\n * Creates new renderer instance and fills {@link Renderer.rules} with defaults.\n */\nclass Renderer {\n /**\n * Contains render rules for tokens. Can be updated and extended.\n *\n * See [source code](https://github.com/markdown-it/markdown-it/blob/master/src/renderer.ts)\n * for more details and examples.\n *\n * @example Custom render rules\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * md.renderer.rules.strong_open = function () { return '<b>'; };\n * md.renderer.rules.strong_close = function () { return '</b>'; };\n *\n * const result = md.renderInline(...);\n * ```\n *\n * @example Each rule is called as independent static function with fixed signature\n * ```javascript\n * function my_token_render(tokens, idx, options, env, renderer) {\n * // ...\n * return renderedHTML;\n * }\n * ```\n */\n rules: Record<string, RendererRule> = Object.assign({}, default_rules)\n\n /**\n * Render token attributes to string.\n */\n renderAttrs (token: Pick<Token, 'attrs'>): string {\n let i, l, result\n\n if (!token.attrs) { return '' }\n\n result = ''\n\n for (i = 0, l = token.attrs.length; i < l; i++) {\n result += ` ${escapeHtml(token.attrs[i][0])}=\"${escapeHtml(String(token.attrs[i][1]))}\"`\n }\n\n return result\n }\n\n /**\n * Default token renderer. Can be overriden by custom function\n * in {@link Renderer.rules}.\n */\n renderToken (tokens: Token[], idx: number, options: Required<MarkdownItOptions>): string {\n const token = tokens[idx]\n let result = ''\n\n // Tight list paragraphs\n if (token.hidden) {\n return ''\n }\n\n // Insert a newline between hidden paragraph and subsequent opening\n // block-level tag.\n //\n // For example, here we should insert a newline before blockquote:\n // - a\n // >\n //\n // Only closing hidden tokens count, to not break on other hidden ones.\n //\n // Hidden tokens without nesting (`reference_definition`) are skipped here\n // and below, or they would break line feeds around neighbour blocks.\n //\n let prev = idx - 1\n while (prev >= 0 && tokens[prev].hidden && tokens[prev].nesting === 0) { prev-- }\n\n if (token.block && token.nesting !== -1 && prev >= 0 &&\n tokens[prev].hidden && tokens[prev].nesting === -1) {\n result += '\\n'\n }\n\n // Add token name, e.g. `<img`\n result += (token.nesting === -1 ? '</' : '<') + token.tag\n\n // Encode attributes, e.g. `<img src=\"foo\"`\n result += this.renderAttrs(token)\n\n // Add a slash for self-closing tags, e.g. `<img src=\"foo\" /`\n if (token.nesting === 0 && options.xhtmlOut) {\n result += ' /'\n }\n\n // Check if we need to add a newline after this tag\n let needLf = false\n if (token.block) {\n needLf = true\n\n if (token.nesting === 1) {\n let next = idx + 1\n while (next < tokens.length && tokens[next].hidden && tokens[next].nesting === 0) { next++ }\n\n if (next < tokens.length) {\n const nextToken = tokens[next]\n\n if (nextToken.type === 'inline' || nextToken.hidden) {\n // Block-level tag containing an inline tag.\n //\n needLf = false\n } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {\n // Opening tag + closing tag of the same type. E.g. `<li></li>`.\n //\n needLf = false\n }\n }\n }\n }\n\n result += needLf ? '>\\n' : '>'\n\n return result\n }\n\n /**\n * The same as {@link Renderer.render}, but for single token of `inline` type.\n */\n renderInline (tokens: Token[], options: Required<MarkdownItOptions>, env: Env | undefined): string {\n let result = ''\n const rules = this.rules\n\n for (let i = 0, len = tokens.length; i < len; i++) {\n const type = tokens[i].type\n\n if (typeof rules[type] !== 'undefined') {\n result += rules[type](tokens, i, options, env, this)\n } else {\n result += this.renderToken(tokens, i, options)\n }\n }\n\n return result\n }\n\n /**\n * Special kludge for image `alt` attributes to conform CommonMark spec.\n * Don't try to use it! Spec requires to show `alt` content with stripped markup,\n * instead of simple escaping.\n */\n renderInlineAsText (tokens: Token[], options: Required<MarkdownItOptions>, env: Env | undefined): string {\n let result = ''\n\n for (let i = 0, len = tokens.length; i < len; i++) {\n switch (tokens[i].type) {\n case 'text':\n case 'code_inline':\n // code content is added as plain text, without backticks\n result += tokens[i].content\n break\n case 'image':\n result += this.renderInlineAsText(tokens[i].children!, options, env)\n break\n case 'html_inline':\n case 'html_block':\n result += tokens[i].content\n break\n case 'softbreak':\n case 'hardbreak':\n result += '\\n'\n break\n default:\n // all other tokens are skipped\n }\n }\n\n return result\n }\n\n /**\n * Takes token stream and generates HTML. Probably, you will never need to call\n * this method directly.\n */\n render (tokens: Token[], options: Required<MarkdownItOptions>, env?: Env): string {\n let result = ''\n const rules = this.rules\n\n for (let i = 0, len = tokens.length; i < len; i++) {\n const type = tokens[i].type\n\n if (type === 'inline') {\n result += this.renderInline(tokens[i].children!, options, env)\n } else if (typeof rules[type] !== 'undefined') {\n result += rules[type](tokens, i, options, env, this)\n } else {\n result += this.renderToken(tokens, i, options)\n }\n }\n\n return result\n }\n}\n\nexport default Renderer\n","import Token from '../token.ts'\nimport type MarkdownIt from '../markdownit.ts'\nimport type { Env } from '../types.ts'\n\n/** Mutable state passed through the core rules chain. */\nclass StateCore {\n declare src: string\n declare env: Env\n tokens: Token[] = []\n inlineMode = false\n declare md: MarkdownIt\n\n // re-export Token class to use in core rules\n Token = Token\n\n constructor (src: string, md: MarkdownIt, env: Env) {\n this.src = src\n this.env = env\n this.md = md // link to parser instance\n }\n}\n\nexport default StateCore\n","// Normalize input string\n\nimport type StateCore from './state_core.ts'\n\n// https://spec.commonmark.org/0.29/#line-ending\nconst UNNORMALIZED_NEWLINE_RE = /\\r\\n?/g\nconst NULL_RE = /\\0/g\n\nexport default function normalize (state: StateCore): void {\n let str\n\n // Normalize newlines\n str = state.src.replace(UNNORMALIZED_NEWLINE_RE, '\\n')\n\n // Replace NULL characters\n str = str.replace(NULL_RE, '\\uFFFD')\n\n state.src = str\n}\n","import type StateCore from './state_core.ts'\n\nexport default function block (state: StateCore): void {\n let token\n\n if (state.inlineMode) {\n token = new state.Token('inline', '', 0)\n token.content = state.src\n token.map = [0, 1]\n token.children = []\n state.tokens.push(token)\n } else {\n state.md.block.parse(state.src, state.md, state.env, state.tokens)\n }\n}\n","// Drop `reference_definition` tokens to keep the stream backward compatible\n//\n// Those tokens mark places link definitions took in the source. They are new,\n// and plugins walking block tokens may not expect them, so by default the\n// stream stays as it always was. Disable this rule to opt in.\n//\n\nimport type StateCore from './state_core.ts'\n\nexport default function strip_references (state: StateCore): void {\n const tokens = state.tokens\n let last = 0\n\n for (let curr = 0; curr < tokens.length; curr++) {\n if (tokens[curr].type === 'reference_definition') continue\n\n if (curr !== last) { tokens[last] = tokens[curr] }\n\n last++\n }\n\n if (tokens.length !== last) { tokens.length = last }\n}\n","import type StateCore from './state_core.ts'\n\nexport default function inline (state: StateCore): void {\n const tokens = state.tokens\n\n // Parse inlines\n for (let i = 0, l = tokens.length; i < l; i++) {\n const tok = tokens[i]\n if (tok.type === 'inline') {\n state.md.inline.parse(tok.content, state.md, state.env, tok.children!)\n }\n }\n}\n","// Replace link-like texts with link nodes.\n//\n// Currently restricted by `md.validateLink()` to http/https/ftp\n//\n\nimport type StateCore from './state_core.ts'\n\nfunction isLinkOpen (str: string) {\n return /^<a[>\\s]/i.test(str)\n}\nfunction isLinkClose (str: string) {\n return /^<\\/a\\s*>/i.test(str)\n}\n\nexport default function linkify (state: StateCore): void {\n const blockTokens = state.tokens\n\n if (!state.md.options.linkify) { return }\n\n for (let j = 0, l = blockTokens.length; j < l; j++) {\n if (blockTokens[j].type !== 'inline' ||\n !state.md.linkify.test(blockTokens[j].content)) {\n continue\n }\n\n const tokens = blockTokens[j].children!\n const replacements: Array<{ index: number, nodes: typeof tokens }> = []\n\n let htmlLinkLevel = 0\n\n // We scan from the end, to keep position when new tags added.\n // Use reversed logic in links start/end match\n for (let i = tokens.length - 1; i >= 0; i--) {\n const currentToken = tokens[i]\n\n // Skip content of markdown links\n if (currentToken.type === 'link_close') {\n i--\n while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {\n i--\n }\n continue\n }\n\n // Skip content of html tag links\n if (currentToken.type === 'html_inline') {\n if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {\n htmlLinkLevel--\n }\n if (isLinkClose(currentToken.content)) {\n htmlLinkLevel++\n }\n }\n if (htmlLinkLevel > 0) { continue }\n\n if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {\n const text = currentToken.content\n let links = state.md.linkify.match(text)!\n\n // Now split string to nodes\n const nodes = []\n let level = currentToken.level\n let lastPos = 0\n\n // forbid escape sequence at the start of the string,\n // this avoids http\\://example.com/ from being linkified as\n // http:<a href=\"//example.com/\">//example.com/</a>\n if (links.length > 0 &&\n links[0].index === 0 &&\n i > 0 &&\n tokens[i - 1].type === 'text_special') {\n links = links.slice(1)\n }\n\n for (let ln = 0; ln < links.length; ln++) {\n const url = links[ln].url\n const fullUrl = state.md.normalizeLink(url)\n if (!state.md.validateLink(fullUrl)) { continue }\n\n let urlText = links[ln].text\n\n // Linkifier might send raw hostnames like \"example.com\", where url\n // starts with domain name. So we prepend http:// in those cases,\n // and remove it afterwards.\n //\n if (!links[ln].schema) {\n urlText = state.md.normalizeLinkText(`http://${urlText}`).replace(/^http:\\/\\//, '')\n } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {\n urlText = state.md.normalizeLinkText(`mailto:${urlText}`).replace(/^mailto:/, '')\n } else {\n urlText = state.md.normalizeLinkText(urlText)\n }\n\n const pos = links[ln].index\n\n if (pos > lastPos) {\n const token = new state.Token('text', '', 0)\n token.content = text.slice(lastPos, pos)\n token.level = level\n nodes.push(token)\n }\n\n const token_o = new state.Token('link_open', 'a', 1)\n token_o.attrs = [['href', fullUrl]]\n token_o.level = level++\n token_o.markup = 'linkify'\n token_o.info = 'auto'\n nodes.push(token_o)\n\n const token_t = new state.Token('text', '', 0)\n token_t.content = urlText\n token_t.level = level\n nodes.push(token_t)\n\n const token_c = new state.Token('link_close', 'a', -1)\n token_c.level = --level\n token_c.markup = 'linkify'\n token_c.info = 'auto'\n nodes.push(token_c)\n\n lastPos = links[ln].lastIndex\n }\n if (lastPos < text.length) {\n const token = new state.Token('text', '', 0)\n token.content = text.slice(lastPos)\n token.level = level\n nodes.push(token)\n }\n\n replacements.push({ index: i, nodes })\n }\n }\n\n if (replacements.length > 0) {\n let newTokensLength = tokens.length\n for (const replacement of replacements) {\n newTokensLength += replacement.nodes.length - 1\n }\n\n const newTokens = new Array<(typeof tokens)[number]>(newTokensLength)\n let replacementIndex = 0\n let newTokenIndex = 0\n\n replacements.reverse()\n\n for (let i = 0; i < tokens.length; i++) {\n const replacement = replacements[replacementIndex]\n\n if (replacement?.index === i) {\n for (const node of replacement.nodes) {\n newTokens[newTokenIndex++] = node\n }\n replacementIndex++\n } else {\n newTokens[newTokenIndex++] = tokens[i]\n }\n }\n\n blockTokens[j].children = newTokens\n }\n }\n}\n","// Simple typographic replacements\n//\n// (c) (C) → ©\n// (tm) (TM) → ™\n// (r) (R) → ®\n// +- → ±\n// ... → … (also ?.... → ?.., !.... → !..)\n// ???????? → ???, !!!!! → !!!, `,,` → `,`\n// -- → –, --- → —\n//\n\n// TODO:\n// - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾\n// - multiplications 2 x 4 -> 2 × 4\n\nimport type StateCore from './state_core.ts'\nimport type Token from '../token.ts'\n\nconst RARE_RE = /\\+-|\\.\\.|\\?\\?\\?\\?|!!!!|,,|--/\n\n// Workaround for phantomjs - need regex without /g flag,\n// or root check will fail every second time\nconst SCOPED_ABBR_TEST_RE = /\\((c|tm|r)\\)/i\n\nconst SCOPED_ABBR_RE = /\\((c|tm|r)\\)/ig\nconst SCOPED_ABBR: Record<string, string> = {\n c: '©',\n r: '®',\n tm: '™'\n}\n\nfunction replaceFn (match: string, name: string) {\n return SCOPED_ABBR[name.toLowerCase()]\n}\n\nfunction replace_scoped (inlineTokens: Token[]) {\n let inside_autolink = 0\n\n for (let i = inlineTokens.length - 1; i >= 0; i--) {\n const token = inlineTokens[i]\n\n if (token.type === 'text' && !inside_autolink) {\n token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn)\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++\n }\n }\n}\n\nfunction replace_rare (inlineTokens: Token[]) {\n let inside_autolink = 0\n\n for (let i = inlineTokens.length - 1; i >= 0; i--) {\n const token = inlineTokens[i]\n\n if (token.type === 'text' && !inside_autolink) {\n if (RARE_RE.test(token.content)) {\n token.content = token.content\n .replace(/\\+-/g, '±')\n // .., ..., ....... -> …\n // but ?..... & !..... -> ?.. & !..\n .replace(/\\.{2,}/g, '…').replace(/([?!])…/g, '$1..')\n .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')\n // em-dash\n .replace(/(^|[^-])---(?=[^-]|$)/mg, '$1\\u2014')\n // en-dash\n .replace(/(^|\\s)--(?=\\s|$)/mg, '$1\\u2013')\n .replace(/(^|[^-\\s])--(?=[^-\\s]|$)/mg, '$1\\u2013')\n }\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++\n }\n }\n}\n\nexport default function replace (state: StateCore): void {\n let blkIdx\n\n if (!state.md.options.typographer) { return }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n if (state.tokens[blkIdx].type !== 'inline') { continue }\n\n if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {\n replace_scoped(state.tokens[blkIdx].children!)\n }\n\n if (RARE_RE.test(state.tokens[blkIdx].content)) {\n replace_rare(state.tokens[blkIdx].children!)\n }\n }\n}\n","// Convert straight quotation marks to typographic ones\n//\n\nimport { isWhiteSpace, isPunctCharCode, isMdAsciiPunct } from '../common/utils.ts'\nimport type Token from '../token.ts'\nimport type StateCore from './state_core.ts'\n\nconst QUOTE_TEST_RE = /['\"]/\nconst QUOTE_RE = /['\"]/g\nconst APOSTROPHE = '\\u2019' /* ’ */\n\ninterface Replacement {\n pos: number\n ch: string\n}\n\ntype ReplacementMap = Record<string, Replacement[]>\n\nfunction addReplacement (\n replacements: ReplacementMap,\n tokenIdx: number,\n pos: number,\n ch: string\n) {\n if (!replacements[tokenIdx]) {\n replacements[tokenIdx] = []\n }\n\n replacements[tokenIdx].push({ pos, ch })\n}\n\nfunction applyReplacements (str: string, replacements: Replacement[]) {\n let result = ''\n let lastPos = 0\n\n replacements.sort((a, b) => a.pos - b.pos)\n\n for (let i = 0; i < replacements.length; i++) {\n const replacement = replacements[i]\n\n result += str.slice(lastPos, replacement.pos) + replacement.ch\n lastPos = replacement.pos + 1\n }\n\n return result + str.slice(lastPos)\n}\n\nfunction process_inlines (tokens: Token[], state: StateCore) {\n let j\n\n const stack = []\n // token index -> list of replacements in the original token content\n const replacements: ReplacementMap = {}\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]\n\n const thisLevel = tokens[i].level\n\n for (j = stack.length - 1; j >= 0; j--) {\n if (stack[j].level <= thisLevel) { break }\n }\n stack.length = j + 1\n\n if (token.type !== 'text') { continue }\n\n const text = token.content\n let pos = 0\n const max = text.length\n\n /* eslint no-labels:0,block-scoped-var:0 */\n OUTER:\n while (pos < max) {\n QUOTE_RE.lastIndex = pos\n const t = QUOTE_RE.exec(text)\n if (!t) { break }\n\n let canOpen = true\n let canClose = true\n pos = t.index + 1\n const isSingle = (t[0] === \"'\")\n\n // Find previous character,\n // default to space if it's the beginning of the line\n //\n let lastChar = 0x20\n\n if (t.index - 1 >= 0) {\n lastChar = text.charCodeAt(t.index - 1)\n } else {\n for (j = i - 1; j >= 0; j--) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break // lastChar defaults to 0x20\n if (!tokens[j].content) continue // should skip all tokens except 'text', 'html_inline' or 'code_inline'\n\n lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1)\n break\n }\n }\n\n // Find next character,\n // default to space if it's the end of the line\n //\n let nextChar = 0x20\n\n if (pos < max) {\n nextChar = text.charCodeAt(pos)\n } else {\n for (j = i + 1; j < tokens.length; j++) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break // nextChar defaults to 0x20\n if (!tokens[j].content) continue // should skip all tokens except 'text', 'html_inline' or 'code_inline'\n\n nextChar = tokens[j].content.charCodeAt(0)\n break\n }\n }\n\n const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar)\n const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar)\n\n const isLastWhiteSpace = isWhiteSpace(lastChar)\n const isNextWhiteSpace = isWhiteSpace(nextChar)\n\n if (isNextWhiteSpace) {\n canOpen = false\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n canOpen = false\n }\n }\n\n if (isLastWhiteSpace) {\n canClose = false\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n canClose = false\n }\n }\n\n if (nextChar === 0x22 /* \" */ && t[0] === '\"') {\n if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {\n // special case: 1\"\" - count first quote as an inch\n canClose = canOpen = false\n }\n }\n\n if (canOpen && canClose) {\n // Replace quotes in the middle of punctuation sequence, but not\n // in the middle of the words, i.e.:\n //\n // 1. foo \" bar \" baz - not replaced\n // 2. foo-\"-bar-\"-baz - replaced\n // 3. foo\"bar\"baz - not replaced\n //\n canOpen = isLastPunctChar\n canClose = isNextPunctChar\n }\n\n if (!canOpen && !canClose) {\n // middle of word\n if (isSingle) {\n addReplacement(replacements, i, t.index, APOSTROPHE)\n }\n continue\n }\n\n if (canClose) {\n // this could be a closing quote, rewind the stack to get a match\n for (j = stack.length - 1; j >= 0; j--) {\n let item = stack[j]\n if (stack[j].level < thisLevel) { break }\n if (item.single === isSingle && stack[j].level === thisLevel) {\n item = stack[j]\n\n let openQuote\n let closeQuote\n if (isSingle) {\n openQuote = state.md.options.quotes[2]\n closeQuote = state.md.options.quotes[3]\n } else {\n openQuote = state.md.options.quotes[0]\n closeQuote = state.md.options.quotes[1]\n }\n\n addReplacement(replacements, i, t.index, closeQuote)\n addReplacement(replacements, item.token, item.pos, openQuote)\n\n stack.length = j\n continue OUTER\n }\n }\n }\n\n if (canOpen) {\n stack.push({\n token: i,\n pos: t.index,\n single: isSingle,\n level: thisLevel\n })\n } else if (canClose && isSingle) {\n addReplacement(replacements, i, t.index, APOSTROPHE)\n }\n }\n }\n\n Object.keys(replacements).forEach(function (tokenIdx) {\n const idx = Number(tokenIdx)\n tokens[idx].content = applyReplacements(tokens[idx].content, replacements[tokenIdx])\n })\n}\n\nexport default function smartquotes (state: StateCore): void {\n /* eslint max-depth:0 */\n if (!state.md.options.typographer) { return }\n\n for (let blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n if (state.tokens[blkIdx].type !== 'inline' ||\n !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {\n continue\n }\n\n process_inlines(state.tokens[blkIdx].children!, state)\n }\n}\n","// Join raw text tokens with the rest of the text\n//\n// This is set as a separate rule to provide an opportunity for plugins\n// to run text replacements after text join, but before escape join.\n//\n// For example, `\\:)` shouldn't be replaced with an emoji.\n//\n\nimport type StateCore from './state_core.ts'\nimport type Token from '../token.ts'\n\nfunction join_alt (tokens: Token[]): void {\n let curr, last\n const max = tokens.length\n\n for (curr = 0; curr < max; curr++) {\n if (tokens[curr].type === 'text_special') tokens[curr].type = 'text'\n }\n\n for (curr = last = 0; curr < max; curr++) {\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content\n } else {\n if (curr !== last) { tokens[last] = tokens[curr] }\n\n last++\n }\n }\n\n if (curr !== last) tokens.length = last\n}\n\nexport default function text_join (state: StateCore): void {\n let curr, last\n const blockTokens = state.tokens\n const l = blockTokens.length\n\n for (let j = 0; j < l; j++) {\n if (blockTokens[j].type !== 'inline') continue\n\n const tokens = blockTokens[j].children!\n const max = tokens.length\n\n for (curr = 0; curr < max; curr++) {\n if (tokens[curr].type === 'text_special') tokens[curr].type = 'text'\n\n // image `alt` is parsed into its own token tree\n if (tokens[curr].children) join_alt(tokens[curr].children!)\n }\n\n for (curr = last = 0; curr < max; curr++) {\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content\n } else {\n if (curr !== last) { tokens[last] = tokens[curr] }\n\n last++\n }\n }\n\n if (curr !== last) tokens.length = last\n }\n}\n","import Ruler from './ruler.ts'\nimport StateCore from './rules_core/state_core.ts'\n\nimport r_normalize from './rules_core/normalize.ts'\nimport r_block from './rules_core/block.ts'\nimport r_strip_references from './rules_core/strip_references.ts'\nimport r_inline from './rules_core/inline.ts'\nimport r_linkify from './rules_core/linkify.ts'\nimport r_replacements from './rules_core/replacements.ts'\nimport r_smartquotes from './rules_core/smartquotes.ts'\nimport r_text_join from './rules_core/text_join.ts'\n\nconst _rules: Array<[\n name: string,\n rule: (state: StateCore) => void\n]> = [\n ['normalize', r_normalize],\n ['block', r_block],\n ['strip_references', r_strip_references],\n ['inline', r_inline],\n ['linkify', r_linkify],\n ['replacements', r_replacements],\n ['smartquotes', r_smartquotes],\n // `text_join` finds `text_special` tokens (for escape sequences)\n // and joins them with the rest of the text\n ['text_join', r_text_join]\n]\n\n/**\n * Top-level rules executor. Glues block/inline parsers and does intermediate\n * transformations.\n */\nclass ParserCore {\n /**\n * {@link Ruler} instance. Keep configuration of core rules.\n */\n ruler = new Ruler<[StateCore], void>()\n\n State = StateCore\n\n constructor () {\n for (let i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1])\n }\n }\n\n /**\n * Executes core chain rules.\n */\n process (state: StateCore): void {\n const rules = this.ruler.getRules('')\n\n for (let i = 0, l = rules.length; i < l; i++) {\n rules[i](state)\n }\n }\n}\n\nexport default ParserCore\n","import Token from '../token.ts'\nimport { isSpace } from '../common/utils.ts'\nimport type MarkdownIt from '../markdownit.ts'\nimport type { Env } from '../types.ts'\n\n/** Mutable state passed to block rules while tokenizing a source document. */\nclass StateBlock {\n declare src: string\n declare md: MarkdownIt\n declare env: Env\n declare tokens: Token[]\n\n bMarks: number[] = [] // line begin offsets for fast jumps\n eMarks: number[] = [] // line end offsets for fast jumps\n tShift: number[] = [] // offsets of the first non-space characters (tabs not expanded)\n sCount: number[] = [] // indents for each line (tabs expanded)\n\n // An amount of virtual spaces (tabs expanded) between beginning\n // of each line (bMarks) and real beginning of that line.\n //\n // It exists only as a hack because blockquotes override bMarks\n // losing information in the process.\n //\n // It's used only when expanding tabs, you can think about it as\n // an initial tab length, e.g. bsCount=21 applied to string `\\t123`\n // means first tab should be expanded to 4-21%4 === 3 spaces.\n //\n bsCount: number[] = []\n\n // block parser variables\n\n // required block content indent (for example, if we are\n // inside a list, it would be positioned after list marker)\n blkIndent = 0\n line = 0 // line index in src\n lineMax = 0 // lines count\n tight = false // loose/tight mode for lists\n listIndent = -1 // indent of the current list block (-1 if there isn't any)\n\n // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'\n // used in lists to determine if they interrupt a paragraph\n parentType = 'root'\n\n level = 0\n\n // re-export Token class to use in block rules\n Token = Token\n\n constructor (src: string, md: MarkdownIt, env: Env, tokens: Token[]) {\n this.src = src\n\n // link to parser instance\n this.md = md\n\n this.env = env\n\n //\n // Internal state vartiables\n //\n\n this.tokens = tokens\n\n // Create caches\n // Generate markers.\n const s = this.src\n\n for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {\n const ch = s.charCodeAt(pos)\n\n if (!indent_found) {\n if (isSpace(ch)) {\n indent++\n\n if (ch === 0x09) {\n offset += 4 - offset % 4\n } else {\n offset++\n }\n continue\n } else {\n indent_found = true\n }\n }\n\n if (ch === 0x0A || pos === len - 1) {\n if (ch !== 0x0A) { pos++ }\n this.bMarks.push(start)\n this.eMarks.push(pos)\n this.tShift.push(indent)\n this.sCount.push(offset)\n this.bsCount.push(0)\n\n indent_found = false\n indent = 0\n offset = 0\n start = pos + 1\n }\n }\n\n // Push fake entry to simplify cache bounds checks\n this.bMarks.push(s.length)\n this.eMarks.push(s.length)\n this.tShift.push(0)\n this.sCount.push(0)\n this.bsCount.push(0)\n\n this.lineMax = this.bMarks.length - 1 // don't count last fake line\n }\n\n // Push new token to \"stream\".\n //\n push (type: string, tag: string, nesting: -1 | 0 | 1): Token {\n const token = new Token(type, tag, nesting)\n token.block = true\n\n if (nesting < 0) this.level-- // closing tag\n token.level = this.level\n if (nesting > 0) this.level++ // opening tag\n\n this.tokens.push(token)\n return token\n }\n\n isEmpty (line: number): boolean {\n return this.bMarks[line] + this.tShift[line] >= this.eMarks[line]\n }\n\n skipEmptyLines (from: number): number {\n for (let max = this.lineMax; from < max; from++) {\n if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {\n break\n }\n }\n return from\n }\n\n // Skip spaces from given position.\n skipSpaces (pos: number): number {\n for (let max = this.src.length; pos < max; pos++) {\n const ch = this.src.charCodeAt(pos)\n if (!isSpace(ch)) { break }\n }\n return pos\n }\n\n // Skip spaces from given position in reverse.\n skipSpacesBack (pos: number, min: number): number {\n if (pos <= min) { return pos }\n\n while (pos > min) {\n if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1 }\n }\n return pos\n }\n\n // Skip char codes from given position\n skipChars (pos: number, code: number): number {\n for (let max = this.src.length; pos < max; pos++) {\n if (this.src.charCodeAt(pos) !== code) { break }\n }\n return pos\n }\n\n // Skip char codes reverse from given position - 1\n skipCharsBack (pos: number, code: number, min: number): number {\n if (pos <= min) { return pos }\n\n while (pos > min) {\n if (code !== this.src.charCodeAt(--pos)) { return pos + 1 }\n }\n return pos\n }\n\n // cut lines range from source.\n getLines (begin: number, end: number, indent: number, keepLastLF: boolean): string {\n if (begin >= end) {\n return ''\n }\n\n const queue = new Array(end - begin)\n\n for (let i = 0, line = begin; line < end; line++, i++) {\n let lineIndent = 0\n const lineStart = this.bMarks[line]\n let first = lineStart\n let last\n\n if (line + 1 < end || keepLastLF) {\n // No need for bounds check because we have fake entry on tail.\n last = this.eMarks[line] + 1\n } else {\n last = this.eMarks[line]\n }\n\n while (first < last && lineIndent < indent) {\n const ch = this.src.charCodeAt(first)\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4\n } else {\n lineIndent++\n }\n } else if (first - lineStart < this.tShift[line]) {\n // patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent++\n } else {\n break\n }\n\n first++\n }\n\n if (lineIndent > indent) {\n // partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n // with indent=2 becomes ' \\tfoobar'\n queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last)\n } else {\n queue[i] = this.src.slice(first, last)\n }\n }\n\n return queue.join('')\n }\n}\n\nexport default StateBlock\n","// GFM table, https://github.github.com/gfm/#tables-extension-\n\nimport { isSpace } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\n// Limit the amount of empty autocompleted cells in a table,\n// see https://github.com/markdown-it/markdown-it/issues/1000,\n//\n// Both pulldown-cmark and commonmark-hs limit the number of cells this way to ~200k.\n// We set it to 65k, which can expand user input by a factor of x370\n// (256x256 square is 1.8kB expanded into 650kB).\nconst MAX_AUTOCOMPLETED_CELLS = 0x10000\n\nfunction getLine (state: StateBlock, line: number) {\n const pos = state.bMarks[line] + state.tShift[line]\n const max = state.eMarks[line]\n\n return state.src.slice(pos, max)\n}\n\nfunction escapedSplit (str: string) {\n const result = []\n const max = str.length\n\n let pos = 0\n let ch = str.charCodeAt(pos)\n let isEscaped = false\n let lastPos = 0\n let current = ''\n\n while (pos < max) {\n if (ch === 0x7c/* | */) {\n if (!isEscaped) {\n // pipe separating cells, '|'\n result.push(current + str.substring(lastPos, pos))\n current = ''\n lastPos = pos + 1\n } else {\n // escaped pipe, '\\|'\n current += str.substring(lastPos, pos - 1)\n lastPos = pos\n }\n }\n\n isEscaped = (ch === 0x5c/* \\ */)\n pos++\n\n ch = str.charCodeAt(pos)\n }\n\n result.push(current + str.substring(lastPos))\n\n return result\n}\n\nexport default function table (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n // should have at least two lines\n if (startLine + 2 > endLine) { return false }\n\n let nextLine = startLine + 1\n\n if (state.sCount[nextLine] < state.blkIndent) { return false }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { return false }\n\n // first character of the second line should be '|', '-', ':',\n // and no other characters are allowed but spaces;\n // basically, this is the equivalent of /^[-:|][-:|\\s]*$/ regexp\n\n let pos = state.bMarks[nextLine] + state.tShift[nextLine]\n if (pos >= state.eMarks[nextLine]) { return false }\n\n const firstCh = state.src.charCodeAt(pos++)\n if (firstCh !== 0x7C/* | */ && firstCh !== 0x2D/* - */ && firstCh !== 0x3A/* : */) { return false }\n\n if (pos >= state.eMarks[nextLine]) { return false }\n\n const secondCh = state.src.charCodeAt(pos++)\n if (secondCh !== 0x7C/* | */ && secondCh !== 0x2D/* - */ && secondCh !== 0x3A/* : */ && !isSpace(secondCh)) {\n return false\n }\n\n // if first character is '-', then second character must not be a space\n // (due to parsing ambiguity with list)\n if (firstCh === 0x2D/* - */ && isSpace(secondCh)) { return false }\n\n while (pos < state.eMarks[nextLine]) {\n const ch = state.src.charCodeAt(pos)\n\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false }\n\n pos++\n }\n\n let lineText = getLine(state, startLine + 1)\n let columns = lineText.split('|')\n const aligns = []\n for (let i = 0; i < columns.length; i++) {\n const t = columns[i].trim()\n if (!t) {\n // allow empty columns before and after table, but not in between columns;\n // e.g. allow ` |---| `, disallow ` ---||--- `\n if (i === 0 || i === columns.length - 1) {\n continue\n } else {\n return false\n }\n }\n\n if (!/^:?-+:?$/.test(t)) { return false }\n if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {\n aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right')\n } else if (t.charCodeAt(0) === 0x3A/* : */) {\n aligns.push('left')\n } else {\n aligns.push('')\n }\n }\n\n lineText = getLine(state, startLine).trim()\n if (lineText.indexOf('|') === -1) { return false }\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n columns = escapedSplit(lineText)\n if (columns.length && columns[0] === '') columns.shift()\n if (columns.length && columns[columns.length - 1] === '') columns.pop()\n\n // header row will define an amount of columns in the entire table,\n // and align row should be exactly the same (the rest of the rows can differ)\n const columnCount = columns.length\n if (columnCount === 0 || columnCount !== aligns.length) { return false }\n\n if (silent) { return true }\n\n const oldParentType = state.parentType\n state.parentType = 'table'\n\n // use 'blockquote' lists for termination because it's\n // the most similar to tables\n const terminatorRules = state.md.block.ruler.getRules('blockquote')\n\n const token_to = state.push('table_open', 'table', 1)\n const tableLines: [number, number] = [startLine, 0]\n token_to.map = tableLines\n\n const token_tho = state.push('thead_open', 'thead', 1)\n token_tho.map = [startLine, startLine + 1]\n\n const token_htro = state.push('tr_open', 'tr', 1)\n token_htro.map = [startLine, startLine + 1]\n\n for (let i = 0; i < columns.length; i++) {\n const token_ho = state.push('th_open', 'th', 1)\n if (aligns[i]) {\n token_ho.attrs = [['style', `text-align:${aligns[i]}`]]\n }\n\n const token_il = state.push('inline', '', 0)\n token_il.content = columns[i].trim()\n token_il.children = []\n\n state.push('th_close', 'th', -1)\n }\n\n state.push('tr_close', 'tr', -1)\n state.push('thead_close', 'thead', -1)\n\n let tbodyLines: [number, number] | undefined\n let autocompletedCells = 0\n\n for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break }\n\n let terminate = false\n for (let i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true\n break\n }\n }\n\n if (terminate) { break }\n lineText = getLine(state, nextLine).trim()\n if (!lineText) { break }\n if (state.sCount[nextLine] - state.blkIndent >= 4) { break }\n columns = escapedSplit(lineText)\n if (columns.length && columns[0] === '') columns.shift()\n if (columns.length && columns[columns.length - 1] === '') columns.pop()\n\n // note: autocomplete count can be negative if user specifies more columns than header,\n // but that does not affect intended use (which is limiting expansion)\n autocompletedCells += columnCount - columns.length\n if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) { break }\n\n if (nextLine === startLine + 2) {\n const token_tbo = state.push('tbody_open', 'tbody', 1)\n token_tbo.map = tbodyLines = [startLine + 2, 0]\n }\n\n const token_tro = state.push('tr_open', 'tr', 1)\n token_tro.map = [nextLine, nextLine + 1]\n\n for (let i = 0; i < columnCount; i++) {\n const token_tdo = state.push('td_open', 'td', 1)\n if (aligns[i]) {\n token_tdo.attrs = [['style', `text-align:${aligns[i]}`]]\n }\n\n const token_il = state.push('inline', '', 0)\n token_il.content = columns[i] ? columns[i].trim() : ''\n token_il.children = []\n\n state.push('td_close', 'td', -1)\n }\n state.push('tr_close', 'tr', -1)\n }\n\n if (tbodyLines) {\n state.push('tbody_close', 'tbody', -1)\n tbodyLines[1] = nextLine\n }\n\n state.push('table_close', 'table', -1)\n tableLines[1] = nextLine\n\n state.parentType = oldParentType\n state.line = nextLine\n return true\n}\n","// Code block (4 spaces padded)\n\nimport type StateBlock from './state_block.ts'\n\nexport default function code (state: StateBlock, startLine: number, endLine: number/*, silent */): boolean {\n if (state.sCount[startLine] - state.blkIndent < 4) { return false }\n\n let nextLine = startLine + 1\n let last = nextLine\n\n while (nextLine < endLine) {\n if (state.isEmpty(nextLine)) {\n nextLine++\n continue\n }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n nextLine++\n last = nextLine\n continue\n }\n break\n }\n\n state.line = last\n\n const token = state.push('code_block', 'code', 0)\n token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\\n'\n token.map = [startLine, state.line]\n\n return true\n}\n","// fences (``` lang, ~~~ lang)\n\nimport type StateBlock from './state_block.ts'\n\nexport default function fence (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n let max = state.eMarks[startLine]\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n if (pos + 3 > max) { return false }\n\n const marker = state.src.charCodeAt(pos)\n\n if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {\n return false\n }\n\n // scan marker length\n let mem = pos\n pos = state.skipChars(pos, marker)\n\n let len = pos - mem\n\n if (len < 3) { return false }\n\n const markup = state.src.slice(mem, pos)\n const params = state.src.slice(pos, max)\n\n if (marker === 0x60 /* ` */) {\n if (params.indexOf(String.fromCharCode(marker)) >= 0) {\n return false\n }\n }\n\n // Since start is found, we can report success here in validation mode\n if (silent) { return true }\n\n // search end of block\n let nextLine = startLine\n let haveEndMarker = false\n\n for (;;) {\n nextLine++\n if (nextLine >= endLine) {\n // unclosed block should be autoclosed by end of document.\n // also block seems to be autoclosed by end of parent\n break\n }\n\n pos = mem = state.bMarks[nextLine] + state.tShift[nextLine]\n max = state.eMarks[nextLine]\n\n if (pos < max && state.sCount[nextLine] < state.blkIndent) {\n // non-empty line with negative indent should stop the list:\n // - ```\n // test\n break\n }\n\n if (state.src.charCodeAt(pos) !== marker) { continue }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n // closing fence should be indented less than 4 spaces\n continue\n }\n\n pos = state.skipChars(pos, marker)\n\n // closing code fence must be at least as long as the opening one\n if (pos - mem < len) { continue }\n\n // make sure tail has spaces only\n pos = state.skipSpaces(pos)\n\n if (pos < max) { continue }\n\n haveEndMarker = true\n // found!\n break\n }\n\n // If a fence has heading spaces, they should be removed from its inner block\n len = state.sCount[startLine]\n\n state.line = nextLine + (haveEndMarker ? 1 : 0)\n\n const token = state.push('fence', 'code', 0)\n token.info = params\n token.content = state.getLines(startLine + 1, nextLine, len, true)\n token.markup = markup\n token.map = [startLine, state.line]\n\n return true\n}\n","// Block quotes\n\nimport { isSpace } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\nexport default function blockquote (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n let max = state.eMarks[startLine]\n\n const oldLineMax = state.lineMax\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n // check the block quote marker\n if (state.src.charCodeAt(pos) !== 0x3E/* > */) { return false }\n\n // we know that it's going to be a valid blockquote,\n // so no point trying to find the end of it in silent mode\n if (silent) { return true }\n\n const oldBMarks = []\n const oldBSCount = []\n const oldSCount = []\n const oldTShift = []\n\n const terminatorRules = state.md.block.ruler.getRules('blockquote')\n\n const oldParentType = state.parentType\n state.parentType = 'blockquote'\n let lastLineEmpty = false\n let nextLine\n\n // Search the end of the block\n //\n // Block ends with either:\n // 1. an empty line outside:\n // ```\n // > test\n //\n // ```\n // 2. an empty line inside:\n // ```\n // >\n // test\n // ```\n // 3. another tag:\n // ```\n // > test\n // - - -\n // ```\n for (nextLine = startLine; nextLine < endLine; nextLine++) {\n // check if it's outdented, i.e. it's inside list item and indented\n // less than said list item:\n //\n // ```\n // 1. anything\n // > current blockquote\n // 2. checking this line\n // ```\n const isOutdented = state.sCount[nextLine] < state.blkIndent\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine]\n max = state.eMarks[nextLine]\n\n if (pos >= max) {\n // Case 1: line is not inside the blockquote, and this line is empty.\n break\n }\n\n if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !isOutdented) {\n // This line is inside the blockquote.\n\n // set offset past spaces and \">\"\n let initial = state.sCount[nextLine] + 1\n let spaceAfterMarker\n let adjustTab\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++\n initial++\n adjustTab = false\n spaceAfterMarker = true\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true\n\n if ((state.bsCount[nextLine] + initial) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++\n initial++\n adjustTab = false\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true\n }\n } else {\n spaceAfterMarker = false\n }\n\n let offset = initial\n oldBMarks.push(state.bMarks[nextLine])\n state.bMarks[nextLine] = pos\n\n while (pos < max) {\n const ch = state.src.charCodeAt(pos)\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4\n } else {\n offset++\n }\n } else {\n break\n }\n\n pos++\n }\n\n lastLineEmpty = pos >= max\n\n oldBSCount.push(state.bsCount[nextLine])\n state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0)\n\n oldSCount.push(state.sCount[nextLine])\n state.sCount[nextLine] = offset - initial\n\n oldTShift.push(state.tShift[nextLine])\n state.tShift[nextLine] = pos - state.bMarks[nextLine]\n continue\n }\n\n // Case 2: line is not inside the blockquote, and the last line was empty.\n if (lastLineEmpty) { break }\n\n // Case 3: another tag found.\n let terminate = false\n for (let i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true\n break\n }\n }\n\n if (terminate) {\n // Quirk to enforce \"hard termination mode\" for paragraphs;\n // normally if you call `tokenize(state, startLine, nextLine)`,\n // paragraphs will look below nextLine for paragraph continuation,\n // but if blockquote is terminated by another tag, they shouldn't\n state.lineMax = nextLine\n\n if (state.blkIndent !== 0) {\n // state.blkIndent was non-zero, we now set it to zero,\n // so we need to re-calculate all offsets to appear as\n // if indent wasn't changed\n oldBMarks.push(state.bMarks[nextLine])\n oldBSCount.push(state.bsCount[nextLine])\n oldTShift.push(state.tShift[nextLine])\n oldSCount.push(state.sCount[nextLine])\n state.sCount[nextLine] -= state.blkIndent\n }\n\n break\n }\n\n oldBMarks.push(state.bMarks[nextLine])\n oldBSCount.push(state.bsCount[nextLine])\n oldTShift.push(state.tShift[nextLine])\n oldSCount.push(state.sCount[nextLine])\n\n // A negative indentation means that this is a paragraph continuation\n //\n state.sCount[nextLine] = -1\n }\n\n const oldIndent = state.blkIndent\n state.blkIndent = 0\n\n const token_o = state.push('blockquote_open', 'blockquote', 1)\n token_o.markup = '>'\n const lines: [number, number] = [startLine, 0]\n token_o.map = lines\n\n state.md.block.tokenize(state, startLine, nextLine)\n\n const token_c = state.push('blockquote_close', 'blockquote', -1)\n token_c.markup = '>'\n\n state.lineMax = oldLineMax\n state.parentType = oldParentType\n lines[1] = state.line\n\n // Restore original tShift; this might not be necessary since the parser\n // has already been here, but just to make sure we can do that.\n for (let i = 0; i < oldTShift.length; i++) {\n state.bMarks[i + startLine] = oldBMarks[i]\n state.tShift[i + startLine] = oldTShift[i]\n state.sCount[i + startLine] = oldSCount[i]\n state.bsCount[i + startLine] = oldBSCount[i]\n }\n state.blkIndent = oldIndent\n\n return true\n}\n","// Horizontal rule\n\nimport { isSpace } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\nexport default function hr (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n const max = state.eMarks[startLine]\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n const marker = state.src.charCodeAt(pos++)\n\n // Check hr marker\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x5F/* _ */) {\n return false\n }\n\n // markers can be mixed with spaces, but there should be at least 3 of them\n\n let cnt = 1\n while (pos < max) {\n const ch = state.src.charCodeAt(pos++)\n if (ch !== marker && !isSpace(ch)) { return false }\n if (ch === marker) { cnt++ }\n }\n\n if (cnt < 3) { return false }\n\n if (silent) { return true }\n\n state.line = startLine + 1\n\n const token = state.push('hr', 'hr', 0)\n token.map = [startLine, state.line]\n token.markup = Array(cnt + 1).join(String.fromCharCode(marker))\n\n return true\n}\n","// Lists\n\nimport { isSpace } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\n// Search `[-+*][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipBulletListMarker (state: StateBlock, startLine: number) {\n const max = state.eMarks[startLine]\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n\n const marker = state.src.charCodeAt(pos++)\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1\n }\n\n if (pos < max) {\n const ch = state.src.charCodeAt(pos)\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1\n }\n }\n\n return pos\n}\n\n// Search `\\d+[.)][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipOrderedListMarker (state: StateBlock, startLine: number) {\n const start = state.bMarks[startLine] + state.tShift[startLine]\n const max = state.eMarks[startLine]\n let pos = start\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1 }\n\n let ch = state.src.charCodeAt(pos++)\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1 }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1 }\n\n ch = state.src.charCodeAt(pos++)\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1 }\n\n continue\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break\n }\n\n return -1\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos)\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1\n }\n }\n return pos\n}\n\nfunction markTightParagraphs (state: StateBlock, idx: number) {\n const level = state.level + 2\n\n for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) {\n if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {\n state.tokens[i + 2].hidden = true\n state.tokens[i].hidden = true\n i += 2\n }\n }\n}\n\nexport default function list (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n let max, pos, start, token\n let nextLine = startLine\n let tight = true\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { return false }\n\n // Special case:\n // - item 1\n // - item 2\n // - item 3\n // - item 4\n // - this one is a paragraph continuation\n if (state.listIndent >= 0 &&\n state.sCount[nextLine] - state.listIndent >= 4 &&\n state.sCount[nextLine] < state.blkIndent) {\n return false\n }\n\n let isTerminatingParagraph = false\n\n // limit conditions when list can interrupt\n // a paragraph (validation mode only)\n if (silent && state.parentType === 'paragraph') {\n // Next list item should still terminate previous list item;\n //\n // This code can fail if plugins use blkIndent as well as lists,\n // but I hope the spec gets fixed long before that happens.\n //\n if (state.sCount[nextLine] >= state.blkIndent) {\n isTerminatingParagraph = true\n }\n }\n\n // Detect list type and position after marker\n let isOrdered\n let markerValue\n let posAfterMarker\n if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {\n isOrdered = true\n start = state.bMarks[nextLine] + state.tShift[nextLine]\n markerValue = Number(state.src.slice(start, posAfterMarker - 1))\n\n // If we're starting a new ordered list right after\n // a paragraph, it should start with 1.\n if (isTerminatingParagraph && markerValue !== 1) return false\n } else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {\n isOrdered = false\n } else {\n return false\n }\n\n // If we're starting a new unordered list right after\n // a paragraph, first line should not be empty.\n if (isTerminatingParagraph) {\n if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false\n }\n\n // For validation mode we can terminate immediately\n if (silent) { return true }\n\n // We should terminate list on style change. Remember first one to compare.\n const markerCharCode = state.src.charCodeAt(posAfterMarker - 1)\n\n // Start list\n const listTokIdx = state.tokens.length\n\n if (isOrdered) {\n token = state.push('ordered_list_open', 'ol', 1)\n if (markerValue !== 1) {\n token.attrs = [['start', markerValue!]]\n }\n } else {\n token = state.push('bullet_list_open', 'ul', 1)\n }\n\n const listLines: [number, number] = [nextLine, 0]\n token.map = listLines\n token.markup = String.fromCharCode(markerCharCode)\n\n //\n // Iterate list items\n //\n\n let prevEmptyEnd = false\n const terminatorRules = state.md.block.ruler.getRules('list')\n\n const oldParentType = state.parentType\n state.parentType = 'list'\n\n while (nextLine < endLine) {\n pos = posAfterMarker\n max = state.eMarks[nextLine]\n\n const initial = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine])\n let offset = initial\n\n while (pos < max) {\n const ch = state.src.charCodeAt(pos)\n\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine]) % 4\n } else if (ch === 0x20) {\n offset++\n } else {\n break\n }\n\n pos++\n }\n\n const contentStart = pos\n let indentAfterMarker\n\n if (contentStart >= max) {\n // trimming space in \"- \\n 3\" case, indent is 1 here\n indentAfterMarker = 1\n } else {\n indentAfterMarker = offset - initial\n }\n\n // If we have more than 4 spaces, the indent is 1\n // (the rest is just indented code block)\n if (indentAfterMarker > 4) { indentAfterMarker = 1 }\n\n // \" - test\"\n // ^^^^^ - calculating total length of this thing\n const indent = initial + indentAfterMarker\n\n // Run subparser & write tokens\n token = state.push('list_item_open', 'li', 1)\n token.markup = String.fromCharCode(markerCharCode)\n const itemLines: [number, number] = [nextLine, 0]\n token.map = itemLines\n if (isOrdered) {\n token.info = state.src.slice(start, posAfterMarker - 1)\n }\n\n // change current state, then restore it after parser subcall\n const oldTight = state.tight\n const oldTShift = state.tShift[nextLine]\n const oldSCount = state.sCount[nextLine]\n\n // - example list\n // ^ listIndent position will be here\n // ^ blkIndent position will be here\n //\n const oldListIndent = state.listIndent\n state.listIndent = state.blkIndent\n state.blkIndent = indent\n\n state.tight = true\n state.tShift[nextLine] = contentStart - state.bMarks[nextLine]\n state.sCount[nextLine] = offset\n\n if (contentStart >= max && state.isEmpty(nextLine + 1)) {\n // workaround for this case\n // (list item is empty, list terminates before \"foo\"):\n // ~~~~~~~~\n // -\n //\n // foo\n // ~~~~~~~~\n state.line = Math.min(state.line + 2, endLine)\n } else {\n state.md.block.tokenize(state, nextLine, endLine)\n }\n\n // If any of list item is tight, mark list as tight\n if (!state.tight || prevEmptyEnd) {\n tight = false\n }\n // Item become loose if finish with empty line,\n // but we should filter last element, because it means list finish\n prevEmptyEnd = (state.line - nextLine) > 1 && state.isEmpty(state.line - 1)\n\n state.blkIndent = state.listIndent\n state.listIndent = oldListIndent\n state.tShift[nextLine] = oldTShift\n state.sCount[nextLine] = oldSCount\n state.tight = oldTight\n\n token = state.push('list_item_close', 'li', -1)\n token.markup = String.fromCharCode(markerCharCode)\n\n nextLine = state.line\n itemLines[1] = nextLine\n\n if (nextLine >= endLine) { break }\n\n //\n // Try to check if list is terminated or continued.\n //\n if (state.sCount[nextLine] < state.blkIndent) { break }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { break }\n\n // fail if terminating block found\n let terminate = false\n for (let i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true\n break\n }\n }\n if (terminate) { break }\n\n // fail if list has another type\n if (isOrdered) {\n posAfterMarker = skipOrderedListMarker(state, nextLine)\n if (posAfterMarker < 0) { break }\n start = state.bMarks[nextLine] + state.tShift[nextLine]\n } else {\n posAfterMarker = skipBulletListMarker(state, nextLine)\n if (posAfterMarker < 0) { break }\n }\n\n if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break }\n }\n\n // Finalize list\n if (isOrdered) {\n token = state.push('ordered_list_close', 'ol', -1)\n } else {\n token = state.push('bullet_list_close', 'ul', -1)\n }\n token.markup = String.fromCharCode(markerCharCode)\n\n listLines[1] = nextLine\n state.line = nextLine\n\n state.parentType = oldParentType\n\n // mark paragraphs tight if needed\n if (tight) {\n markTightParagraphs(state, listTokIdx)\n }\n\n return true\n}\n","import { isSpace, normalizeReference } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\nexport default function reference (state: StateBlock, startLine: number, _endLine: number, silent: boolean): boolean {\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n let max = state.eMarks[startLine]\n let nextLine = startLine + 1\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false }\n\n function getNextLine (nextLine: number) {\n const endLine = state.lineMax\n\n if (nextLine >= endLine || state.isEmpty(nextLine)) {\n // empty line or end of input\n return null\n }\n\n let isContinuation = false\n\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { isContinuation = true }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { isContinuation = true }\n\n if (!isContinuation) {\n const terminatorRules = state.md.block.ruler.getRules('reference')\n const oldParentType = state.parentType\n state.parentType = 'reference'\n\n // Some tags can terminate paragraph without empty line.\n let terminate = false\n for (let i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true\n break\n }\n }\n\n state.parentType = oldParentType\n if (terminate) {\n // terminated by another block\n return null\n }\n }\n\n const pos = state.bMarks[nextLine] + state.tShift[nextLine]\n const max = state.eMarks[nextLine]\n\n // max + 1 explicitly includes the newline\n return state.src.slice(pos, max + 1)\n }\n\n let str = state.src.slice(pos, max + 1)\n\n max = str.length\n let labelEnd = -1\n\n for (pos = 1; pos < max; pos++) {\n const ch = str.charCodeAt(pos)\n if (ch === 0x5B /* [ */) {\n return false\n } else if (ch === 0x5D /* ] */) {\n labelEnd = pos\n break\n } else if (ch === 0x0A /* \\n */) {\n const lineContent = getNextLine(nextLine)\n if (lineContent !== null) {\n str += lineContent\n max = str.length\n nextLine++\n }\n } else if (ch === 0x5C /* \\ */) {\n pos++\n if (pos < max && str.charCodeAt(pos) === 0x0A) {\n const lineContent = getNextLine(nextLine)\n if (lineContent !== null) {\n str += lineContent\n max = str.length\n nextLine++\n }\n }\n }\n }\n\n if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false }\n\n // [label]: destination 'title'\n // ^^^ skip optional whitespace here\n for (pos = labelEnd + 2; pos < max; pos++) {\n const ch = str.charCodeAt(pos)\n if (ch === 0x0A) {\n const lineContent = getNextLine(nextLine)\n if (lineContent !== null) {\n str += lineContent\n max = str.length\n nextLine++\n }\n } else if (isSpace(ch)) {\n /* eslint no-empty:0 */\n } else {\n break\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^^^^^ parse this\n const destRes = state.md.helpers.parseLinkDestination(str, pos, max)\n if (!destRes.ok) { return false }\n\n const href = state.md.normalizeLink(destRes.str)\n if (!state.md.validateLink(href)) { return false }\n\n pos = destRes.pos\n\n // save cursor state, we could require to rollback later\n const destEndPos = pos\n const destEndLineNo = nextLine\n\n // [label]: destination 'title'\n // ^^^ skipping those spaces\n const start = pos\n for (; pos < max; pos++) {\n const ch = str.charCodeAt(pos)\n if (ch === 0x0A) {\n const lineContent = getNextLine(nextLine)\n if (lineContent !== null) {\n str += lineContent\n max = str.length\n nextLine++\n }\n } else if (isSpace(ch)) {\n /* Nothing */\n } else {\n break\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^ parse this\n let titleRes = state.md.helpers.parseLinkTitle(str, pos, max)\n while (titleRes.can_continue) {\n const lineContent = getNextLine(nextLine)\n if (lineContent === null) break\n str += lineContent\n pos = max\n max = str.length\n nextLine++\n titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes)\n }\n let title\n\n if (pos < max && start !== pos && titleRes.ok) {\n title = titleRes.str\n pos = titleRes.pos\n } else {\n title = ''\n pos = destEndPos\n nextLine = destEndLineNo\n }\n\n // skip trailing spaces until the rest of the line\n while (pos < max) {\n const ch = str.charCodeAt(pos)\n if (!isSpace(ch)) { break }\n pos++\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n if (title) {\n // garbage at the end of the line after title,\n // but it could still be a valid reference if we roll back\n title = ''\n pos = destEndPos\n nextLine = destEndLineNo\n while (pos < max) {\n const ch = str.charCodeAt(pos)\n if (!isSpace(ch)) { break }\n pos++\n }\n }\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n // garbage at the end of the line\n return false\n }\n\n const label = normalizeReference(str.slice(1, labelEnd))\n if (!label) {\n // CommonMark 0.20 disallows empty labels\n return false\n }\n\n // Reference can not terminate anything. This check is for safety only.\n /* istanbul ignore if */\n if (silent) { return true }\n\n if (typeof state.env.references === 'undefined') {\n state.env.references = {}\n }\n if (typeof state.env.references[label] === 'undefined') {\n state.env.references[label] = { title, href }\n }\n\n // Marks the place definition took in the source. Renders to nothing,\n // href/title stay in `env.references`.\n const token = state.push('reference_definition', '', 0)\n token.map = [startLine, nextLine]\n token.hidden = true\n\n const meta: Record<string, unknown> = Object.create(null)\n meta.label = label\n token.meta = meta\n\n state.line = nextLine\n return true\n}\n","// List of valid html blocks names, according to commonmark spec\n// https://spec.commonmark.org/0.30/#html-blocks\n\nexport default [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'search',\n 'section',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n]\n","// Regexps to match html elements\n\nconst attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*'\n\nconst unquoted = '[^\"\\'=<>`\\\\x00-\\\\x20]+'\nconst single_quoted = \"'[^']*'\"\nconst double_quoted = '\"[^\"]*\"'\n\nconst attr_value = `(?:${unquoted}|${single_quoted}|${double_quoted})`\n\nconst attribute = `(?:\\\\s+${attr_name}(?:\\\\s*=\\\\s*${attr_value})?)`\n\nconst open_tag = `<[A-Za-z][A-Za-z0-9\\\\-]*${attribute}*\\\\s*\\\\/?>`\n\nconst close_tag = '<\\\\/[A-Za-z][A-Za-z0-9\\\\-]*\\\\s*>'\nconst comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->'\nconst processing = '<[?][\\\\s\\\\S]*?[?]>'\nconst declaration = '<![A-Za-z][^>]*>'\nconst cdata = '<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>'\n\nconst HTML_TAG_RE = new RegExp(\n `^(?:${open_tag}|${close_tag}|${comment}|${processing}|${declaration}|${cdata})`\n)\nconst HTML_OPEN_CLOSE_TAG_RE = new RegExp(`^(?:${open_tag}|${close_tag})`)\n\nexport { HTML_TAG_RE, HTML_OPEN_CLOSE_TAG_RE }\n","// HTML block\n\nimport block_names from '../common/html_blocks.ts'\nimport { HTML_OPEN_CLOSE_TAG_RE } from '../common/html_re.ts'\nimport type StateBlock from './state_block.ts'\n\n// An array of opening and corresponding closing sequences for html tags,\n// last argument defines whether it can terminate a paragraph or not\n//\nconst HTML_SEQUENCES: Array<[\n open: RegExp,\n close: RegExp,\n canTerminateParagraph: boolean\n]> = [\n [/^<(script|pre|style|textarea)(?=(\\s|>|$))/i, /<\\/(script|pre|style|textarea)>/i, true],\n [/^<!--/, /-->/, true],\n [/^<\\?/, /\\?>/, true],\n [/^<![A-Za-z]/, />/, true],\n [/^<!\\[CDATA\\[/, /\\]\\]>/, true],\n [new RegExp(`^</?(${block_names.join('|')})(?=(\\\\s|/?>|$))`, 'i'), /^$/, true],\n [new RegExp(`${HTML_OPEN_CLOSE_TAG_RE.source}\\\\s*$`), /^$/, false]\n]\n\nexport default function html_block (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n let max = state.eMarks[startLine]\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n if (!state.md.options.html) { return false }\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false }\n\n let lineText = state.src.slice(pos, max)\n\n let i = 0\n for (; i < HTML_SEQUENCES.length; i++) {\n if (HTML_SEQUENCES[i][0].test(lineText)) { break }\n }\n if (i === HTML_SEQUENCES.length) { return false }\n\n if (silent) {\n // true if this sequence can be a terminator, false otherwise\n return HTML_SEQUENCES[i][2]\n }\n\n let nextLine = startLine + 1\n\n // Block types 6 and 7 (the only ones whose end condition is a blank line)\n // have `/^$/` as their closing regexp. For all other types (1-5, e.g.\n // `<!--` comments), a blank line is regular content and must not terminate\n // the block - it ends only when its closing sequence is found.\n const endsOnBlankLine = HTML_SEQUENCES[i][1].test('')\n\n // If we are here - we detected HTML block.\n // Let's roll down till block end.\n if (!HTML_SEQUENCES[i][1].test(lineText)) {\n for (; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) {\n // An outdented blank line shouldn't end a block that doesn't end on a\n // blank line (e.g. a `<!--` comment inside a list item). Such blocks\n // must continue until their closing sequence regardless of indent.\n if (endsOnBlankLine || !state.isEmpty(nextLine)) { break }\n }\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine]\n max = state.eMarks[nextLine]\n lineText = state.src.slice(pos, max)\n\n if (HTML_SEQUENCES[i][1].test(lineText)) {\n if (lineText.length !== 0) { nextLine++ }\n break\n }\n }\n }\n\n state.line = nextLine\n\n const token = state.push('html_block', '', 0)\n token.map = [startLine, nextLine]\n token.content = state.getLines(startLine, nextLine, state.blkIndent, true)\n\n return true\n}\n","// heading (#, ##, ...)\n\nimport { isSpace, asciiTrim } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\nexport default function heading (state: StateBlock, startLine: number, endLine: number, silent: boolean): boolean {\n let pos = state.bMarks[startLine] + state.tShift[startLine]\n let max = state.eMarks[startLine]\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n let ch = state.src.charCodeAt(pos)\n\n if (ch !== 0x23/* # */ || pos >= max) { return false }\n\n // count heading level\n let level = 1\n ch = state.src.charCodeAt(++pos)\n while (ch === 0x23/* # */ && pos < max && level <= 6) {\n level++\n ch = state.src.charCodeAt(++pos)\n }\n\n if (level > 6 || (pos < max && !isSpace(ch))) { return false }\n\n if (silent) { return true }\n\n // Let's cut tails like ' ### ' from the end of string\n\n max = state.skipSpacesBack(max, pos)\n const tmp = state.skipCharsBack(max, 0x23, pos) // #\n if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {\n max = tmp\n }\n\n state.line = startLine + 1\n\n const token_o = state.push('heading_open', `h${level}`, 1)\n token_o.markup = '########'.slice(0, level)\n token_o.map = [startLine, state.line]\n\n const token_i = state.push('inline', '', 0)\n token_i.content = asciiTrim(state.src.slice(pos, max))\n token_i.map = [startLine, state.line]\n token_i.children = []\n\n const token_c = state.push('heading_close', `h${level}`, -1)\n token_c.markup = '########'.slice(0, level)\n\n return true\n}\n","// lheading (---, ===)\n\nimport { asciiTrim } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\nexport default function lheading (state: StateBlock, startLine: number, endLine: number/*, silent */): boolean {\n const terminatorRules = state.md.block.ruler.getRules('paragraph')\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false }\n\n const oldParentType = state.parentType\n state.parentType = 'paragraph' // use paragraph to match terminatorRules\n\n // jump line-by-line until empty one or EOF\n let level = 0\n let marker\n let nextLine = startLine + 1\n\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue }\n\n //\n // Check for underline in setext header\n //\n if (state.sCount[nextLine] >= state.blkIndent) {\n let pos = state.bMarks[nextLine] + state.tShift[nextLine]\n const max = state.eMarks[nextLine]\n\n if (pos < max) {\n marker = state.src.charCodeAt(pos)\n\n if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {\n pos = state.skipChars(pos, marker)\n pos = state.skipSpaces(pos)\n\n if (pos >= max) {\n level = (marker === 0x3D/* = */ ? 1 : 2)\n break\n }\n }\n }\n }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue }\n\n // Some tags can terminate paragraph without empty line.\n let terminate = false\n for (let i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true\n break\n }\n }\n if (terminate) { break }\n }\n\n if (!level) {\n // Didn't find valid underline\n state.parentType = oldParentType\n return false\n }\n\n const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false))\n\n state.line = nextLine + 1\n\n const token_o = state.push('heading_open', `h${level}`, 1)\n token_o.markup = String.fromCharCode(marker!)\n token_o.map = [startLine, state.line]\n\n const token_i = state.push('inline', '', 0)\n token_i.content = content\n token_i.map = [startLine, state.line - 1]\n token_i.children = []\n\n const token_c = state.push('heading_close', `h${level}`, -1)\n token_c.markup = String.fromCharCode(marker!)\n\n state.parentType = oldParentType\n\n return true\n}\n","// Paragraph\n\nimport { asciiTrim } from '../common/utils.ts'\nimport type StateBlock from './state_block.ts'\n\nexport default function paragraph (state: StateBlock, startLine: number, endLine: number): boolean {\n const terminatorRules = state.md.block.ruler.getRules('paragraph')\n const oldParentType = state.parentType\n let nextLine = startLine + 1\n state.parentType = 'paragraph'\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue }\n\n // Some tags can terminate paragraph without empty line.\n let terminate = false\n for (let i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true\n break\n }\n }\n if (terminate) { break }\n }\n\n const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false))\n\n state.line = nextLine\n\n const token_o = state.push('paragraph_open', 'p', 1)\n token_o.map = [startLine, state.line]\n\n const token_i = state.push('inline', '', 0)\n token_i.content = content\n token_i.map = [startLine, state.line]\n token_i.children = []\n\n state.push('paragraph_close', 'p', -1)\n\n state.parentType = oldParentType\n\n return true\n}\n","import Ruler from './ruler.ts'\nimport StateBlock from './rules_block/state_block.ts'\nimport type Token from './token.ts'\nimport type MarkdownIt from './markdownit.ts'\nimport type { Env } from './types.ts'\n\nimport r_table from './rules_block/table.ts'\nimport r_code from './rules_block/code.ts'\nimport r_fence from './rules_block/fence.ts'\nimport r_blockquote from './rules_block/blockquote.ts'\nimport r_hr from './rules_block/hr.ts'\nimport r_list from './rules_block/list.ts'\nimport r_reference from './rules_block/reference.ts'\nimport r_html_block from './rules_block/html_block.ts'\nimport r_heading from './rules_block/heading.ts'\nimport r_lheading from './rules_block/lheading.ts'\nimport r_paragraph from './rules_block/paragraph.ts'\n\nconst _rules: Array<[\n name: string,\n rule: (state: StateBlock, startLine: number, endLine: number, silent: boolean) => boolean,\n alt?: string[]\n]> = [\n // First 2 params - rule name & source. Secondary array - list of rules,\n // which can be terminated by this one.\n ['table', r_table, ['paragraph', 'reference']],\n ['code', r_code],\n ['fence', r_fence, ['paragraph', 'reference', 'blockquote', 'list']],\n ['blockquote', r_blockquote, ['paragraph', 'reference', 'blockquote', 'list']],\n ['hr', r_hr, ['paragraph', 'reference', 'blockquote', 'list']],\n ['list', r_list, ['paragraph', 'reference', 'blockquote']],\n ['reference', r_reference],\n ['html_block', r_html_block, ['paragraph', 'reference', 'blockquote']],\n ['heading', r_heading, ['paragraph', 'reference', 'blockquote']],\n ['lheading', r_lheading],\n ['paragraph', r_paragraph]\n]\n\n/**\n * Block-level tokenizer.\n */\nclass ParserBlock {\n /**\n * {@link Ruler} instance. Keep configuration of block rules.\n */\n ruler = new Ruler<[StateBlock, number, number, boolean], boolean>()\n\n State = StateBlock\n\n constructor () {\n for (let i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() })\n }\n }\n\n // Generate tokens for input range\n //\n tokenize (state: StateBlock, startLine: number, endLine: number): void {\n const rules = this.ruler.getRules('')\n const len = rules.length\n const maxNesting = state.md.options.maxNesting\n let line = startLine\n let hasEmptyLines = false\n\n while (line < endLine) {\n state.line = line = state.skipEmptyLines(line)\n if (line >= endLine) { break }\n\n // Termination condition for nested calls.\n // Nested calls currently used for blockquotes & lists\n if (state.sCount[line] < state.blkIndent) { break }\n\n // If nesting level exceeded - skip tail to the end. That's not ordinary\n // situation and we should not care about content.\n if (state.level >= maxNesting) {\n state.line = endLine\n break\n }\n\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.line`\n // - update `state.tokens`\n // - return true\n const prevLine = state.line\n let ok = false\n\n for (let i = 0; i < len; i++) {\n ok = rules[i](state, line, endLine, false)\n if (ok) {\n if (prevLine >= state.line) {\n throw new Error(\"block rule didn't increment state.line\")\n }\n break\n }\n }\n\n // this can only happen if user disables paragraph rule\n if (!ok) throw new Error('none of the block rules matched')\n\n // set state.tight if we had an empty line before current tag\n // i.e. latest empty line should not count\n state.tight = !hasEmptyLines\n\n // paragraph might \"eat\" one newline after it in nested lists\n if (state.isEmpty(state.line - 1)) {\n hasEmptyLines = true\n }\n\n line = state.line\n\n if (line < endLine && state.isEmpty(line)) {\n hasEmptyLines = true\n line++\n state.line = line\n }\n }\n }\n\n /**\n * Process input string and push block tokens into `outTokens`\n */\n parse (src: string, md: MarkdownIt, env: Env, outTokens: Token[]): void {\n if (!src) { return }\n\n const state = new this.State(src, md, env, outTokens)\n\n this.tokenize(state, state.line, state.lineMax)\n }\n}\n\nexport default ParserBlock\n","import Token from '../token.ts'\nimport { isWhiteSpace, isPunctCharCode, isMdAsciiPunct } from '../common/utils.ts'\nimport type MarkdownIt from '../markdownit.ts'\nimport type { Delimiter, Env } from '../types.ts'\n\n/** @inline */\ninterface ScannedDelimiters {\n can_open: boolean\n can_close: boolean\n length: number\n}\n\n/** @inline */\ntype StateTokenMeta = Record<string, unknown> & {\n delimiters?: Delimiter[]\n}\n\n/** Mutable state passed to inline rules while tokenizing inline content. */\nclass StateInline {\n declare src: string\n declare env: Env\n declare md: MarkdownIt\n declare tokens: Token[]\n declare tokens_meta: Array<StateTokenMeta | undefined>\n\n pos = 0\n declare posMax: number\n level = 0\n pending = ''\n pendingLevel = 0\n\n // Stores { start: end } pairs. Useful for backtrack\n // optimization of pairs parse (emphasis, strikes).\n cache: Record<number, number> = {}\n\n // backtick run length => position of its last run, built lazily on first use\n backticks: Record<number, number> = {}\n backticksScanned = false\n\n // Counter used to disable inline linkify-it execution\n // inside <a> and markdown links\n linkLevel = 0\n\n // List of emphasis-like delimiters for current tag\n delimiters: Delimiter[] = []\n\n // Stack of delimiter lists for upper level tags\n _prev_delimiters: Delimiter[][] = []\n\n // re-export Token class to use in block rules\n Token = Token\n\n constructor (src: string, md: MarkdownIt, env: Env, outTokens: Token[]) {\n this.src = src\n this.env = env\n this.md = md\n this.tokens = outTokens\n this.tokens_meta = Array(outTokens.length)\n\n this.posMax = this.src.length\n }\n\n // Flush pending text\n //\n pushPending (): Token {\n const token = new Token('text', '', 0)\n token.content = this.pending\n token.level = this.pendingLevel\n this.tokens.push(token)\n this.pending = ''\n return token\n }\n\n // Push new token to \"stream\".\n // If pending text exists - flush it as text token\n //\n push (type: string, tag: string, nesting: -1 | 0 | 1): Token {\n if (this.pending) {\n this.pushPending()\n }\n\n const token = new Token(type, tag, nesting)\n let token_meta = undefined\n\n if (nesting < 0) {\n // closing tag\n this.level--\n this.delimiters = this._prev_delimiters.pop()!\n }\n\n token.level = this.level\n\n if (nesting > 0) {\n // opening tag\n this.level++\n this._prev_delimiters.push(this.delimiters)\n this.delimiters = []\n token_meta = { delimiters: this.delimiters }\n }\n\n this.pendingLevel = this.level\n this.tokens.push(token)\n this.tokens_meta.push(token_meta)\n return token\n }\n\n // Scan a sequence of emphasis-like markers, and determine whether\n // it can start an emphasis sequence or end an emphasis sequence.\n //\n // - start - position to scan from (it should point at a valid marker);\n // - canSplitWord - determine if these markers can be found inside a word\n //\n scanDelims (start: number, canSplitWord: boolean): ScannedDelimiters {\n const max = this.posMax\n const marker = this.src.charCodeAt(start)\n\n // Astral characters below are combined manually, because .codePointAt()\n // does not guarantee numeric type output. And we don't wish JIT cache issues.\n // The broken surrogate pairs are evaluated as U+FFFD to prevent possible\n // crashes.\n\n let lastChar\n if (start === 0) {\n // treat beginning of the line as a whitespace\n lastChar = 0x20\n } else if (start === 1) {\n lastChar = this.src.charCodeAt(0)\n if ((lastChar & 0xF800) === 0xD800) { lastChar = 0xFFFD }\n } else {\n lastChar = this.src.charCodeAt(start - 1)\n if ((lastChar & 0xFC00) === 0xDC00) {\n // low surrogate => add high one, replace broken pair with U+FFFD\n const highSurr = this.src.charCodeAt(start - 2)\n lastChar = (highSurr & 0xFC00) === 0xD800\n ? 0x10000 + ((highSurr - 0xD800) << 10) + (lastChar - 0xDC00)\n : 0xFFFD\n } else if ((lastChar & 0xFC00) === 0xD800) {\n lastChar = 0xFFFD\n }\n }\n\n let pos = start\n while (pos < max && this.src.charCodeAt(pos) === marker) { pos++ }\n\n const count = pos - start\n\n // treat end of the line as a whitespace\n let nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20\n if ((nextChar & 0xFC00) === 0xD800) {\n // high surrogate => add low one, replace broken pair with U+FFFD\n const lowSurr = this.src.charCodeAt(pos + 1)\n nextChar = (lowSurr & 0xFC00) === 0xDC00\n ? 0x10000 + ((nextChar - 0xD800) << 10) + (lowSurr - 0xDC00)\n : 0xFFFD\n } else if ((nextChar & 0xFC00) === 0xDC00) {\n nextChar = 0xFFFD\n }\n\n const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar)\n const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar)\n\n const isLastWhiteSpace = isWhiteSpace(lastChar)\n const isNextWhiteSpace = isWhiteSpace(nextChar)\n\n const left_flanking =\n !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar)\n const right_flanking =\n !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar)\n\n const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar)\n const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar)\n\n return { can_open, can_close, length: count }\n }\n}\n\nexport default StateInline\n","// Skip text characters for text token, place those to pending buffer\n// and increment current pos\n\nimport type StateInline from './state_inline.ts'\n\n// Rule to skip pure text\n// '{}$%@~+=:' reserved for extentions\n\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n\n// !!!! Don't confuse with \"Markdown ASCII Punctuation\" chars\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\nfunction isTerminatorChar (ch: number) {\n switch (ch) {\n case 0x0A/* \\n */:\n case 0x21/* ! */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2D/* - */:\n case 0x3A/* : */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true\n default:\n return false\n }\n}\n\nexport default function text (state: StateInline, silent: boolean): boolean {\n let pos = state.pos\n\n while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {\n pos++\n }\n\n if (pos === state.pos) { return false }\n\n if (!silent) { state.pending += state.src.slice(state.pos, pos) }\n\n state.pos = pos\n\n return true\n}\n\n// Alternative implementation, for memory.\n//\n// It costs 10% of performance, but allows extend terminators list, if place it\n// to `ParserInline` property. Probably, will switch to it sometime, such\n// flexibility required.\n\n/*\nvar TERMINATOR_RE = /[\\n!#$%&*+\\-:<=>@[\\\\\\]^_`{}~]/;\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos,\n idx = state.src.slice(pos).search(TERMINATOR_RE);\n\n // first char is terminator -> empty text\n if (idx === 0) { return false; }\n\n // no terminator -> text till end of string\n if (idx < 0) {\n if (!silent) { state.pending += state.src.slice(pos); }\n state.pos = state.src.length;\n return true;\n }\n\n if (!silent) { state.pending += state.src.slice(pos, pos + idx); }\n\n state.pos += idx;\n\n return true;\n}; */\n","// Early process links like https://example.org/ to have priority\n// over emphasis, etc.\n\nimport type StateInline from './state_inline.ts'\n\n// RFC3986: scheme = ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\nfunction isAsciiAlpha (code: number): boolean {\n return (code >= 0x41 && code <= 0x5A) || (code >= 0x61 && code <= 0x7A)\n}\n\nfunction isSchemeChar (code: number): boolean {\n return (code >= 0x41 && code <= 0x5A) ||\n (code >= 0x61 && code <= 0x7A) ||\n (code >= 0x30 && code <= 0x39) ||\n code === 0x2B || code === 0x2D || code === 0x2E\n}\n\nexport default function linkify (state: StateInline, silent: boolean): boolean {\n if (!state.md.options.linkify) return false\n if (state.linkLevel > 0) return false\n\n const pos = state.pos\n const max = state.posMax\n\n if (pos + 3 > max) return false\n if (state.src.charCodeAt(pos) !== 0x3A/* : */) return false\n if (state.src.charCodeAt(pos + 1) !== 0x2F/* / */) return false\n if (state.src.charCodeAt(pos + 2) !== 0x2F/* / */) return false\n\n // Search backwards for the scheme, but no more than 10 characters, the length\n // of the pending string, or the length of the source prefix.\n // Use state.src instead of state.pending because it is faster to access.\n const protoMin = pos - Math.min(10, state.pending.length, pos)\n let protoStart = pos\n while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) {\n protoStart--\n }\n\n if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false\n\n const protoLength = pos - protoStart\n\n const link = state.md.linkify.matchAtStart(state.src.slice(protoStart))\n if (!link) return false\n\n let url = link.url\n\n // invalid link, but still detected by linkify somehow;\n // need to check to prevent infinite loop below\n if (url.length <= protoLength) return false\n\n // disallow '*' at the end of the link (conflicts with emphasis)\n // do manual backsearch to avoid perf issues with regex /\\*+$/ on \"****...****a\".\n let urlEnd = url.length\n while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 0x2A/* * */) {\n urlEnd--\n }\n if (urlEnd !== url.length) {\n url = url.slice(0, urlEnd)\n }\n\n const fullUrl = state.md.normalizeLink(url)\n if (!state.md.validateLink(fullUrl)) return false\n\n if (!silent) {\n state.pending = state.pending.slice(0, -protoLength)\n\n const token_o = state.push('link_open', 'a', 1)\n token_o.attrs = [['href', fullUrl]]\n token_o.markup = 'linkify'\n token_o.info = 'auto'\n\n const token_t = state.push('text', '', 0)\n token_t.content = state.md.normalizeLinkText(url)\n\n const token_c = state.push('link_close', 'a', -1)\n token_c.markup = 'linkify'\n token_c.info = 'auto'\n }\n\n state.pos += url.length - protoLength\n return true\n}\n","// Proceess '\\n'\n\nimport { isSpace } from '../common/utils.ts'\nimport type StateInline from './state_inline.ts'\n\nexport default function newline (state: StateInline, silent: boolean): boolean {\n let pos = state.pos\n\n if (state.src.charCodeAt(pos) !== 0x0A/* \\n */) { return false }\n\n const pmax = state.pending.length - 1\n const max = state.posMax\n\n // ' \\n' -> hardbreak\n // Lookup in pending chars is bad practice! Don't copy to other rules!\n // Pending string is stored in concat mode, indexed lookups will cause\n // convertion to flat mode.\n if (!silent) {\n if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {\n if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {\n // Find whitespaces tail of pending chars.\n let ws = pmax - 1\n while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) ws--\n\n state.pending = state.pending.slice(0, ws)\n state.push('hardbreak', 'br', 0)\n } else {\n state.pending = state.pending.slice(0, -1)\n state.push('softbreak', 'br', 0)\n }\n } else {\n state.push('softbreak', 'br', 0)\n }\n }\n\n pos++\n\n // skip heading spaces for next line\n while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++ }\n\n state.pos = pos\n return true\n}\n","// Process escaped chars and hardbreaks\n\nimport { isSpace } from '../common/utils.ts'\nimport type StateInline from './state_inline.ts'\n\nconst ESCAPED: number[] = []\n\nfor (let i = 0; i < 256; i++) { ESCAPED.push(0) }\n\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'\n .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1 })\n\nexport default function escape (state: StateInline, silent: boolean): boolean {\n let pos = state.pos\n const max = state.posMax\n\n if (state.src.charCodeAt(pos) !== 0x5C/* \\ */) return false\n pos++\n\n // '\\' at the end of the inline block\n if (pos >= max) return false\n\n let ch1 = state.src.charCodeAt(pos)\n\n if (ch1 === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0)\n }\n\n pos++\n // skip leading whitespaces from next line\n while (pos < max) {\n ch1 = state.src.charCodeAt(pos)\n if (!isSpace(ch1)) break\n pos++\n }\n\n state.pos = pos\n return true\n }\n\n // '\\' before a space is a literal backslash. Don't consume the space, so a\n // trailing two-space hard line break is still detected by the newline rule.\n if (ch1 === 0x20) {\n if (!silent) {\n const token = state.push('text_special', '', 0)\n token.content = '\\\\'\n token.markup = '\\\\'\n token.info = 'escape'\n }\n\n state.pos = pos\n return true\n }\n\n let escapedStr = state.src[pos]\n\n if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {\n const ch2 = state.src.charCodeAt(pos + 1)\n\n if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {\n escapedStr += state.src[pos + 1]\n pos++\n }\n }\n\n const origStr = '\\\\' + escapedStr\n\n if (!silent) {\n const token = state.push('text_special', '', 0)\n\n if (ch1 < 256 && ESCAPED[ch1] !== 0) {\n token.content = escapedStr\n } else {\n token.content = origStr\n }\n\n token.markup = origStr\n token.info = 'escape'\n }\n\n state.pos = pos + 1\n return true\n}\n","// Parse backticks\n\nimport type StateInline from './state_inline.ts'\n\n// Position of the last backtick run of each length. Derived from the string in\n// one pass, so unlike an incremental cache it never depends on how the parser\n// walks it, and stays valid across lookaheads and narrowed ranges.\nfunction buildLastRuns (src: string): Record<number, number> {\n const lastRuns: Record<number, number> = {}\n let pos = 0\n\n while ((pos = src.indexOf('`', pos)) !== -1) {\n const start = pos\n while (src.charCodeAt(++pos) === 0x60/* ` */) { /* scan run length */ }\n lastRuns[pos - start] = start\n }\n\n return lastRuns\n}\n\nexport default function backtick (state: StateInline, silent: boolean): boolean {\n const start = state.pos\n\n if (state.src.charCodeAt(start) !== 0x60/* ` */) { return false }\n\n const max = state.posMax\n let pos = start + 1\n\n // scan marker length\n while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++ }\n\n const marker = state.src.slice(start, pos)\n const openerLength = marker.length\n\n if (!state.backticksScanned) {\n state.backticks = buildLastRuns(state.src)\n state.backticksScanned = true\n }\n\n // Nothing of the same length left in the string, so no closer can exist\n if ((state.backticks[openerLength] ?? -1) >= pos) {\n let matchEnd = pos\n let matchStart\n\n while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1 && matchStart < max) {\n // Measure the whole run, not just its part inside the current range,\n // otherwise a run straddling `max` would be mistaken for a shorter one\n matchEnd = matchStart + 1\n while (state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++ }\n\n if (matchEnd > max) break\n\n if (matchEnd - matchStart === openerLength) {\n if (!silent) {\n const token = state.push('code_inline', 'code', 0)\n token.markup = marker\n let content = state.src.slice(pos, matchStart).replace(/\\n/g, ' ')\n\n // Strip one space from each side, unless the content is all spaces\n if (content.startsWith(' ') && content.endsWith(' ') && /[^ ]/.test(content)) {\n content = content.slice(1, -1)\n }\n\n token.content = content\n }\n state.pos = matchEnd\n return true\n }\n }\n }\n\n if (!silent) state.pending += marker\n state.pos = pos\n return true\n}\n","// ~~strike through~~\n//\n\nimport type { Delimiter } from '../types.ts'\nimport type StateInline from './state_inline.ts'\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nfunction strikethrough_tokenize (state: StateInline, silent: boolean): boolean {\n const start = state.pos\n const marker = state.src.charCodeAt(start)\n\n if (silent) { return false }\n\n if (marker !== 0x7E/* ~ */) { return false }\n\n const scanned = state.scanDelims(state.pos, true)\n let len = scanned.length\n const ch = String.fromCharCode(marker)\n\n if (len < 2) { return false }\n\n let token\n\n if (len % 2) {\n token = state.push('text', '', 0)\n token.content = ch\n len--\n }\n\n for (let i = 0; i < len; i += 2) {\n token = state.push('text', '', 0)\n token.content = ch + ch\n\n state.delimiters.push({\n marker,\n length: 0, // disable \"rule of 3\" length checks meant for emphasis\n token: state.tokens.length - 1,\n end: -1,\n open: scanned.can_open,\n close: scanned.can_close\n })\n }\n\n state.pos += scanned.length\n\n return true\n}\n\nfunction postProcess (state: StateInline, delimiters: Delimiter[]) {\n let token\n const loneMarkers = []\n const max = delimiters.length\n\n for (let i = 0; i < max; i++) {\n const startDelim = delimiters[i]\n\n if (startDelim.marker !== 0x7E/* ~ */) {\n continue\n }\n\n if (startDelim.end === -1) {\n continue\n }\n\n const endDelim = delimiters[startDelim.end]\n\n token = state.tokens[startDelim.token]\n token.type = 's_open'\n token.tag = 's'\n token.nesting = 1\n token.markup = '~~'\n token.content = ''\n\n token = state.tokens[endDelim.token]\n token.type = 's_close'\n token.tag = 's'\n token.nesting = -1\n token.markup = '~~'\n token.content = ''\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '~') {\n loneMarkers.push(endDelim.token - 1)\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n const i = loneMarkers.pop()!\n let j = i + 1\n\n while (j < state.tokens.length && state.tokens[j].type === 's_close') {\n j++\n }\n\n j--\n\n if (i !== j) {\n token = state.tokens[j]\n state.tokens[j] = state.tokens[i]\n state.tokens[i] = token\n }\n }\n}\n\n// Walk through delimiter list and replace text tokens with tags\n//\nfunction strikethrough_postProcess (state: StateInline): void {\n const tokens_meta = state.tokens_meta\n const max = state.tokens_meta.length\n\n postProcess(state, state.delimiters)\n\n for (let curr = 0; curr < max; curr++) {\n const delimiters = tokens_meta[curr]?.delimiters\n if (delimiters) {\n postProcess(state, delimiters)\n }\n }\n}\n\nexport default {\n tokenize: strikethrough_tokenize,\n postProcess: strikethrough_postProcess\n}\n","// Process *this* and _that_\n//\n\nimport type { Delimiter } from '../types.ts'\nimport type StateInline from './state_inline.ts'\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nfunction emphasis_tokenize (state: StateInline, silent: boolean): boolean {\n const start = state.pos\n const marker = state.src.charCodeAt(start)\n\n if (silent) { return false }\n\n if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false }\n\n const scanned = state.scanDelims(state.pos, marker === 0x2A)\n\n for (let i = 0; i < scanned.length; i++) {\n const token = state.push('text', '', 0)\n token.content = String.fromCharCode(marker)\n\n state.delimiters.push({\n // Char code of the starting marker (number).\n //\n marker,\n\n // Total length of these series of delimiters.\n //\n length: scanned.length,\n\n // A position of the token this delimiter corresponds to.\n //\n token: state.tokens.length - 1,\n\n // If this delimiter is matched as a valid opener, `end` will be\n // equal to its position, otherwise it's `-1`.\n //\n end: -1,\n\n // Boolean flags that determine if this delimiter could open or close\n // an emphasis.\n //\n open: scanned.can_open,\n close: scanned.can_close\n })\n }\n\n state.pos += scanned.length\n\n return true\n}\n\nfunction postProcess (state: StateInline, delimiters: Delimiter[]) {\n const max = delimiters.length\n\n for (let i = max - 1; i >= 0; i--) {\n const startDelim = delimiters[i]\n\n if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {\n continue\n }\n\n // Process only opening markers\n if (startDelim.end === -1) {\n continue\n }\n\n const endDelim = delimiters[startDelim.end]\n\n // If the previous delimiter has the same marker and is adjacent to this one,\n // merge those into one strong delimiter.\n //\n // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`\n //\n const isStrong = i > 0 &&\n delimiters[i - 1].end === startDelim.end + 1 &&\n // check that first two markers match and adjacent\n delimiters[i - 1].marker === startDelim.marker &&\n delimiters[i - 1].token === startDelim.token - 1 &&\n // check that last two markers are adjacent (we can safely assume they match)\n delimiters[startDelim.end + 1].token === endDelim.token + 1\n\n const ch = String.fromCharCode(startDelim.marker)\n\n const token_o = state.tokens[startDelim.token]\n token_o.type = isStrong ? 'strong_open' : 'em_open'\n token_o.tag = isStrong ? 'strong' : 'em'\n token_o.nesting = 1\n token_o.markup = isStrong ? ch + ch : ch\n token_o.content = ''\n\n const token_c = state.tokens[endDelim.token]\n token_c.type = isStrong ? 'strong_close' : 'em_close'\n token_c.tag = isStrong ? 'strong' : 'em'\n token_c.nesting = -1\n token_c.markup = isStrong ? ch + ch : ch\n token_c.content = ''\n\n if (isStrong) {\n state.tokens[delimiters[i - 1].token].content = ''\n state.tokens[delimiters[startDelim.end + 1].token].content = ''\n i--\n }\n }\n}\n\n// Walk through delimiter list and replace text tokens with tags\n//\nfunction emphasis_post_process (state: StateInline): void {\n const tokens_meta = state.tokens_meta\n const max = state.tokens_meta.length\n\n postProcess(state, state.delimiters)\n\n for (let curr = 0; curr < max; curr++) {\n const delimiters = tokens_meta[curr]?.delimiters\n if (delimiters) {\n postProcess(state, delimiters)\n }\n }\n}\n\nexport default {\n tokenize: emphasis_tokenize,\n postProcess: emphasis_post_process\n}\n","// Process [link](<to> \"stuff\")\n\nimport { normalizeReference, isSpace } from '../common/utils.ts'\nimport type StateInline from './state_inline.ts'\n\nexport default function link (state: StateInline, silent: boolean): boolean {\n let code, label, res, ref\n let href = ''\n let title = ''\n let start = state.pos\n let parseReference = true\n\n if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false }\n\n const oldPos = state.pos\n const max = state.posMax\n const labelStart = state.pos + 1\n const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true)\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false }\n\n let pos = labelEnd + 1\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // might have found a valid shortcut link, disable reference parsing\n parseReference = false\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n pos++\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos)\n if (!isSpace(code) && code !== 0x0A) { break }\n }\n if (pos >= max) { return false }\n\n // [link]( <href> \"title\" )\n // ^^^^^^ parsing link destination\n start = pos\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax)\n if (res.ok) {\n href = state.md.normalizeLink(res.str)\n if (state.md.validateLink(href)) {\n pos = res.pos\n } else {\n href = ''\n }\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n start = pos\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos)\n if (!isSpace(code) && code !== 0x0A) { break }\n }\n\n // [link]( <href> \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax)\n if (pos < max && start !== pos && res.ok) {\n title = res.str\n pos = res.pos\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos)\n if (!isSpace(code) && code !== 0x0A) { break }\n }\n }\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n // parsing a valid shortcut link failed, fallback to reference\n parseReference = true\n }\n pos++\n }\n\n if (parseReference) {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1\n pos = state.md.helpers.parseLinkLabel(state, pos)\n if (pos >= 0) {\n label = state.src.slice(start, pos++)\n } else {\n pos = labelEnd + 1\n }\n } else {\n pos = labelEnd + 1\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd) }\n\n label = normalizeReference(label)\n ref = state.env.references[label]\n if (!ref) {\n state.pos = oldPos\n return false\n }\n href = ref.href\n title = ref.title\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n state.pos = labelStart\n state.posMax = labelEnd\n\n const token_o = state.push('link_open', 'a', 1)\n const attrs: Array<[string, string]> = [['href', href]]\n token_o.attrs = attrs\n if (title) {\n attrs.push(['title', title])\n }\n if (label) {\n const meta: Record<string, unknown> = Object.create(null)\n meta.label = label\n token_o.meta = meta\n }\n\n state.linkLevel++\n state.md.inline.tokenize(state)\n state.linkLevel--\n\n state.push('link_close', 'a', -1)\n }\n\n state.pos = pos\n state.posMax = max\n return true\n}\n","// Process \n\nimport { normalizeReference, isSpace } from '../common/utils.ts'\nimport type Token from '../token.ts'\nimport type StateInline from './state_inline.ts'\n\nexport default function image (state: StateInline, silent: boolean): boolean {\n let code, content, label, pos, ref, res, title, start\n let href = ''\n const oldPos = state.pos\n const max = state.posMax\n\n if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false }\n if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false }\n\n const labelStart = state.pos + 2\n const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false)\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false }\n\n pos = labelEnd + 1\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n pos++\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos)\n if (!isSpace(code) && code !== 0x0A) { break }\n }\n if (pos >= max) { return false }\n\n // [link]( <href> \"title\" )\n // ^^^^^^ parsing link destination\n start = pos\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax)\n if (res.ok) {\n href = state.md.normalizeLink(res.str)\n if (state.md.validateLink(href)) {\n pos = res.pos\n } else {\n href = ''\n }\n }\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n start = pos\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos)\n if (!isSpace(code) && code !== 0x0A) { break }\n }\n\n // [link]( <href> \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax)\n if (pos < max && start !== pos && res.ok) {\n title = res.str\n pos = res.pos\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos)\n if (!isSpace(code) && code !== 0x0A) { break }\n }\n } else {\n title = ''\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n state.pos = oldPos\n return false\n }\n pos++\n } else {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1\n pos = state.md.helpers.parseLinkLabel(state, pos)\n if (pos >= 0) {\n label = state.src.slice(start, pos++)\n } else {\n pos = labelEnd + 1\n }\n } else {\n pos = labelEnd + 1\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd) }\n\n label = normalizeReference(label)\n ref = state.env.references[label]\n if (!ref) {\n state.pos = oldPos\n return false\n }\n href = ref.href\n title = ref.title\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n content = state.src.slice(labelStart, labelEnd)\n\n const tokens: Token[] = []\n state.md.inline.parse(\n content,\n state.md,\n state.env,\n tokens\n )\n\n const token = state.push('image', 'img', 0)\n const attrs: Array<[string, string]> = [['src', href], ['alt', '']]\n token.attrs = attrs\n token.children = tokens\n token.content = content\n\n if (title) {\n attrs.push(['title', title])\n }\n if (label) {\n const meta: Record<string, unknown> = Object.create(null)\n meta.label = label\n token.meta = meta\n }\n }\n\n state.pos = pos\n state.posMax = max\n return true\n}\n","// Process autolinks '<protocol:...>'\n\nimport type StateInline from './state_inline.ts'\n\n/* eslint max-len:0 */\nconst EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/\n/* eslint-disable-next-line no-control-regex */\nconst AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\\x00-\\x20]*)$/\n\nexport default function autolink (state: StateInline, silent: boolean): boolean {\n let pos = state.pos\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false }\n\n const start = state.pos\n const max = state.posMax\n\n for (;;) {\n if (++pos >= max) return false\n\n const ch = state.src.charCodeAt(pos)\n\n if (ch === 0x3C /* < */) return false\n if (ch === 0x3E /* > */) break\n }\n\n const url = state.src.slice(start + 1, pos)\n\n if (AUTOLINK_RE.test(url)) {\n const fullUrl = state.md.normalizeLink(url)\n if (!state.md.validateLink(fullUrl)) { return false }\n\n if (!silent) {\n const token_o = state.push('link_open', 'a', 1)\n token_o.attrs = [['href', fullUrl]]\n token_o.markup = 'autolink'\n token_o.info = 'auto'\n\n const token_t = state.push('text', '', 0)\n token_t.content = state.md.normalizeLinkText(url)\n\n const token_c = state.push('link_close', 'a', -1)\n token_c.markup = 'autolink'\n token_c.info = 'auto'\n }\n\n state.pos += url.length + 2\n return true\n }\n\n if (EMAIL_RE.test(url)) {\n const fullUrl = state.md.normalizeLink(`mailto:${url}`)\n if (!state.md.validateLink(fullUrl)) { return false }\n\n if (!silent) {\n const token_o = state.push('link_open', 'a', 1)\n token_o.attrs = [['href', fullUrl]]\n token_o.markup = 'autolink'\n token_o.info = 'auto'\n\n const token_t = state.push('text', '', 0)\n token_t.content = state.md.normalizeLinkText(url)\n\n const token_c = state.push('link_close', 'a', -1)\n token_c.markup = 'autolink'\n token_c.info = 'auto'\n }\n\n state.pos += url.length + 2\n return true\n }\n\n return false\n}\n","// Process html tags\n\nimport { HTML_TAG_RE } from '../common/html_re.ts'\nimport type StateInline from './state_inline.ts'\n\nfunction isLinkOpen (str: string) {\n return /^<a[>\\s]/i.test(str)\n}\nfunction isLinkClose (str: string) {\n return /^<\\/a\\s*>/i.test(str)\n}\n\nfunction isLetter (ch: number) {\n /* eslint no-bitwise:0 */\n const lc = ch | 0x20 // to lower case\n return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */)\n}\n\nexport default function html_inline (state: StateInline, silent: boolean): boolean {\n if (!state.md.options.html) { return false }\n\n // Check start\n const max = state.posMax\n const pos = state.pos\n if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||\n pos + 2 >= max) {\n return false\n }\n\n // Quick fail on second char\n const ch = state.src.charCodeAt(pos + 1)\n if (ch !== 0x21/* ! */ &&\n ch !== 0x3F/* ? */ &&\n ch !== 0x2F/* / */ &&\n !isLetter(ch)) {\n return false\n }\n\n const match = state.src.slice(pos).match(HTML_TAG_RE)\n if (!match) { return false }\n\n if (!silent) {\n const token = state.push('html_inline', '', 0)\n token.content = match[0]\n\n if (isLinkOpen(token.content)) state.linkLevel++\n if (isLinkClose(token.content)) state.linkLevel--\n }\n state.pos += match[0].length\n return true\n}\n","// Process html entity - {, ¯, ", ...\n\nimport { decodeHTMLStrict } from 'entities'\nimport { isValidEntityCode, fromCodePoint } from '../common/utils.ts'\nimport type StateInline from './state_inline.ts'\n\nconst DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i\nconst NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i\n\nexport default function entity (state: StateInline, silent: boolean): boolean {\n const pos = state.pos\n const max = state.posMax\n\n if (state.src.charCodeAt(pos) !== 0x26/* & */) return false\n\n if (pos + 1 >= max) return false\n\n const ch = state.src.charCodeAt(pos + 1)\n\n if (ch === 0x23 /* # */) {\n const match = state.src.slice(pos).match(DIGITAL_RE)\n if (match) {\n if (!silent) {\n const code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10)\n\n const token = state.push('text_special', '', 0)\n token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD)\n token.markup = match[0]\n token.info = 'entity'\n }\n state.pos += match[0].length\n return true\n }\n } else {\n const match = state.src.slice(pos).match(NAMED_RE)\n if (match) {\n const decoded = decodeHTMLStrict(match[0])\n if (decoded !== match[0]) {\n if (!silent) {\n const token = state.push('text_special', '', 0)\n token.content = decoded\n token.markup = match[0]\n token.info = 'entity'\n }\n state.pos += match[0].length\n return true\n }\n }\n }\n\n return false\n}\n","// For each opening emphasis-like marker find a matching closing one\n//\n\nimport type { Delimiter } from '../types.ts'\nimport type StateInline from './state_inline.ts'\n\nfunction processDelimiters (delimiters: Delimiter[]) {\n const openersBottom: Record<number, number[]> = {}\n const max = delimiters.length\n\n if (!max) return\n\n // headerIdx is the first delimiter of the current (where closer is) delimiter run\n let headerIdx = 0\n let lastTokenIdx = -2 // needs any value lower than -1\n const jumps: number[] = []\n\n for (let closerIdx = 0; closerIdx < max; closerIdx++) {\n const closer = delimiters[closerIdx]\n\n jumps.push(0)\n\n // markers belong to same delimiter run if:\n // - they have adjacent tokens\n // - AND markers are the same\n //\n if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {\n headerIdx = closerIdx\n }\n\n lastTokenIdx = closer.token\n\n // Length is only used for emphasis-specific \"rule of 3\",\n // if it's not defined (in strikethrough or 3rd party plugins),\n // we can default it to 0 to disable those checks.\n //\n closer.length = closer.length || 0\n\n if (!closer.close) continue\n\n // Previously calculated lower bounds (previous fails)\n // for each marker, each delimiter length modulo 3,\n // and for whether this closer can be an opener;\n // https://github.com/commonmark/cmark/commit/34250e12ccebdc6372b8b49c44fab57c72443460\n /* eslint-disable-next-line no-prototype-builtins */\n if (!openersBottom.hasOwnProperty(closer.marker)) {\n openersBottom[closer.marker] = [-1, -1, -1, -1, -1, -1]\n }\n\n const minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length % 3)]\n\n let openerIdx = headerIdx - jumps[headerIdx] - 1\n\n let newMinOpenerIdx = openerIdx\n\n for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {\n const opener = delimiters[openerIdx]\n\n if (opener.marker !== closer.marker) continue\n\n if (opener.open && opener.end < 0) {\n let isOddMatch = false\n\n // from spec:\n //\n // If one of the delimiters can both open and close emphasis, then the\n // sum of the lengths of the delimiter runs containing the opening and\n // closing delimiters must not be a multiple of 3 unless both lengths\n // are multiples of 3.\n //\n if (opener.close || closer.open) {\n if ((opener.length! + closer.length) % 3 === 0) {\n if (opener.length! % 3 !== 0 || closer.length % 3 !== 0) {\n isOddMatch = true\n }\n }\n }\n\n if (!isOddMatch) {\n // If previous delimiter cannot be an opener, we can safely skip\n // the entire sequence in future checks. This is required to make\n // sure algorithm has linear complexity (see *_*_*_*_*_... case).\n //\n const lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open\n ? jumps[openerIdx - 1] + 1\n : 0\n\n jumps[closerIdx] = closerIdx - openerIdx + lastJump\n jumps[openerIdx] = lastJump\n\n closer.open = false\n opener.end = closerIdx\n opener.close = false\n newMinOpenerIdx = -1\n // treat next token as start of run,\n // it optimizes skips in **<...>**a**<...>** pathological case\n lastTokenIdx = -2\n break\n }\n }\n }\n\n if (newMinOpenerIdx !== -1) {\n // If match for this delimiter run failed, we want to set lower bound for\n // future lookups. This is required to make sure algorithm has linear\n // complexity.\n //\n // See details here:\n // https://github.com/commonmark/cmark/issues/178#issuecomment-270417442\n //\n openersBottom[closer.marker][(closer.open ? 3 : 0) + ((closer.length || 0) % 3)] = newMinOpenerIdx\n }\n }\n}\n\nexport default function link_pairs (state: StateInline): void {\n const tokens_meta = state.tokens_meta\n const max = state.tokens_meta.length\n\n processDelimiters(state.delimiters)\n\n for (let curr = 0; curr < max; curr++) {\n const delimiters = tokens_meta[curr]?.delimiters\n if (delimiters) {\n processDelimiters(delimiters)\n }\n }\n}\n","// Clean up tokens after emphasis and strikethrough postprocessing:\n// merge adjacent text nodes into one and re-calculate all token levels\n//\n// This is necessary because initially emphasis delimiter markers (*, _, ~)\n// are treated as their own separate text tokens. Then emphasis rule either\n// leaves them as text (needed to merge with adjacent text) or turns them\n// into opening/closing tags (which messes up levels inside).\n//\n\nimport type StateInline from './state_inline.ts'\n\nexport default function fragments_join (state: StateInline): void {\n let curr, last\n let level = 0\n const tokens = state.tokens\n const max = state.tokens.length\n\n for (curr = last = 0; curr < max; curr++) {\n // re-calculate levels after emphasis/strikethrough turns some text nodes\n // into opening/closing tags\n if (tokens[curr].nesting < 0) level-- // closing tag\n tokens[curr].level = level\n if (tokens[curr].nesting > 0) level++ // opening tag\n\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content\n } else {\n if (curr !== last) { tokens[last] = tokens[curr] }\n\n last++\n }\n }\n\n if (curr !== last) {\n tokens.length = last\n }\n}\n","import Ruler from './ruler.ts'\nimport StateInline from './rules_inline/state_inline.ts'\nimport type Token from './token.ts'\nimport type MarkdownIt from './markdownit.ts'\nimport type { Env } from './types.ts'\n\nimport r_text from './rules_inline/text.ts'\nimport r_linkify from './rules_inline/linkify.ts'\nimport r_newline from './rules_inline/newline.ts'\nimport r_escape from './rules_inline/escape.ts'\nimport r_backticks from './rules_inline/backticks.ts'\nimport r_strikethrough from './rules_inline/strikethrough.ts'\nimport r_emphasis from './rules_inline/emphasis.ts'\nimport r_link from './rules_inline/link.ts'\nimport r_image from './rules_inline/image.ts'\nimport r_autolink from './rules_inline/autolink.ts'\nimport r_html_inline from './rules_inline/html_inline.ts'\nimport r_entity from './rules_inline/entity.ts'\n\nimport r_balance_pairs from './rules_inline/balance_pairs.ts'\nimport r_fragments_join from './rules_inline/fragments_join.ts'\n\n// Parser rules\n\nconst _rules: Array<[\n name: string,\n rule: (state: StateInline, silent: boolean) => boolean\n]> = [\n ['text', r_text],\n ['linkify', r_linkify],\n ['newline', r_newline],\n ['escape', r_escape],\n ['backticks', r_backticks],\n ['strikethrough', r_strikethrough.tokenize],\n ['emphasis', r_emphasis.tokenize],\n ['link', r_link],\n ['image', r_image],\n ['autolink', r_autolink],\n ['html_inline', r_html_inline],\n ['entity', r_entity]\n]\n\n// `rule2` ruleset was created specifically for emphasis/strikethrough\n// post-processing and may be changed in the future.\n//\n// Don't use this for anything except pairs (plugins working with `balance_pairs`).\n//\nconst _rules2: Array<[\n name: string,\n rule: (state: StateInline) => void\n]> = [\n ['balance_pairs', r_balance_pairs],\n ['strikethrough', r_strikethrough.postProcess],\n ['emphasis', r_emphasis.postProcess],\n // rules for pairs separate '**' into its own text tokens, which may be left unused,\n // rule below merges unused segments back with the rest of the text\n ['fragments_join', r_fragments_join]\n]\n\n/**\n * Tokenizes paragraph content.\n */\nclass ParserInline {\n /**\n * {@link Ruler} instance. Keep configuration of inline rules.\n */\n ruler = new Ruler<[StateInline, boolean], boolean>()\n\n /**\n * {@link Ruler} instance. Second ruler used for post-processing\n * (e.g. in emphasis-like rules).\n */\n ruler2 = new Ruler<[StateInline], void>()\n\n State = StateInline\n\n constructor () {\n for (let i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1])\n }\n\n for (let i = 0; i < _rules2.length; i++) {\n this.ruler2.push(_rules2[i][0], _rules2[i][1])\n }\n }\n\n // Skip single token by running all rules in validation mode;\n // returns `true` if any rule reported success\n //\n skipToken (state: StateInline): void {\n const pos = state.pos\n const rules = this.ruler.getRules('')\n const len = rules.length\n const maxNesting = state.md.options.maxNesting\n const cache = state.cache\n\n if (typeof cache[pos] !== 'undefined') {\n state.pos = cache[pos]\n return\n }\n\n let ok = false\n\n if (state.level < maxNesting) {\n for (let i = 0; i < len; i++) {\n // Increment state.level and decrement it later to limit recursion.\n // It's harmless to do here, because no tokens are created. But ideally,\n // we'd need a separate private state variable for this purpose.\n //\n state.level++\n ok = rules[i](state, true)\n state.level--\n\n if (ok) {\n if (pos >= state.pos) { throw new Error(\"inline rule didn't increment state.pos\") }\n break\n }\n }\n } else {\n // Too much nesting, just skip until the end of the paragraph.\n //\n // NOTE: this will cause links to behave incorrectly in the following case,\n // when an amount of `[` is exactly equal to `maxNesting + 1`:\n //\n // [[[[[[[[[[[[[[[[[[[[[foo]()\n //\n // TODO: remove this workaround when CM standard will allow nested links\n // (we can replace it by preventing links from being parsed in\n // validation mode)\n //\n state.pos = state.posMax\n }\n\n if (!ok) { state.pos++ }\n cache[pos] = state.pos\n }\n\n // Generate tokens for input range\n //\n tokenize (state: StateInline): void {\n const rules = this.ruler.getRules('')\n const len = rules.length\n const end = state.posMax\n const maxNesting = state.md.options.maxNesting\n\n while (state.pos < end) {\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.pos`\n // - update `state.tokens`\n // - return true\n const prevPos = state.pos\n let ok = false\n\n if (state.level < maxNesting) {\n for (let i = 0; i < len; i++) {\n ok = rules[i](state, false)\n if (ok) {\n if (prevPos >= state.pos) { throw new Error(\"inline rule didn't increment state.pos\") }\n break\n }\n }\n }\n\n if (ok) {\n if (state.pos >= end) { break }\n continue\n }\n\n state.pending += state.src[state.pos++]\n }\n\n if (state.pending) {\n state.pushPending()\n }\n }\n\n /**\n * Process input string and push inline tokens into `outTokens`\n */\n parse (str: string, md: MarkdownIt, env: Env, outTokens: Token[]): void {\n const state = new this.State(str, md, env, outTokens)\n\n this.tokenize(state)\n\n const rules = this.ruler2.getRules('')\n const len = rules.length\n\n for (let i = 0; i < len; i++) {\n rules[i](state)\n }\n }\n}\n\nexport default ParserInline\n","// markdown-it default options\n\nimport type { MarkdownItOptions } from '../types.ts'\n\nconst options: Required<MarkdownItOptions> = {\n // Enable HTML tags in source\n html: false,\n\n // Use '/' to close single tags (<br />)\n xhtmlOut: false,\n\n // Convert '\\n' in paragraphs into <br>\n breaks: false,\n\n // CSS language prefix for fenced blocks\n langPrefix: 'language-',\n\n // autoconvert URL-like texts to links\n linkify: false,\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n // Internal protection, recursion limit\n maxNesting: 100\n}\n\nexport default {\n options,\n\n components: {\n core: {},\n block: {},\n inline: {}\n }\n}\n","// \"Zero\" preset, with nothing enabled. Useful for manual configuring of simple\n// modes. For example, to parse bold/italic only.\n\nimport type { MarkdownItOptions } from '../types.ts'\n\nconst options: Required<MarkdownItOptions> = {\n // Enable HTML tags in source\n html: false,\n\n // Use '/' to close single tags (<br />)\n xhtmlOut: false,\n\n // Convert '\\n' in paragraphs into <br>\n breaks: false,\n\n // CSS language prefix for fenced blocks\n langPrefix: 'language-',\n\n // autoconvert URL-like texts to links\n linkify: false,\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n // Internal protection, recursion limit\n maxNesting: 20\n}\n\nexport default {\n options,\n\n components: {\n\n core: {\n rules: [\n 'normalize',\n 'block',\n 'strip_references',\n 'inline',\n 'text_join'\n ]\n },\n\n block: {\n rules: [\n 'paragraph'\n ]\n },\n\n inline: {\n rules: [\n 'text'\n ],\n rules2: [\n 'balance_pairs',\n 'fragments_join'\n ]\n }\n }\n}\n","// Commonmark default options\n\nimport type { MarkdownItOptions } from '../types.ts'\n\nconst options: Required<MarkdownItOptions> = {\n // Enable HTML tags in source\n html: true,\n\n // Use '/' to close single tags (<br />)\n xhtmlOut: true,\n\n // Convert '\\n' in paragraphs into <br>\n breaks: false,\n\n // CSS language prefix for fenced blocks\n langPrefix: 'language-',\n\n // autoconvert URL-like texts to links\n linkify: false,\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n // Internal protection, recursion limit\n maxNesting: 20\n}\n\nexport default {\n options,\n\n components: {\n\n core: {\n rules: [\n 'normalize',\n 'block',\n 'strip_references',\n 'inline',\n 'text_join'\n ]\n },\n\n block: {\n rules: [\n 'blockquote',\n 'code',\n 'fence',\n 'heading',\n 'hr',\n 'html_block',\n 'lheading',\n 'list',\n 'reference',\n 'paragraph'\n ]\n },\n\n inline: {\n rules: [\n 'autolink',\n 'backticks',\n 'emphasis',\n 'entity',\n 'escape',\n 'html_inline',\n 'image',\n 'link',\n 'newline',\n 'text'\n ],\n rules2: [\n 'balance_pairs',\n 'emphasis',\n 'fragments_join'\n ]\n }\n }\n}\n","// Main parser class\n\nimport * as utils from './common/utils.ts'\nimport * as helpers from './helpers/index.ts'\nimport Token from './token.ts'\nimport Ruler from './ruler.ts'\nimport Renderer from './renderer.ts'\nimport ParserCore from './parser_core.ts'\nimport StateCore from './rules_core/state_core.ts'\nimport ParserBlock from './parser_block.ts'\nimport StateBlock from './rules_block/state_block.ts'\nimport ParserInline from './parser_inline.ts'\nimport StateInline from './rules_inline/state_inline.ts'\nimport { LinkifyIt } from 'linkify-it'\nimport * as mdurl from 'mdurl'\nimport punycode from 'punycode.js'\n\nimport cfg_default from './presets/default.ts'\nimport cfg_zero from './presets/zero.ts'\nimport cfg_commonmark from './presets/commonmark.ts'\nimport type { Env, MarkdownItOptions } from './types.ts'\n\nconst config = {\n default: cfg_default,\n zero: cfg_zero,\n commonmark: cfg_commonmark\n}\n\ntype MarkdownItPresetName = keyof typeof config\n\n/**\n * Parser preset containing options and enabled rules for each parser component.\n */\nexport interface MarkdownItPreset {\n options?: Required<MarkdownItOptions>\n components?: {\n core?: {\n rules?: string[]\n }\n block?: {\n rules?: string[]\n }\n inline?: {\n rules?: string[]\n rules2?: string[]\n }\n }\n}\n\ntype MarkdownItComponentName = keyof NonNullable<MarkdownItPreset['components']>\n\n//\n// This validator can prohibit more than really needed to prevent XSS. It's a\n// tradeoff to keep code simple and to be secure by default.\n//\n// If you need different setup - override validator method as you wish. Or\n// replace it with dummy function and use external sanitizer.\n//\n\nconst BAD_PROTO_RE = /^(vbscript|javascript|file|data):/\nconst GOOD_DATA_RE = /^data:image\\/(gif|png|jpeg|webp);/\n\nconst RECODE_HOSTNAME_FOR = ['http:', 'https:', 'mailto:']\n\n/**\n * Parses Markdown into tokens and renders them to HTML.\n *\n * @category Main\n */\nclass MarkdownIt {\n /**\n * Instance of {@link ParserInline}. You may need it to add new rules when\n * writing plugins. For simple rules control use {@link MarkdownIt.disable}\n * and {@link MarkdownIt.enable}.\n */\n inline = new ParserInline()\n\n /**\n * Instance of {@link ParserBlock}. You may need it to add new rules when\n * writing plugins. For simple rules control use {@link MarkdownIt.disable}\n * and {@link MarkdownIt.enable}.\n */\n block = new ParserBlock()\n\n /**\n * Instance of {@link ParserCore} chain executor. You may need it to add new\n * rules when writing plugins. For simple rules control use\n * {@link MarkdownIt.disable} and {@link MarkdownIt.enable}.\n */\n core = new ParserCore()\n\n /**\n * Instance of {@link Renderer}. Use it to modify output look. Or to add rendering\n * rules for new token types, generated by plugins.\n *\n * See {@link Renderer} docs and\n * [source code](https://github.com/markdown-it/markdown-it/blob/master/src/renderer.ts).\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * function myToken(tokens, idx, options, env, self) {\n * //...\n * return result;\n * };\n *\n * md.renderer.rules['my_token'] = myToken\n * ```\n */\n renderer = new Renderer()\n\n /**\n * [linkify-it](https://github.com/markdown-it/linkify-it) instance.\n * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/src/rules_core/linkify.ts)\n * rule.\n */\n linkify = new LinkifyIt()\n\n /**\n * Link validation function. CommonMark allows too much in links. By default\n * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas\n * except some embedded image types.\n *\n * You can change this behaviour:\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * const md = new MarkdownIt()\n *\n * // enable everything\n * md.validateLink = function () { return true; }\n * ```\n */\n validateLink (url: string): boolean {\n // url should be normalized at this point, and existing entities are decoded\n const str = url.trim().toLowerCase()\n\n return BAD_PROTO_RE.test(str) ? GOOD_DATA_RE.test(str) : true\n }\n\n /**\n * Function used to encode link url to a machine-readable format,\n * which includes url-encoding, punycode, etc.\n */\n normalizeLink (url: string): string {\n // Each url part should be encoded separately, with proper encoder\n const parsed = mdurl.parse(url, true)\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toASCII(parsed.hostname)\n } catch (er) { /**/ }\n }\n }\n\n if (parsed.auth) parsed.auth = mdurl.encode(parsed.auth)\n if (parsed.hostname) parsed.hostname = mdurl.encode(parsed.hostname)\n if (parsed.pathname) parsed.pathname = mdurl.encode(parsed.pathname)\n if (parsed.search) parsed.search = mdurl.encode(parsed.search)\n if (parsed.hash) parsed.hash = mdurl.encode(parsed.hash)\n\n return mdurl.format(parsed)\n }\n\n /**\n * Function used to decode link url to a human-readable format`\n */\n normalizeLinkText (url: string): string {\n const parsed = mdurl.parse(url, true)\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toUnicode(parsed.hostname)\n } catch (er) { /**/ }\n }\n }\n\n // add '%' to exclude list because of https://github.com/markdown-it/markdown-it/issues/720\n return mdurl.decode(mdurl.format(parsed), mdurl.decode.defaultChars + '%')\n }\n\n // Expose utils & helpers for easy acces from plugins\n\n /**\n * Assorted utility functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/src/common/utils.ts).\n */\n utils = utils\n\n /**\n * Link components parser functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/src/helpers).\n */\n helpers = Object.assign({}, helpers)\n\n declare options: Required<MarkdownItOptions>\n\n constructor (\n ...args:\n | []\n | [options: MarkdownItOptions]\n | [presetName: MarkdownItPresetName, options?: MarkdownItOptions]\n ) {\n const [presetNameOrOptions, options] = args\n\n if (typeof presetNameOrOptions === 'string') {\n this.configure(presetNameOrOptions)\n if (options) { this.set(options) }\n } else {\n this.configure('default')\n this.set(presetNameOrOptions || {})\n }\n }\n\n /**\n * Set parser options (in the same format as in constructor). Probably, you\n * will never need it, but you can change options after constructor call.\n *\n * __Note:__ To achieve the best possible performance, don't modify a\n * `markdown-it` instance options on the fly. If you need multiple configurations\n * it's best to create multiple instances and initialize each with separate\n * config.\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n *\n * const md = new MarkdownIt()\n * .set({ html: true, breaks: true })\n * .set({ typographer: true })\n * ```\n */\n set (options: MarkdownItOptions): this {\n Object.assign(this.options, options)\n return this\n }\n\n /**\n * Batch load of all options and compenent settings. This is internal method,\n * and you probably will not need it. But if you will - see available presets\n * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/src/presets)\n *\n * We strongly recommend to use presets instead of direct config loads. That\n * will give better compatibility with next versions.\n */\n configure (presets: MarkdownItPresetName | MarkdownItPreset): this {\n let p: MarkdownItPreset\n\n if (typeof presets === 'string') {\n const presetName = presets\n p = config[presetName]\n if (!p) { throw new Error(`Wrong 'markdown-it' preset \"${presetName}\", check name`) }\n } else {\n p = presets\n }\n\n if (!p) { throw new Error('Wrong `markdown-it` preset, can\\'t be empty') }\n\n if (p.options) { this.options = { ...p.options } }\n\n const components = p.components\n if (components) {\n const componentNames: MarkdownItComponentName[] = ['core', 'block', 'inline']\n componentNames.forEach((name) => {\n const rules = components[name]?.rules\n if (rules) {\n this[name].ruler.enableOnly(rules)\n }\n })\n\n const rules2 = components.inline?.rules2\n if (rules2) {\n this.inline.ruler2.enableOnly(rules2)\n }\n }\n return this\n }\n\n /**\n * Enable list or rules. It will automatically find appropriate components,\n * containing rules with given names. If rule not found, and `ignoreInvalid`\n * not set - throws exception.\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n *\n * const md = new MarkdownIt()\n * .enable(['sub', 'sup'])\n * .disable('smartquotes')\n * ```\n */\n enable (list: string | string[], ignoreInvalid = false): this {\n let result: string[] = []\n\n if (!Array.isArray(list)) { list = [list] }\n\n const chains: MarkdownItComponentName[] = ['core', 'block', 'inline']\n chains.forEach((chain) => {\n result = result.concat(this[chain].ruler.enable(list, true))\n })\n\n result = result.concat(this.inline.ruler2.enable(list, true))\n\n const missed = list.filter((name) => result.indexOf(name) < 0)\n\n if (missed.length && !ignoreInvalid) {\n throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${missed}`)\n }\n\n return this\n }\n\n /**\n * The same as {@link MarkdownIt.enable}, but turn specified rules off.\n */\n disable (list: string | string[], ignoreInvalid = false): this {\n let result: string[] = []\n\n if (!Array.isArray(list)) { list = [list] }\n\n const chains: MarkdownItComponentName[] = ['core', 'block', 'inline']\n chains.forEach((chain) => {\n result = result.concat(this[chain].ruler.disable(list, true))\n })\n\n result = result.concat(this.inline.ruler2.disable(list, true))\n\n const missed = list.filter((name) => result.indexOf(name) < 0)\n\n if (missed.length && !ignoreInvalid) {\n throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${missed}`)\n }\n return this\n }\n\n /**\n * Load specified plugin with given params into current parser instance.\n * It's just a sugar to call `plugin(md, params)` with curring.\n *\n * @example\n * ```javascript\n * import MarkdownIt from 'markdown-it'\n * import iterator from 'markdown-it-for-inline'\n *\n * const md = new MarkdownIt()\n * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {\n * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar')\n * })\n * ```\n */\n use<Params extends unknown[]> (\n plugin: (md: this, ...params: Params) => void,\n ...params: Params\n ): this {\n plugin.apply(plugin, [this, ...params])\n return this\n }\n\n /**\n * Parse input string and return list of block tokens (special token type\n * \"inline\" will contain list of inline tokens). You should not call this\n * method directly, until you write custom renderer (for example, to produce\n * AST).\n *\n * `env` is used to pass data between \"distributed\" rules and return additional\n * metadata like reference info, needed for the renderer. It also can be used to\n * inject data in specific cases. Usually, you will be ok to pass `{}`,\n * and then pass updated object to renderer.\n */\n parse (src: string, env: Env): Token[] {\n if (typeof src !== 'string') {\n throw new Error('Input data should be a String')\n }\n\n const state = new this.core.State(src, this, env)\n\n this.core.process(state)\n\n return state.tokens\n }\n\n /**\n * Render markdown string into html. It does all magic for you :).\n *\n * `env` can be used to inject additional metadata (`{}` by default).\n * But you will not need it with high probability. See also comment\n * in {@link MarkdownIt.parse}.\n */\n render (src: string, env: Env = {}): string {\n return this.renderer.render(this.parse(src, env), this.options, env)\n }\n\n /**\n * The same as {@link MarkdownIt.parse} but skip all block rules. It returns\n * the block tokens list with the single `inline` element, containing parsed\n * inline tokens in `children` property. Also updates `env` object.\n */\n parseInline (src: string, env: Env): Token[] {\n const state = new this.core.State(src, this, env)\n\n state.inlineMode = true\n this.core.process(state)\n\n return state.tokens\n }\n\n /**\n * Similar to {@link MarkdownIt.render} but for single paragraph content.\n * Result will NOT be wrapped into `<p>` tags.\n */\n renderInline (src: string, env: Env = {}): string {\n return this.renderer.render(this.parseInline(src, env), this.options, env)\n }\n\n static Token = Token\n static Ruler = Ruler\n static Renderer = Renderer\n static ParserCore = ParserCore\n static StateCore = StateCore\n static ParserBlock = ParserBlock\n static StateBlock = StateBlock\n static ParserInline = ParserInline\n static StateInline = StateInline\n}\n\nexport default MarkdownIt\n","import { callable } from './common/utils.ts'\nimport MarkdownIt from './markdownit.ts'\n\n/**\n * Default package export.\n *\n * For backward compatibility, the {@link MarkdownIt} class is wrapped so\n * legacy code can call it without `new`. New code should instantiate it as a\n * regular class with `new`. The compatibility wrapper may be removed in a\n * future release.\n *\n * @category Main\n */\nconst MarkdownItCallable = callable(MarkdownIt)\n\nexport default MarkdownItCallable\n\nexport type { default as MarkdownIt, MarkdownItPreset } from './markdownit.ts'\nexport type { Delimiter, Env, MarkdownItOptions } from './types.ts'\nexport type { default as Token } from './token.ts'\nexport type { default as Ruler } from './ruler.ts'\nexport type { default as Renderer, RendererRule } from './renderer.ts'\nexport type { default as ParserCore } from './parser_core.ts'\nexport type { default as StateCore } from './rules_core/state_core.ts'\nexport type { default as ParserBlock } from './parser_block.ts'\nexport type { default as StateBlock } from './rules_block/state_block.ts'\nexport type { default as ParserInline } from './parser_inline.ts'\nexport type { default as StateInline } from './rules_inline/state_inline.ts'\n"],"mappings":";;;;;;;;;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