2025-09-05 14:59:21 +08:00

1865 lines
55 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
asciiControl,
codes,
constants,
markdownLineEnding,
markdownLineEndingOrSpace,
markdownSpace,
types,
unicodePunctuation,
unicodeWhitespace,
values
} from "./chunk-QZZOH36M.js";
import {
visit
} from "./chunk-A7GY76GT.js";
import {
EXIT,
convert
} from "./chunk-5YG5I5XG.js";
import {
ok
} from "./chunk-434LCRC6.js";
// node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
function blockquote(node2, _, state, info) {
const exit = state.enter("blockquote");
const tracker = state.createTracker(info);
tracker.move("> ");
tracker.shift(2);
const value = state.indentLines(
state.containerFlow(node2, tracker.current()),
map
);
exit();
return value;
}
function map(line, _, blank) {
return ">" + (blank ? "" : " ") + line;
}
// node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
function patternInScope(stack, pattern) {
return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
}
function listInScope(stack, list3, none) {
if (typeof list3 === "string") {
list3 = [list3];
}
if (!list3 || list3.length === 0) {
return none;
}
let index = -1;
while (++index < list3.length) {
if (stack.includes(list3[index])) {
return true;
}
}
return false;
}
// node_modules/mdast-util-to-markdown/lib/handle/break.js
function hardBreak(_, _1, state, info) {
let index = -1;
while (++index < state.unsafe.length) {
if (state.unsafe[index].character === "\n" && patternInScope(state.stack, state.unsafe[index])) {
return /[ \t]/.test(info.before) ? "" : " ";
}
}
return "\\\n";
}
// node_modules/longest-streak/index.js
function longestStreak(value, substring) {
const source = String(value);
let index = source.indexOf(substring);
let expected = index;
let count = 0;
let max = 0;
if (typeof substring !== "string") {
throw new TypeError("Expected substring");
}
while (index !== -1) {
if (index === expected) {
if (++count > max) {
max = count;
}
} else {
count = 1;
}
expected = index + substring.length;
index = source.indexOf(substring, expected);
}
return max;
}
// node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
function formatCodeAsIndented(node2, state) {
return Boolean(
state.options.fences === false && node2.value && // If theres no info…
!node2.lang && // And theres a non-whitespace character…
/[^ \r\n]/.test(node2.value) && // And the value doesnt start or end in a blank…
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
);
}
// node_modules/mdast-util-to-markdown/lib/util/check-fence.js
function checkFence(state) {
const marker = state.options.fence || "`";
if (marker !== "`" && marker !== "~") {
throw new Error(
"Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/handle/code.js
function code(node2, _, state, info) {
const marker = checkFence(state);
const raw = node2.value || "";
const suffix = marker === "`" ? "GraveAccent" : "Tilde";
if (formatCodeAsIndented(node2, state)) {
const exit2 = state.enter("codeIndented");
const value2 = state.indentLines(raw, map2);
exit2();
return value2;
}
const tracker = state.createTracker(info);
const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
const exit = state.enter("codeFenced");
let value = tracker.move(sequence);
if (node2.lang) {
const subexit = state.enter(`codeFencedLang${suffix}`);
value += tracker.move(
state.safe(node2.lang, {
before: value,
after: " ",
encode: ["`"],
...tracker.current()
})
);
subexit();
}
if (node2.lang && node2.meta) {
const subexit = state.enter(`codeFencedMeta${suffix}`);
value += tracker.move(" ");
value += tracker.move(
state.safe(node2.meta, {
before: value,
after: "\n",
encode: ["`"],
...tracker.current()
})
);
subexit();
}
value += tracker.move("\n");
if (raw) {
value += tracker.move(raw + "\n");
}
value += tracker.move(sequence);
exit();
return value;
}
function map2(line, _, blank) {
return (blank ? "" : " ") + line;
}
// node_modules/mdast-util-to-markdown/lib/util/check-quote.js
function checkQuote(state) {
const marker = state.options.quote || '"';
if (marker !== '"' && marker !== "'") {
throw new Error(
"Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/handle/definition.js
function definition(node2, _, state, info) {
const quote = checkQuote(state);
const suffix = quote === '"' ? "Quote" : "Apostrophe";
const exit = state.enter("definition");
let subexit = state.enter("label");
const tracker = state.createTracker(info);
let value = tracker.move("[");
value += tracker.move(
state.safe(state.associationId(node2), {
before: value,
after: "]",
...tracker.current()
})
);
value += tracker.move("]: ");
subexit();
if (
// If theres no url, or…
!node2.url || // If there are control characters or whitespace.
/[\0- \u007F]/.test(node2.url)
) {
subexit = state.enter("destinationLiteral");
value += tracker.move("<");
value += tracker.move(
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
);
value += tracker.move(">");
} else {
subexit = state.enter("destinationRaw");
value += tracker.move(
state.safe(node2.url, {
before: value,
after: node2.title ? " " : "\n",
...tracker.current()
})
);
}
subexit();
if (node2.title) {
subexit = state.enter(`title${suffix}`);
value += tracker.move(" " + quote);
value += tracker.move(
state.safe(node2.title, {
before: value,
after: quote,
...tracker.current()
})
);
value += tracker.move(quote);
subexit();
}
exit();
return value;
}
// node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
function checkEmphasis(state) {
const marker = state.options.emphasis || "*";
if (marker !== "*" && marker !== "_") {
throw new Error(
"Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
function encodeCharacterReference(code2) {
return "&#x" + code2.toString(16).toUpperCase() + ";";
}
// node_modules/micromark-util-classify-character/dev/index.js
function classifyCharacter(code2) {
if (code2 === codes.eof || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
return constants.characterGroupWhitespace;
}
if (unicodePunctuation(code2)) {
return constants.characterGroupPunctuation;
}
}
// node_modules/mdast-util-to-markdown/lib/util/encode-info.js
function encodeInfo(outside, inside, marker) {
const outsideKind = classifyCharacter(outside);
const insideKind = classifyCharacter(inside);
if (outsideKind === void 0) {
return insideKind === void 0 ? (
// Letter inside:
// we have to encode *both* letters for `_` as it is looser.
// it already forms for `*` (and GFMs `~`).
marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false }
) : insideKind === 1 ? (
// Whitespace inside: encode both (letter, whitespace).
{ inside: true, outside: true }
) : (
// Punctuation inside: encode outer (letter)
{ inside: false, outside: true }
);
}
if (outsideKind === 1) {
return insideKind === void 0 ? (
// Letter inside: already forms.
{ inside: false, outside: false }
) : insideKind === 1 ? (
// Whitespace inside: encode both (whitespace).
{ inside: true, outside: true }
) : (
// Punctuation inside: already forms.
{ inside: false, outside: false }
);
}
return insideKind === void 0 ? (
// Letter inside: already forms.
{ inside: false, outside: false }
) : insideKind === 1 ? (
// Whitespace inside: encode inner (whitespace).
{ inside: true, outside: false }
) : (
// Punctuation inside: already forms.
{ inside: false, outside: false }
);
}
// node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
emphasis.peek = emphasisPeek;
function emphasis(node2, _, state, info) {
const marker = checkEmphasis(state);
const exit = state.enter("emphasis");
const tracker = state.createTracker(info);
const before = tracker.move(marker);
let between = tracker.move(
state.containerPhrasing(node2, {
after: marker,
before,
...tracker.current()
})
);
const betweenHead = between.charCodeAt(0);
const open = encodeInfo(
info.before.charCodeAt(info.before.length - 1),
betweenHead,
marker
);
if (open.inside) {
between = encodeCharacterReference(betweenHead) + between.slice(1);
}
const betweenTail = between.charCodeAt(between.length - 1);
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
if (close.inside) {
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
}
const after = tracker.move(marker);
exit();
state.attentionEncodeSurroundingInfo = {
after: close.outside,
before: open.outside
};
return before + between + after;
}
function emphasisPeek(_, _1, state) {
return state.options.emphasis || "*";
}
// node_modules/mdast-util-to-string/lib/index.js
var emptyOptions = {};
function toString(value, options) {
const settings = options || emptyOptions;
const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
return one(value, includeImageAlt, includeHtml);
}
function one(value, includeImageAlt, includeHtml) {
if (node(value)) {
if ("value" in value) {
return value.type === "html" && !includeHtml ? "" : value.value;
}
if (includeImageAlt && "alt" in value && value.alt) {
return value.alt;
}
if ("children" in value) {
return all(value.children, includeImageAlt, includeHtml);
}
}
if (Array.isArray(value)) {
return all(value, includeImageAlt, includeHtml);
}
return "";
}
function all(values2, includeImageAlt, includeHtml) {
const result = [];
let index = -1;
while (++index < values2.length) {
result[index] = one(values2[index], includeImageAlt, includeHtml);
}
return result.join("");
}
function node(value) {
return Boolean(value && typeof value === "object");
}
// node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
function formatHeadingAsSetext(node2, state) {
let literalWithBreak = false;
visit(node2, function(node3) {
if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
literalWithBreak = true;
return EXIT;
}
});
return Boolean(
(!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
);
}
// node_modules/mdast-util-to-markdown/lib/handle/heading.js
function heading(node2, _, state, info) {
const rank = Math.max(Math.min(6, node2.depth || 1), 1);
const tracker = state.createTracker(info);
if (formatHeadingAsSetext(node2, state)) {
const exit2 = state.enter("headingSetext");
const subexit2 = state.enter("phrasing");
const value2 = state.containerPhrasing(node2, {
...tracker.current(),
before: "\n",
after: "\n"
});
subexit2();
exit2();
return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
// The whole size…
value2.length - // Minus the position of the character after the last EOL (or
// 0 if there is none)…
(Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
);
}
const sequence = "#".repeat(rank);
const exit = state.enter("headingAtx");
const subexit = state.enter("phrasing");
tracker.move(sequence + " ");
let value = state.containerPhrasing(node2, {
before: "# ",
after: "\n",
...tracker.current()
});
if (/^[\t ]/.test(value)) {
value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
}
value = value ? sequence + " " + value : sequence;
if (state.options.closeAtx) {
value += " " + sequence;
}
subexit();
exit();
return value;
}
// node_modules/mdast-util-to-markdown/lib/handle/html.js
html.peek = htmlPeek;
function html(node2) {
return node2.value || "";
}
function htmlPeek() {
return "<";
}
// node_modules/mdast-util-to-markdown/lib/handle/image.js
image.peek = imagePeek;
function image(node2, _, state, info) {
const quote = checkQuote(state);
const suffix = quote === '"' ? "Quote" : "Apostrophe";
const exit = state.enter("image");
let subexit = state.enter("label");
const tracker = state.createTracker(info);
let value = tracker.move("![");
value += tracker.move(
state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
);
value += tracker.move("](");
subexit();
if (
// If theres no url but there is a title…
!node2.url && node2.title || // If there are control characters or whitespace.
/[\0- \u007F]/.test(node2.url)
) {
subexit = state.enter("destinationLiteral");
value += tracker.move("<");
value += tracker.move(
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
);
value += tracker.move(">");
} else {
subexit = state.enter("destinationRaw");
value += tracker.move(
state.safe(node2.url, {
before: value,
after: node2.title ? " " : ")",
...tracker.current()
})
);
}
subexit();
if (node2.title) {
subexit = state.enter(`title${suffix}`);
value += tracker.move(" " + quote);
value += tracker.move(
state.safe(node2.title, {
before: value,
after: quote,
...tracker.current()
})
);
value += tracker.move(quote);
subexit();
}
value += tracker.move(")");
exit();
return value;
}
function imagePeek() {
return "!";
}
// node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
imageReference.peek = imageReferencePeek;
function imageReference(node2, _, state, info) {
const type = node2.referenceType;
const exit = state.enter("imageReference");
let subexit = state.enter("label");
const tracker = state.createTracker(info);
let value = tracker.move("![");
const alt = state.safe(node2.alt, {
before: value,
after: "]",
...tracker.current()
});
value += tracker.move(alt + "][");
subexit();
const stack = state.stack;
state.stack = [];
subexit = state.enter("reference");
const reference = state.safe(state.associationId(node2), {
before: value,
after: "]",
...tracker.current()
});
subexit();
state.stack = stack;
exit();
if (type === "full" || !alt || alt !== reference) {
value += tracker.move(reference + "]");
} else if (type === "shortcut") {
value = value.slice(0, -1);
} else {
value += tracker.move("]");
}
return value;
}
function imageReferencePeek() {
return "!";
}
// node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
inlineCode.peek = inlineCodePeek;
function inlineCode(node2, _, state) {
let value = node2.value || "";
let sequence = "`";
let index = -1;
while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
sequence += "`";
}
if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
value = " " + value + " ";
}
while (++index < state.unsafe.length) {
const pattern = state.unsafe[index];
const expression = state.compilePattern(pattern);
let match;
if (!pattern.atBreak) continue;
while (match = expression.exec(value)) {
let position = match.index;
if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
position--;
}
value = value.slice(0, position) + " " + value.slice(match.index + 1);
}
}
return sequence + value + sequence;
}
function inlineCodePeek() {
return "`";
}
// node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
function formatLinkAsAutolink(node2, state) {
const raw = toString(node2);
return Boolean(
!state.options.resourceLink && // If theres a url…
node2.url && // And theres a no title…
!node2.title && // And the content of `node` is a single text node…
node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
(raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
/^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesnt contain ASCII control codes (character escapes and
// references dont work), space, or angle brackets…
!/[\0- <>\u007F]/.test(node2.url)
);
}
// node_modules/mdast-util-to-markdown/lib/handle/link.js
link.peek = linkPeek;
function link(node2, _, state, info) {
const quote = checkQuote(state);
const suffix = quote === '"' ? "Quote" : "Apostrophe";
const tracker = state.createTracker(info);
let exit;
let subexit;
if (formatLinkAsAutolink(node2, state)) {
const stack = state.stack;
state.stack = [];
exit = state.enter("autolink");
let value2 = tracker.move("<");
value2 += tracker.move(
state.containerPhrasing(node2, {
before: value2,
after: ">",
...tracker.current()
})
);
value2 += tracker.move(">");
exit();
state.stack = stack;
return value2;
}
exit = state.enter("link");
subexit = state.enter("label");
let value = tracker.move("[");
value += tracker.move(
state.containerPhrasing(node2, {
before: value,
after: "](",
...tracker.current()
})
);
value += tracker.move("](");
subexit();
if (
// If theres no url but there is a title…
!node2.url && node2.title || // If there are control characters or whitespace.
/[\0- \u007F]/.test(node2.url)
) {
subexit = state.enter("destinationLiteral");
value += tracker.move("<");
value += tracker.move(
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
);
value += tracker.move(">");
} else {
subexit = state.enter("destinationRaw");
value += tracker.move(
state.safe(node2.url, {
before: value,
after: node2.title ? " " : ")",
...tracker.current()
})
);
}
subexit();
if (node2.title) {
subexit = state.enter(`title${suffix}`);
value += tracker.move(" " + quote);
value += tracker.move(
state.safe(node2.title, {
before: value,
after: quote,
...tracker.current()
})
);
value += tracker.move(quote);
subexit();
}
value += tracker.move(")");
exit();
return value;
}
function linkPeek(node2, _, state) {
return formatLinkAsAutolink(node2, state) ? "<" : "[";
}
// node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
linkReference.peek = linkReferencePeek;
function linkReference(node2, _, state, info) {
const type = node2.referenceType;
const exit = state.enter("linkReference");
let subexit = state.enter("label");
const tracker = state.createTracker(info);
let value = tracker.move("[");
const text2 = state.containerPhrasing(node2, {
before: value,
after: "]",
...tracker.current()
});
value += tracker.move(text2 + "][");
subexit();
const stack = state.stack;
state.stack = [];
subexit = state.enter("reference");
const reference = state.safe(state.associationId(node2), {
before: value,
after: "]",
...tracker.current()
});
subexit();
state.stack = stack;
exit();
if (type === "full" || !text2 || text2 !== reference) {
value += tracker.move(reference + "]");
} else if (type === "shortcut") {
value = value.slice(0, -1);
} else {
value += tracker.move("]");
}
return value;
}
function linkReferencePeek() {
return "[";
}
// node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
function checkBullet(state) {
const marker = state.options.bullet || "*";
if (marker !== "*" && marker !== "+" && marker !== "-") {
throw new Error(
"Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
function checkBulletOther(state) {
const bullet = checkBullet(state);
const bulletOther = state.options.bulletOther;
if (!bulletOther) {
return bullet === "*" ? "-" : "*";
}
if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
throw new Error(
"Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
);
}
if (bulletOther === bullet) {
throw new Error(
"Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
);
}
return bulletOther;
}
// node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
function checkBulletOrdered(state) {
const marker = state.options.bulletOrdered || ".";
if (marker !== "." && marker !== ")") {
throw new Error(
"Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/util/check-rule.js
function checkRule(state) {
const marker = state.options.rule || "*";
if (marker !== "*" && marker !== "-" && marker !== "_") {
throw new Error(
"Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/handle/list.js
function list(node2, parent, state, info) {
const exit = state.enter("list");
const bulletCurrent = state.bulletCurrent;
let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
if (!node2.ordered) {
const firstListItem = node2.children ? node2.children[0] : void 0;
if (
// Bullet could be used as a thematic break marker:
(bullet === "*" || bullet === "-") && // Empty first list item:
firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
) {
useDifferentMarker = true;
}
if (checkRule(state) === bullet && firstListItem) {
let index = -1;
while (++index < node2.children.length) {
const item = node2.children[index];
if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
useDifferentMarker = true;
break;
}
}
}
}
if (useDifferentMarker) {
bullet = bulletOther;
}
state.bulletCurrent = bullet;
const value = state.containerFlow(node2, info);
state.bulletLastUsed = bullet;
state.bulletCurrent = bulletCurrent;
exit();
return value;
}
// node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
function checkListItemIndent(state) {
const style = state.options.listItemIndent || "one";
if (style !== "tab" && style !== "one" && style !== "mixed") {
throw new Error(
"Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
);
}
return style;
}
// node_modules/mdast-util-to-markdown/lib/handle/list-item.js
function listItem(node2, parent, state, info) {
const listItemIndent = checkListItemIndent(state);
let bullet = state.bulletCurrent || checkBullet(state);
if (parent && parent.type === "list" && parent.ordered) {
bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
}
let size = bullet.length + 1;
if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
size = Math.ceil(size / 4) * 4;
}
const tracker = state.createTracker(info);
tracker.move(bullet + " ".repeat(size - bullet.length));
tracker.shift(size);
const exit = state.enter("listItem");
const value = state.indentLines(
state.containerFlow(node2, tracker.current()),
map3
);
exit();
return value;
function map3(line, index, blank) {
if (index) {
return (blank ? "" : " ".repeat(size)) + line;
}
return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
}
}
// node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
function paragraph(node2, _, state, info) {
const exit = state.enter("paragraph");
const subexit = state.enter("phrasing");
const value = state.containerPhrasing(node2, info);
subexit();
exit();
return value;
}
// node_modules/mdast-util-phrasing/lib/index.js
var phrasing = (
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
convert([
"break",
"delete",
"emphasis",
// To do: next major: removed since footnotes were added to GFM.
"footnote",
"footnoteReference",
"image",
"imageReference",
"inlineCode",
// Enabled by `mdast-util-math`:
"inlineMath",
"link",
"linkReference",
// Enabled by `mdast-util-mdx`:
"mdxJsxTextElement",
// Enabled by `mdast-util-mdx`:
"mdxTextExpression",
"strong",
"text",
// Enabled by `mdast-util-directive`:
"textDirective"
])
);
// node_modules/mdast-util-to-markdown/lib/handle/root.js
function root(node2, _, state, info) {
const hasPhrasing = node2.children.some(function(d) {
return phrasing(d);
});
const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
return container.call(state, node2, info);
}
// node_modules/mdast-util-to-markdown/lib/util/check-strong.js
function checkStrong(state) {
const marker = state.options.strong || "*";
if (marker !== "*" && marker !== "_") {
throw new Error(
"Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
);
}
return marker;
}
// node_modules/mdast-util-to-markdown/lib/handle/strong.js
strong.peek = strongPeek;
function strong(node2, _, state, info) {
const marker = checkStrong(state);
const exit = state.enter("strong");
const tracker = state.createTracker(info);
const before = tracker.move(marker + marker);
let between = tracker.move(
state.containerPhrasing(node2, {
after: marker,
before,
...tracker.current()
})
);
const betweenHead = between.charCodeAt(0);
const open = encodeInfo(
info.before.charCodeAt(info.before.length - 1),
betweenHead,
marker
);
if (open.inside) {
between = encodeCharacterReference(betweenHead) + between.slice(1);
}
const betweenTail = between.charCodeAt(between.length - 1);
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
if (close.inside) {
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
}
const after = tracker.move(marker + marker);
exit();
state.attentionEncodeSurroundingInfo = {
after: close.outside,
before: open.outside
};
return before + between + after;
}
function strongPeek(_, _1, state) {
return state.options.strong || "*";
}
// node_modules/mdast-util-to-markdown/lib/handle/text.js
function text(node2, _, state, info) {
return state.safe(node2.value, info);
}
// node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
function checkRuleRepetition(state) {
const repetition = state.options.ruleRepetition || 3;
if (repetition < 3) {
throw new Error(
"Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
);
}
return repetition;
}
// node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
function thematicBreak(_, _1, state) {
const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
return state.options.ruleSpaces ? value.slice(0, -1) : value;
}
// node_modules/mdast-util-to-markdown/lib/handle/index.js
var handle = {
blockquote,
break: hardBreak,
code,
definition,
emphasis,
hardBreak,
heading,
html,
image,
imageReference,
inlineCode,
link,
linkReference,
list,
listItem,
paragraph,
root,
strong,
text,
thematicBreak
};
// node_modules/mdast-util-to-markdown/lib/configure.js
var own = {}.hasOwnProperty;
// node_modules/decode-named-character-reference/index.dom.js
var element = document.createElement("i");
function decodeNamedCharacterReference(value) {
const characterReference2 = "&" + value + ";";
element.innerHTML = characterReference2;
const character = element.textContent;
if (
// @ts-expect-error: TypeScript is wrong that `textContent` on elements can
// yield `null`.
character.charCodeAt(character.length - 1) === 59 && value !== "semi"
) {
return false;
}
return character === characterReference2 ? false : character;
}
// node_modules/micromark-factory-space/dev/index.js
function factorySpace(effects, ok2, type, max) {
const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
let size = 0;
return start;
function start(code2) {
if (markdownSpace(code2)) {
effects.enter(type);
return prefix(code2);
}
return ok2(code2);
}
function prefix(code2) {
if (markdownSpace(code2) && size++ < limit) {
effects.consume(code2);
return prefix;
}
effects.exit(type);
return ok2(code2);
}
}
// node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
var nonLazyContinuation = {
partial: true,
tokenize: tokenizeNonLazyContinuation
};
var codeFenced = {
concrete: true,
name: "codeFenced",
tokenize: tokenizeCodeFenced
};
function tokenizeCodeFenced(effects, ok2, nok) {
const self = this;
const closeStart = { partial: true, tokenize: tokenizeCloseStart };
let initialPrefix = 0;
let sizeOpen = 0;
let marker;
return start;
function start(code2) {
return beforeSequenceOpen(code2);
}
function beforeSequenceOpen(code2) {
ok(
code2 === codes.graveAccent || code2 === codes.tilde,
"expected `` ` `` or `~`"
);
const tail = self.events[self.events.length - 1];
initialPrefix = tail && tail[1].type === types.linePrefix ? tail[2].sliceSerialize(tail[1], true).length : 0;
marker = code2;
effects.enter(types.codeFenced);
effects.enter(types.codeFencedFence);
effects.enter(types.codeFencedFenceSequence);
return sequenceOpen(code2);
}
function sequenceOpen(code2) {
if (code2 === marker) {
sizeOpen++;
effects.consume(code2);
return sequenceOpen;
}
if (sizeOpen < constants.codeFencedSequenceSizeMin) {
return nok(code2);
}
effects.exit(types.codeFencedFenceSequence);
return markdownSpace(code2) ? factorySpace(effects, infoBefore, types.whitespace)(code2) : infoBefore(code2);
}
function infoBefore(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
effects.exit(types.codeFencedFence);
return self.interrupt ? ok2(code2) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
}
effects.enter(types.codeFencedFenceInfo);
effects.enter(types.chunkString, { contentType: constants.contentTypeString });
return info(code2);
}
function info(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
effects.exit(types.chunkString);
effects.exit(types.codeFencedFenceInfo);
return infoBefore(code2);
}
if (markdownSpace(code2)) {
effects.exit(types.chunkString);
effects.exit(types.codeFencedFenceInfo);
return factorySpace(effects, metaBefore, types.whitespace)(code2);
}
if (code2 === codes.graveAccent && code2 === marker) {
return nok(code2);
}
effects.consume(code2);
return info;
}
function metaBefore(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
return infoBefore(code2);
}
effects.enter(types.codeFencedFenceMeta);
effects.enter(types.chunkString, { contentType: constants.contentTypeString });
return meta(code2);
}
function meta(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
effects.exit(types.chunkString);
effects.exit(types.codeFencedFenceMeta);
return infoBefore(code2);
}
if (code2 === codes.graveAccent && code2 === marker) {
return nok(code2);
}
effects.consume(code2);
return meta;
}
function atNonLazyBreak(code2) {
ok(markdownLineEnding(code2), "expected eol");
return effects.attempt(closeStart, after, contentBefore)(code2);
}
function contentBefore(code2) {
ok(markdownLineEnding(code2), "expected eol");
effects.enter(types.lineEnding);
effects.consume(code2);
effects.exit(types.lineEnding);
return contentStart;
}
function contentStart(code2) {
return initialPrefix > 0 && markdownSpace(code2) ? factorySpace(
effects,
beforeContentChunk,
types.linePrefix,
initialPrefix + 1
)(code2) : beforeContentChunk(code2);
}
function beforeContentChunk(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
}
effects.enter(types.codeFlowValue);
return contentChunk(code2);
}
function contentChunk(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
effects.exit(types.codeFlowValue);
return beforeContentChunk(code2);
}
effects.consume(code2);
return contentChunk;
}
function after(code2) {
effects.exit(types.codeFenced);
return ok2(code2);
}
function tokenizeCloseStart(effects2, ok3, nok2) {
let size = 0;
return startBefore;
function startBefore(code2) {
ok(markdownLineEnding(code2), "expected eol");
effects2.enter(types.lineEnding);
effects2.consume(code2);
effects2.exit(types.lineEnding);
return start2;
}
function start2(code2) {
ok(
self.parser.constructs.disable.null,
"expected `disable.null` to be populated"
);
effects2.enter(types.codeFencedFence);
return markdownSpace(code2) ? factorySpace(
effects2,
beforeSequenceClose,
types.linePrefix,
self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : constants.tabSize
)(code2) : beforeSequenceClose(code2);
}
function beforeSequenceClose(code2) {
if (code2 === marker) {
effects2.enter(types.codeFencedFenceSequence);
return sequenceClose(code2);
}
return nok2(code2);
}
function sequenceClose(code2) {
if (code2 === marker) {
size++;
effects2.consume(code2);
return sequenceClose;
}
if (size >= sizeOpen) {
effects2.exit(types.codeFencedFenceSequence);
return markdownSpace(code2) ? factorySpace(effects2, sequenceCloseAfter, types.whitespace)(code2) : sequenceCloseAfter(code2);
}
return nok2(code2);
}
function sequenceCloseAfter(code2) {
if (code2 === codes.eof || markdownLineEnding(code2)) {
effects2.exit(types.codeFencedFence);
return ok3(code2);
}
return nok2(code2);
}
}
}
function tokenizeNonLazyContinuation(effects, ok2, nok) {
const self = this;
return start;
function start(code2) {
if (code2 === codes.eof) {
return nok(code2);
}
ok(markdownLineEnding(code2), "expected eol");
effects.enter(types.lineEnding);
effects.consume(code2);
effects.exit(types.lineEnding);
return lineStart;
}
function lineStart(code2) {
return self.parser.lazy[self.now().line] ? nok(code2) : ok2(code2);
}
}
// node_modules/micromark-factory-whitespace/dev/index.js
function factoryWhitespace(effects, ok2) {
let seen;
return start;
function start(code2) {
if (markdownLineEnding(code2)) {
effects.enter(types.lineEnding);
effects.consume(code2);
effects.exit(types.lineEnding);
seen = true;
return start;
}
if (markdownSpace(code2)) {
return factorySpace(
effects,
start,
seen ? types.linePrefix : types.lineSuffix
)(code2);
}
return ok2(code2);
}
}
// node_modules/micromark-util-chunked/dev/index.js
function splice(list3, start, remove, items) {
const end = list3.length;
let chunkStart = 0;
let parameters;
if (start < 0) {
start = -start > end ? 0 : end + start;
} else {
start = start > end ? end : start;
}
remove = remove > 0 ? remove : 0;
if (items.length < constants.v8MaxSafeChunkSize) {
parameters = Array.from(items);
parameters.unshift(start, remove);
list3.splice(...parameters);
} else {
if (remove) list3.splice(start, remove);
while (chunkStart < items.length) {
parameters = items.slice(
chunkStart,
chunkStart + constants.v8MaxSafeChunkSize
);
parameters.unshift(start, 0);
list3.splice(...parameters);
chunkStart += constants.v8MaxSafeChunkSize;
start += constants.v8MaxSafeChunkSize;
}
}
}
function push(list3, items) {
if (list3.length > 0) {
splice(list3, list3.length, 0, items);
return list3;
}
return items;
}
// node_modules/micromark-util-resolve-all/index.js
function resolveAll(constructs, events, context) {
const called = [];
let index = -1;
while (++index < constructs.length) {
const resolve = constructs[index].resolveAll;
if (resolve && !called.includes(resolve)) {
events = resolve(events, context);
called.push(resolve);
}
}
return events;
}
// node_modules/micromark-core-commonmark/dev/lib/blank-line.js
var blankLine = { partial: true, tokenize: tokenizeBlankLine };
function tokenizeBlankLine(effects, ok2, nok) {
return start;
function start(code2) {
return markdownSpace(code2) ? factorySpace(effects, after, types.linePrefix)(code2) : after(code2);
}
function after(code2) {
return code2 === codes.eof || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
}
}
// node_modules/micromark-factory-destination/dev/index.js
function factoryDestination(effects, ok2, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
const limit = max || Number.POSITIVE_INFINITY;
let balance = 0;
return start;
function start(code2) {
if (code2 === codes.lessThan) {
effects.enter(type);
effects.enter(literalType);
effects.enter(literalMarkerType);
effects.consume(code2);
effects.exit(literalMarkerType);
return enclosedBefore;
}
if (code2 === codes.eof || code2 === codes.space || code2 === codes.rightParenthesis || asciiControl(code2)) {
return nok(code2);
}
effects.enter(type);
effects.enter(rawType);
effects.enter(stringType);
effects.enter(types.chunkString, { contentType: constants.contentTypeString });
return raw(code2);
}
function enclosedBefore(code2) {
if (code2 === codes.greaterThan) {
effects.enter(literalMarkerType);
effects.consume(code2);
effects.exit(literalMarkerType);
effects.exit(literalType);
effects.exit(type);
return ok2;
}
effects.enter(stringType);
effects.enter(types.chunkString, { contentType: constants.contentTypeString });
return enclosed(code2);
}
function enclosed(code2) {
if (code2 === codes.greaterThan) {
effects.exit(types.chunkString);
effects.exit(stringType);
return enclosedBefore(code2);
}
if (code2 === codes.eof || code2 === codes.lessThan || markdownLineEnding(code2)) {
return nok(code2);
}
effects.consume(code2);
return code2 === codes.backslash ? enclosedEscape : enclosed;
}
function enclosedEscape(code2) {
if (code2 === codes.lessThan || code2 === codes.greaterThan || code2 === codes.backslash) {
effects.consume(code2);
return enclosed;
}
return enclosed(code2);
}
function raw(code2) {
if (!balance && (code2 === codes.eof || code2 === codes.rightParenthesis || markdownLineEndingOrSpace(code2))) {
effects.exit(types.chunkString);
effects.exit(stringType);
effects.exit(rawType);
effects.exit(type);
return ok2(code2);
}
if (balance < limit && code2 === codes.leftParenthesis) {
effects.consume(code2);
balance++;
return raw;
}
if (code2 === codes.rightParenthesis) {
effects.consume(code2);
balance--;
return raw;
}
if (code2 === codes.eof || code2 === codes.space || code2 === codes.leftParenthesis || asciiControl(code2)) {
return nok(code2);
}
effects.consume(code2);
return code2 === codes.backslash ? rawEscape : raw;
}
function rawEscape(code2) {
if (code2 === codes.leftParenthesis || code2 === codes.rightParenthesis || code2 === codes.backslash) {
effects.consume(code2);
return raw;
}
return raw(code2);
}
}
// node_modules/micromark-factory-label/dev/index.js
function factoryLabel(effects, ok2, nok, type, markerType, stringType) {
const self = this;
let size = 0;
let seen;
return start;
function start(code2) {
ok(code2 === codes.leftSquareBracket, "expected `[`");
effects.enter(type);
effects.enter(markerType);
effects.consume(code2);
effects.exit(markerType);
effects.enter(stringType);
return atBreak;
}
function atBreak(code2) {
if (size > constants.linkReferenceSizeMax || code2 === codes.eof || code2 === codes.leftSquareBracket || code2 === codes.rightSquareBracket && !seen || // To do: remove in the future once weve switched from
// `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
// which doesnt need this.
// Hidden footnotes hook.
/* c8 ignore next 3 */
code2 === codes.caret && !size && "_hiddenFootnoteSupport" in self.parser.constructs) {
return nok(code2);
}
if (code2 === codes.rightSquareBracket) {
effects.exit(stringType);
effects.enter(markerType);
effects.consume(code2);
effects.exit(markerType);
effects.exit(type);
return ok2;
}
if (markdownLineEnding(code2)) {
effects.enter(types.lineEnding);
effects.consume(code2);
effects.exit(types.lineEnding);
return atBreak;
}
effects.enter(types.chunkString, { contentType: constants.contentTypeString });
return labelInside(code2);
}
function labelInside(code2) {
if (code2 === codes.eof || code2 === codes.leftSquareBracket || code2 === codes.rightSquareBracket || markdownLineEnding(code2) || size++ > constants.linkReferenceSizeMax) {
effects.exit(types.chunkString);
return atBreak(code2);
}
effects.consume(code2);
if (!seen) seen = !markdownSpace(code2);
return code2 === codes.backslash ? labelEscape : labelInside;
}
function labelEscape(code2) {
if (code2 === codes.leftSquareBracket || code2 === codes.backslash || code2 === codes.rightSquareBracket) {
effects.consume(code2);
size++;
return labelInside;
}
return labelInside(code2);
}
}
// node_modules/micromark-factory-title/dev/index.js
function factoryTitle(effects, ok2, nok, type, markerType, stringType) {
let marker;
return start;
function start(code2) {
if (code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.leftParenthesis) {
effects.enter(type);
effects.enter(markerType);
effects.consume(code2);
effects.exit(markerType);
marker = code2 === codes.leftParenthesis ? codes.rightParenthesis : code2;
return begin;
}
return nok(code2);
}
function begin(code2) {
if (code2 === marker) {
effects.enter(markerType);
effects.consume(code2);
effects.exit(markerType);
effects.exit(type);
return ok2;
}
effects.enter(stringType);
return atBreak(code2);
}
function atBreak(code2) {
if (code2 === marker) {
effects.exit(stringType);
return begin(marker);
}
if (code2 === codes.eof) {
return nok(code2);
}
if (markdownLineEnding(code2)) {
effects.enter(types.lineEnding);
effects.consume(code2);
effects.exit(types.lineEnding);
return factorySpace(effects, atBreak, types.linePrefix);
}
effects.enter(types.chunkString, { contentType: constants.contentTypeString });
return inside(code2);
}
function inside(code2) {
if (code2 === marker || code2 === codes.eof || markdownLineEnding(code2)) {
effects.exit(types.chunkString);
return atBreak(code2);
}
effects.consume(code2);
return code2 === codes.backslash ? escape : inside;
}
function escape(code2) {
if (code2 === marker || code2 === codes.backslash) {
effects.consume(code2);
return inside;
}
return inside(code2);
}
}
// node_modules/micromark-util-normalize-identifier/dev/index.js
function normalizeIdentifier(value) {
return value.replace(/[\t\n\r ]+/g, values.space).replace(/^ | $/g, "").toLowerCase().toUpperCase();
}
// node_modules/micromark-core-commonmark/dev/lib/label-end.js
var labelEnd = {
name: "labelEnd",
resolveAll: resolveAllLabelEnd,
resolveTo: resolveToLabelEnd,
tokenize: tokenizeLabelEnd
};
var resourceConstruct = { tokenize: tokenizeResource };
var referenceFullConstruct = { tokenize: tokenizeReferenceFull };
var referenceCollapsedConstruct = { tokenize: tokenizeReferenceCollapsed };
function resolveAllLabelEnd(events) {
let index = -1;
const newEvents = [];
while (++index < events.length) {
const token = events[index][1];
newEvents.push(events[index]);
if (token.type === types.labelImage || token.type === types.labelLink || token.type === types.labelEnd) {
const offset = token.type === types.labelImage ? 4 : 2;
token.type = types.data;
index += offset;
}
}
if (events.length !== newEvents.length) {
splice(events, 0, events.length, newEvents);
}
return events;
}
function resolveToLabelEnd(events, context) {
let index = events.length;
let offset = 0;
let token;
let open;
let close;
let media;
while (index--) {
token = events[index][1];
if (open) {
if (token.type === types.link || token.type === types.labelLink && token._inactive) {
break;
}
if (events[index][0] === "enter" && token.type === types.labelLink) {
token._inactive = true;
}
} else if (close) {
if (events[index][0] === "enter" && (token.type === types.labelImage || token.type === types.labelLink) && !token._balanced) {
open = index;
if (token.type !== types.labelLink) {
offset = 2;
break;
}
}
} else if (token.type === types.labelEnd) {
close = index;
}
}
ok(open !== void 0, "`open` is supposed to be found");
ok(close !== void 0, "`close` is supposed to be found");
const group = {
type: events[open][1].type === types.labelLink ? types.link : types.image,
start: { ...events[open][1].start },
end: { ...events[events.length - 1][1].end }
};
const label = {
type: types.label,
start: { ...events[open][1].start },
end: { ...events[close][1].end }
};
const text2 = {
type: types.labelText,
start: { ...events[open + offset + 2][1].end },
end: { ...events[close - 2][1].start }
};
media = [
["enter", group, context],
["enter", label, context]
];
media = push(media, events.slice(open + 1, open + offset + 3));
media = push(media, [["enter", text2, context]]);
ok(
context.parser.constructs.insideSpan.null,
"expected `insideSpan.null` to be populated"
);
media = push(
media,
resolveAll(
context.parser.constructs.insideSpan.null,
events.slice(open + offset + 4, close - 3),
context
)
);
media = push(media, [
["exit", text2, context],
events[close - 2],
events[close - 1],
["exit", label, context]
]);
media = push(media, events.slice(close + 1));
media = push(media, [["exit", group, context]]);
splice(events, open, events.length, media);
return events;
}
function tokenizeLabelEnd(effects, ok2, nok) {
const self = this;
let index = self.events.length;
let labelStart;
let defined;
while (index--) {
if ((self.events[index][1].type === types.labelImage || self.events[index][1].type === types.labelLink) && !self.events[index][1]._balanced) {
labelStart = self.events[index][1];
break;
}
}
return start;
function start(code2) {
ok(code2 === codes.rightSquareBracket, "expected `]`");
if (!labelStart) {
return nok(code2);
}
if (labelStart._inactive) {
return labelEndNok(code2);
}
defined = self.parser.defined.includes(
normalizeIdentifier(
self.sliceSerialize({ start: labelStart.end, end: self.now() })
)
);
effects.enter(types.labelEnd);
effects.enter(types.labelMarker);
effects.consume(code2);
effects.exit(types.labelMarker);
effects.exit(types.labelEnd);
return after;
}
function after(code2) {
if (code2 === codes.leftParenthesis) {
return effects.attempt(
resourceConstruct,
labelEndOk,
defined ? labelEndOk : labelEndNok
)(code2);
}
if (code2 === codes.leftSquareBracket) {
return effects.attempt(
referenceFullConstruct,
labelEndOk,
defined ? referenceNotFull : labelEndNok
)(code2);
}
return defined ? labelEndOk(code2) : labelEndNok(code2);
}
function referenceNotFull(code2) {
return effects.attempt(
referenceCollapsedConstruct,
labelEndOk,
labelEndNok
)(code2);
}
function labelEndOk(code2) {
return ok2(code2);
}
function labelEndNok(code2) {
labelStart._balanced = true;
return nok(code2);
}
}
function tokenizeResource(effects, ok2, nok) {
return resourceStart;
function resourceStart(code2) {
ok(code2 === codes.leftParenthesis, "expected left paren");
effects.enter(types.resource);
effects.enter(types.resourceMarker);
effects.consume(code2);
effects.exit(types.resourceMarker);
return resourceBefore;
}
function resourceBefore(code2) {
return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceOpen)(code2) : resourceOpen(code2);
}
function resourceOpen(code2) {
if (code2 === codes.rightParenthesis) {
return resourceEnd(code2);
}
return factoryDestination(
effects,
resourceDestinationAfter,
resourceDestinationMissing,
types.resourceDestination,
types.resourceDestinationLiteral,
types.resourceDestinationLiteralMarker,
types.resourceDestinationRaw,
types.resourceDestinationString,
constants.linkResourceDestinationBalanceMax
)(code2);
}
function resourceDestinationAfter(code2) {
return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceBetween)(code2) : resourceEnd(code2);
}
function resourceDestinationMissing(code2) {
return nok(code2);
}
function resourceBetween(code2) {
if (code2 === codes.quotationMark || code2 === codes.apostrophe || code2 === codes.leftParenthesis) {
return factoryTitle(
effects,
resourceTitleAfter,
nok,
types.resourceTitle,
types.resourceTitleMarker,
types.resourceTitleString
)(code2);
}
return resourceEnd(code2);
}
function resourceTitleAfter(code2) {
return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceEnd)(code2) : resourceEnd(code2);
}
function resourceEnd(code2) {
if (code2 === codes.rightParenthesis) {
effects.enter(types.resourceMarker);
effects.consume(code2);
effects.exit(types.resourceMarker);
effects.exit(types.resource);
return ok2;
}
return nok(code2);
}
}
function tokenizeReferenceFull(effects, ok2, nok) {
const self = this;
return referenceFull;
function referenceFull(code2) {
ok(code2 === codes.leftSquareBracket, "expected left bracket");
return factoryLabel.call(
self,
effects,
referenceFullAfter,
referenceFullMissing,
types.reference,
types.referenceMarker,
types.referenceString
)(code2);
}
function referenceFullAfter(code2) {
return self.parser.defined.includes(
normalizeIdentifier(
self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
)
) ? ok2(code2) : nok(code2);
}
function referenceFullMissing(code2) {
return nok(code2);
}
}
function tokenizeReferenceCollapsed(effects, ok2, nok) {
return referenceCollapsedStart;
function referenceCollapsedStart(code2) {
ok(code2 === codes.leftSquareBracket, "expected left bracket");
effects.enter(types.reference);
effects.enter(types.referenceMarker);
effects.consume(code2);
effects.exit(types.referenceMarker);
return referenceCollapsedOpen;
}
function referenceCollapsedOpen(code2) {
if (code2 === codes.rightSquareBracket) {
effects.enter(types.referenceMarker);
effects.consume(code2);
effects.exit(types.referenceMarker);
effects.exit(types.reference);
return ok2;
}
return nok(code2);
}
}
// node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
var labelStartImage = {
name: "labelStartImage",
resolveAll: labelEnd.resolveAll,
tokenize: tokenizeLabelStartImage
};
function tokenizeLabelStartImage(effects, ok2, nok) {
const self = this;
return start;
function start(code2) {
ok(code2 === codes.exclamationMark, "expected `!`");
effects.enter(types.labelImage);
effects.enter(types.labelImageMarker);
effects.consume(code2);
effects.exit(types.labelImageMarker);
return open;
}
function open(code2) {
if (code2 === codes.leftSquareBracket) {
effects.enter(types.labelMarker);
effects.consume(code2);
effects.exit(types.labelMarker);
effects.exit(types.labelImage);
return after;
}
return nok(code2);
}
function after(code2) {
return code2 === codes.caret && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code2) : ok2(code2);
}
}
// node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
var labelStartLink = {
name: "labelStartLink",
resolveAll: labelEnd.resolveAll,
tokenize: tokenizeLabelStartLink
};
function tokenizeLabelStartLink(effects, ok2, nok) {
const self = this;
return start;
function start(code2) {
ok(code2 === codes.leftSquareBracket, "expected `[`");
effects.enter(types.labelLink);
effects.enter(types.labelMarker);
effects.consume(code2);
effects.exit(types.labelMarker);
effects.exit(types.labelLink);
return after;
}
function after(code2) {
return code2 === codes.caret && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code2) : ok2(code2);
}
}
export {
normalizeIdentifier,
classifyCharacter,
handle,
decodeNamedCharacterReference,
splice,
resolveAll,
factorySpace,
blankLine,
codeFenced,
factoryWhitespace
};
//# sourceMappingURL=chunk-CJXNB37Y.js.map