@dogsbay/ssg-cli 0.2.0-beta.186 → 0.2.0-beta.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +168 -0
- package/README.md +3 -1
- package/THIRD-PARTY-NOTICES.txt +23 -17
- package/chunks/{build-command-X76EICE4.mjs → build-command-NJATVOUY.mjs} +34 -25
- package/chunks/check-command-FL5O3AXB.mjs +577 -0
- package/chunks/chunk-2EM7IEQT.mjs +95 -0
- package/chunks/{chunk-JABACD5T.mjs → chunk-5A2QPRCV.mjs} +1 -30
- package/chunks/chunk-5NQOUB5I.mjs +4534 -0
- package/chunks/{chunk-YQ2K646L.mjs → chunk-CYJ6GFVM.mjs} +32 -3
- package/chunks/{chunk-XQORVEL6.mjs → chunk-FFIXBXHD.mjs} +60 -233
- package/chunks/chunk-GFG5I7WI.mjs +807 -0
- package/chunks/{chunk-AOHGXC4D.mjs → chunk-GZ3E45TE.mjs} +518 -240
- package/chunks/chunk-IAAKV7V2.mjs +37 -0
- package/chunks/{chunk-YA6TJOAM.mjs → chunk-VJ6AESSJ.mjs} +216 -24
- package/chunks/chunk-X3UPCLX5.mjs +503 -0
- package/chunks/{chunk-TRECVC6H.mjs → chunk-ZDH4JRVX.mjs} +1041 -4051
- package/chunks/{chunk-FNP5PNJW.mjs → chunk-ZRGJHNES.mjs} +6 -0
- package/chunks/compare-W4DJYVHT.mjs +239 -0
- package/chunks/compare-command-U36H55IE.mjs +144 -0
- package/chunks/{css-build-VKKTSP6P.mjs → css-build-MKIHYHCX.mjs} +2 -1
- package/chunks/{dev-DXMZPST7.mjs → dev-X3PKN4G3.mjs} +77 -26
- package/chunks/{menu-W7ZXME4A.mjs → menu-J3CLVADF.mjs} +5 -3
- package/chunks/{publish-command-AVMRM4UZ.mjs → publish-command-SAPICGGM.mjs} +15 -8
- package/chunks/{release-diff-3OZOYBXR.mjs → release-diff-Y7X63MT3.mjs} +13 -7
- package/chunks/{serve-U2YV7AQH.mjs → serve-7DR4WSYA.mjs} +2 -2
- package/cli.mjs +17 -10
- package/package.json +4 -3
- package/chunks/check-command-SXDUKSAZ.mjs +0 -256
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
detach
|
|
5
|
+
} from "./chunk-5A2QPRCV.mjs";
|
|
6
|
+
import {
|
|
7
|
+
FOREIGN_END,
|
|
8
|
+
FOREIGN_START,
|
|
9
|
+
unesc
|
|
10
|
+
} from "./chunk-G6OTOD3B.mjs";
|
|
11
|
+
|
|
12
|
+
// src/theme/classes.ts
|
|
13
|
+
var FOREIGN_BLOCK = new RegExp(`${FOREIGN_START}[\\s\\S]*?${FOREIGN_END}`, "g");
|
|
14
|
+
var seenValues = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
var SEEN_MAX_CHARS = 1e6;
|
|
16
|
+
function collectClasses(html, into) {
|
|
17
|
+
if (html.includes(FOREIGN_START)) html = html.replace(FOREIGN_BLOCK, "");
|
|
18
|
+
let seen = seenValues.get(into);
|
|
19
|
+
if (!seen) seenValues.set(into, seen = { values: /* @__PURE__ */ new Set(), chars: 0 });
|
|
20
|
+
for (const m of html.matchAll(/\sclass\s*=\s*(?:"([^"]*)"|'([^']*)')/g)) {
|
|
21
|
+
const value = m[1] ?? m[2];
|
|
22
|
+
if (seen.values.has(value)) continue;
|
|
23
|
+
if (seen.chars + value.length <= SEEN_MAX_CHARS) {
|
|
24
|
+
seen.values.add(detach(value));
|
|
25
|
+
seen.chars += value.length;
|
|
26
|
+
}
|
|
27
|
+
for (const tok of value.split(/\s+/)) {
|
|
28
|
+
if (!tok) continue;
|
|
29
|
+
const name = unesc(tok);
|
|
30
|
+
if (!into.has(name)) into.add(detach(name));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
collectClasses
|
|
37
|
+
};
|
|
@@ -12360,6 +12360,19 @@ var RESERVED_ID = /^(db-|tab-\d|tabpanel-\d|acc-\d|accpanel-\d|fn-|fnref-)/;
|
|
|
12360
12360
|
function pageId(id) {
|
|
12361
12361
|
return RESERVED_ID.test(id) ? `h-${id}` : id;
|
|
12362
12362
|
}
|
|
12363
|
+
function followRenamedId(href) {
|
|
12364
|
+
const hash = href.indexOf("#");
|
|
12365
|
+
if (hash < 0)
|
|
12366
|
+
return href;
|
|
12367
|
+
const path = href.slice(0, hash);
|
|
12368
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(path) || path.startsWith("//"))
|
|
12369
|
+
return href;
|
|
12370
|
+
const frag = href.slice(hash + 1);
|
|
12371
|
+
if (!frag || /^(fn|fnref)-/.test(frag))
|
|
12372
|
+
return href;
|
|
12373
|
+
const id = pageId(frag);
|
|
12374
|
+
return id === frag ? href : `${href.slice(0, hash + 1)}${id}`;
|
|
12375
|
+
}
|
|
12363
12376
|
function stepTitle(node) {
|
|
12364
12377
|
const title = typeof node.props?.title === "string" ? node.props.title.trim() : "";
|
|
12365
12378
|
if (!title)
|
|
@@ -12895,7 +12908,7 @@ function splitFrontmatter(source) {
|
|
|
12895
12908
|
if (content[0] === "\n")
|
|
12896
12909
|
content = content.slice(1);
|
|
12897
12910
|
}
|
|
12898
|
-
const block = raw.replace(
|
|
12911
|
+
const block = raw.replace(/^[ \t]*#[^\n]+/gm, "").trim();
|
|
12899
12912
|
if (block === "") {
|
|
12900
12913
|
return { data: {}, content };
|
|
12901
12914
|
}
|
|
@@ -13639,7 +13652,7 @@ var KNOWN_BLOCK_DIRECTIVES = [
|
|
|
13639
13652
|
// Autodoc render-result nodes. Emitted by @dogsbay/autodoc-python's
|
|
13640
13653
|
// symbolToTreeNode and resolved into the page tree at build time;
|
|
13641
13654
|
// also produced directly by migrate-mkdocs's --inline-autodoc mode
|
|
13642
|
-
// (snapshot). Round-tripping these through
|
|
13655
|
+
// (snapshot). Round-tripping these through DogsBay-MD keeps the
|
|
13643
13656
|
// inline output readable + editable.
|
|
13644
13657
|
"api-class",
|
|
13645
13658
|
"api-member",
|
|
@@ -15022,6 +15035,95 @@ var CLOSE2 = "\uE001";
|
|
|
15022
15035
|
var PLACEHOLDER_RE = /\uE000(\d+)\uE001/;
|
|
15023
15036
|
var PLACEHOLDER_RE_G = /\uE000(\d+)\uE001/g;
|
|
15024
15037
|
var PLACEHOLDER_ANY_G = /(?:\uE000|%EE%80%80)(\d+)(?:\uE001|%EE%80%81)/gi;
|
|
15038
|
+
var hugoPercentCallRe = () => /\{\{%[ \t]*\/?(?!(?:if|elif|else|endif|set|include|raw|endraw)(?![A-Za-z0-9_./-]))[A-Za-z0-9_][A-Za-z0-9_./-]*(?![A-Za-z0-9_./-])(?:(?!%\}|\{%)[^\n]){0,2000}?%\}\}/g;
|
|
15039
|
+
function keepBracedPlaceholders(source, table, stash) {
|
|
15040
|
+
if (!source.includes(OPEN2))
|
|
15041
|
+
return source;
|
|
15042
|
+
const expand = (text3) => text3.replace(PLACEHOLDER_RE_G, (m, i) => table[Number(i)]?.raw ?? m);
|
|
15043
|
+
return source.split("\n").map((line) => {
|
|
15044
|
+
if (!line.includes(OPEN2))
|
|
15045
|
+
return line;
|
|
15046
|
+
if (!DIRECTIVE_LINE_RE.test(line)) {
|
|
15047
|
+
line = line.replace(BRACED_TAG_RE, (m, i, offset) => {
|
|
15048
|
+
if (table[Number(i)]?.form !== "tag")
|
|
15049
|
+
return m;
|
|
15050
|
+
const taken = /[*_`~)\]]/.test(line[offset - 1] ?? "") || /^[ \t]*\|/.test(line.slice(offset + m.length));
|
|
15051
|
+
return taken ? stash({ raw: expand(m), form: "literal" }) : m;
|
|
15052
|
+
});
|
|
15053
|
+
}
|
|
15054
|
+
const end = line.trimEnd();
|
|
15055
|
+
if (!end.endsWith("}") || !end.includes(OPEN2) || /^(?:[ \t]*(?:>|[-*+]|\d{1,9}[.)]))*[ \t]*:{2,}[A-Za-z]/.test(line))
|
|
15056
|
+
return line;
|
|
15057
|
+
const open = end.lastIndexOf("{");
|
|
15058
|
+
if (open < 0 || end.indexOf("}", open) !== end.length - 1)
|
|
15059
|
+
return line;
|
|
15060
|
+
const before = end[open - 1];
|
|
15061
|
+
if (before === "]" || before === ")")
|
|
15062
|
+
return line;
|
|
15063
|
+
const inner = end.slice(open + 1, -1);
|
|
15064
|
+
if (!BRACED_PLACEHOLDER_RE.test(inner))
|
|
15065
|
+
return line;
|
|
15066
|
+
return end.slice(0, open) + stash({ raw: expand(end.slice(open)), form: "literal" }) + line.slice(end.length);
|
|
15067
|
+
}).join("\n");
|
|
15068
|
+
}
|
|
15069
|
+
function holdsLiteral(text3, table) {
|
|
15070
|
+
if (!text3.includes(OPEN2))
|
|
15071
|
+
return false;
|
|
15072
|
+
for (const m of text3.matchAll(PLACEHOLDER_RE_G))
|
|
15073
|
+
if (table[Number(m[1])]?.form === "literal")
|
|
15074
|
+
return true;
|
|
15075
|
+
return false;
|
|
15076
|
+
}
|
|
15077
|
+
function closeBracesAroundCalls(source, table, stash) {
|
|
15078
|
+
if (!source.includes(OPEN2))
|
|
15079
|
+
return source;
|
|
15080
|
+
return source.split("\n").map((line) => {
|
|
15081
|
+
if (!line.includes("}") || !holdsLiteral(line, table))
|
|
15082
|
+
return line;
|
|
15083
|
+
let out = "";
|
|
15084
|
+
const opens = [];
|
|
15085
|
+
let calls = 0;
|
|
15086
|
+
let i = 0;
|
|
15087
|
+
while (i < line.length) {
|
|
15088
|
+
const ch = line[i];
|
|
15089
|
+
if (ch === OPEN2) {
|
|
15090
|
+
const end = line.indexOf(CLOSE2, i);
|
|
15091
|
+
if (end > 0) {
|
|
15092
|
+
if (table[Number(line.slice(i + 1, end))]?.form === "literal")
|
|
15093
|
+
calls++;
|
|
15094
|
+
out += line.slice(i, end + 1);
|
|
15095
|
+
i = end + 1;
|
|
15096
|
+
continue;
|
|
15097
|
+
}
|
|
15098
|
+
} else if (ch === "`") {
|
|
15099
|
+
let run = 1;
|
|
15100
|
+
while (line[i + run] === "`")
|
|
15101
|
+
run++;
|
|
15102
|
+
const ticks = "`".repeat(run);
|
|
15103
|
+
const close = line.indexOf(ticks, i + run);
|
|
15104
|
+
const stop = close < 0 ? i + run : close + run;
|
|
15105
|
+
out += line.slice(i, stop);
|
|
15106
|
+
i = stop;
|
|
15107
|
+
continue;
|
|
15108
|
+
} else if (ch === "{") {
|
|
15109
|
+
opens.push(calls);
|
|
15110
|
+
} else if (ch === "}") {
|
|
15111
|
+
const seen = opens.pop() ?? 0;
|
|
15112
|
+
if (seen < calls) {
|
|
15113
|
+
out += stash({ raw: "}", form: "literal" });
|
|
15114
|
+
i++;
|
|
15115
|
+
continue;
|
|
15116
|
+
}
|
|
15117
|
+
}
|
|
15118
|
+
out += ch;
|
|
15119
|
+
i++;
|
|
15120
|
+
}
|
|
15121
|
+
return out;
|
|
15122
|
+
}).join("\n");
|
|
15123
|
+
}
|
|
15124
|
+
var DIRECTIVE_LINE_RE = /^(?:[ \t]*(?:>|[-*+]|\d{1,9}[.)]))*[ \t]*:{2,}[A-Za-z]/;
|
|
15125
|
+
var BRACED_TAG_RE = /\{\uE000(\d+)\uE001\}/g;
|
|
15126
|
+
var BRACED_PLACEHOLDER_RE = /^[ \t]*(?:[A-Za-z0-9_-]{1,64}[ \t]+){0,8}\uE000\d+\uE001[^{}"'=]*$/;
|
|
15025
15127
|
function protectDirectives(source, options = {}) {
|
|
15026
15128
|
const table = [];
|
|
15027
15129
|
const stash = (span) => {
|
|
@@ -15029,7 +15131,9 @@ function protectDirectives(source, options = {}) {
|
|
|
15029
15131
|
return `${OPEN2}${table.length - 1}${CLOSE2}`;
|
|
15030
15132
|
};
|
|
15031
15133
|
const withRawStashed = options.stashRaw === false ? source : stashRawRegions(source, stash);
|
|
15032
|
-
let out = transformProseSegments(withRawStashed, (prose) => prose.replace(commentRe(), (m) => stash({ raw: m, form: "comment" })).replace(directiveTagRe(), (m, keyword, rest) => stash({ raw: m, form: "tag", keyword, rest })).replace(variableRe(), (m, inner) => stash({ raw: m, form: "variable", rest: inner })));
|
|
15134
|
+
let out = transformProseSegments(withRawStashed, (prose) => prose.replace(hugoPercentCallRe(), (m) => stash({ raw: m, form: "literal" })).replace(commentRe(), (m) => stash({ raw: m, form: "comment" })).replace(directiveTagRe(), (m, keyword, rest) => holdsLiteral(m, table) ? m : stash({ raw: m, form: "tag", keyword, rest })).replace(variableRe(), (m, inner) => holdsLiteral(m, table) ? m : stash({ raw: m, form: "variable", rest: inner })));
|
|
15135
|
+
out = closeBracesAroundCalls(out, table, stash);
|
|
15136
|
+
out = keepBracedPlaceholders(out, table, stash);
|
|
15033
15137
|
const lines = out.split("\n");
|
|
15034
15138
|
const inputLine = [];
|
|
15035
15139
|
const inputEnd = [];
|
|
@@ -15048,7 +15152,7 @@ function protectDirectives(source, options = {}) {
|
|
|
15048
15152
|
const line = lines[i];
|
|
15049
15153
|
const only = line.match(/^\s*\uE000(\d+)\uE001\s*$/);
|
|
15050
15154
|
const entry = only ? table[Number(only[1])] : void 0;
|
|
15051
|
-
const isBlockish = entry !== void 0 && entry.form !== "variable" && ((options.isolate ?? "all") === "all" || entry.keyword === "include");
|
|
15155
|
+
const isBlockish = entry !== void 0 && entry.form !== "variable" && entry.form !== "literal" && ((options.isolate ?? "all") === "all" || entry.keyword === "include");
|
|
15052
15156
|
if (isBlockish && isolated.length && isolated[isolated.length - 1].trim() !== "") {
|
|
15053
15157
|
isolated.push("");
|
|
15054
15158
|
lineMap.push(inputLine[i]);
|
|
@@ -15095,7 +15199,7 @@ function directiveLineIndex(node, table) {
|
|
|
15095
15199
|
return null;
|
|
15096
15200
|
const index = Number(m[1]);
|
|
15097
15201
|
const entry = table[index];
|
|
15098
|
-
if (!entry || entry.form === "variable")
|
|
15202
|
+
if (!entry || entry.form === "variable" || entry.form === "literal")
|
|
15099
15203
|
return null;
|
|
15100
15204
|
return index;
|
|
15101
15205
|
}
|
|
@@ -15216,7 +15320,7 @@ function restoreInline(inline, table, nodesFor = "all") {
|
|
|
15216
15320
|
continue;
|
|
15217
15321
|
}
|
|
15218
15322
|
const { entry, flags } = item;
|
|
15219
|
-
if (nodesFor === "include") {
|
|
15323
|
+
if (nodesFor === "include" || entry.form === "literal") {
|
|
15220
15324
|
target().push(textSpan(entry.raw, flags));
|
|
15221
15325
|
continue;
|
|
15222
15326
|
}
|
|
@@ -15606,7 +15710,8 @@ function collectDiagnostics(tokens, lines, lineOf2, sourceLine) {
|
|
|
15606
15710
|
const at = childLines(tok.children);
|
|
15607
15711
|
for (const [k, child] of tok.children.entries()) {
|
|
15608
15712
|
const what = ATTRLESS_INLINE[child.type];
|
|
15609
|
-
|
|
15713
|
+
const optIns = child.type === "code_inline" && child.attrs?.every(([key]) => key === "choices" || key === "minja");
|
|
15714
|
+
if (what && child.attrs?.length && !optIns)
|
|
15610
15715
|
add(tok.map[0] + at[k], "dropped-attributes", `the attribute block on ${what} is dropped \u2014 only links, images and inline directives take attributes`, void 0, /(?<=[*_`~])\{[^{}]*\}/);
|
|
15611
15716
|
}
|
|
15612
15717
|
for (const [k, child] of tok.children.entries()) {
|
|
@@ -16684,15 +16789,18 @@ function consumeDeflist(ctx) {
|
|
|
16684
16789
|
}
|
|
16685
16790
|
if (tok.type === "dt_open") {
|
|
16686
16791
|
const dtLine = tok.map && ctx.lineOf ? ctx.lineOf(tok.map[0]) : void 0;
|
|
16792
|
+
const termId = tok.attrs?.find(([k]) => k === "id")?.[1];
|
|
16687
16793
|
ctx.i++;
|
|
16688
16794
|
const inlineTok = ctx.tokens[ctx.i];
|
|
16689
|
-
|
|
16795
|
+
let inline = inlineTok?.children ? tokensToInline(inlineTok.children) : [];
|
|
16796
|
+
if (termId)
|
|
16797
|
+
inline = inline.filter((n, k) => !(n.type === "text" && n.text === "" && (k === inline.length - 1 || k === 0)));
|
|
16690
16798
|
ctx.i++;
|
|
16691
16799
|
while (ctx.i < ctx.tokens.length && ctx.tokens[ctx.i].type !== "dt_close")
|
|
16692
16800
|
ctx.i++;
|
|
16693
16801
|
if (ctx.i < ctx.tokens.length)
|
|
16694
16802
|
ctx.i++;
|
|
16695
|
-
const dt = { type: "dt", inline };
|
|
16803
|
+
const dt = { type: "dt", inline, ...termId ? { props: { id: termId } } : {} };
|
|
16696
16804
|
if (dtLine !== void 0)
|
|
16697
16805
|
termLines.set(dt, { line: dtLine, endLine: dtLine });
|
|
16698
16806
|
children.push(dt);
|
|
@@ -17075,11 +17183,11 @@ function untask(item) {
|
|
|
17075
17183
|
function stepsFromChildren(props, children) {
|
|
17076
17184
|
if (children.length === 1 && children[0].type === "ordered-list") {
|
|
17077
17185
|
const list2 = children[0];
|
|
17078
|
-
const
|
|
17186
|
+
const steps = [];
|
|
17079
17187
|
for (const raw of list2.children ?? []) {
|
|
17080
17188
|
const item = untask(raw);
|
|
17081
17189
|
if (item.type === "list-item") {
|
|
17082
|
-
|
|
17190
|
+
steps.push({
|
|
17083
17191
|
type: "step",
|
|
17084
17192
|
inline: item.inline,
|
|
17085
17193
|
children: item.children,
|
|
@@ -17087,11 +17195,21 @@ function stepsFromChildren(props, children) {
|
|
|
17087
17195
|
});
|
|
17088
17196
|
}
|
|
17089
17197
|
}
|
|
17090
|
-
return { type: "steps", props, children:
|
|
17198
|
+
return { type: "steps", props, children: steps, ...list2.meta?.loose ? { meta: { loose: true } } : {} };
|
|
17091
17199
|
}
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17200
|
+
if (children.some((c) => c.type === "step")) {
|
|
17201
|
+
const kept = [];
|
|
17202
|
+
let current;
|
|
17203
|
+
for (const c of children) {
|
|
17204
|
+
if (c.type === "step") {
|
|
17205
|
+
current = c;
|
|
17206
|
+
kept.push(c);
|
|
17207
|
+
} else if (current)
|
|
17208
|
+
(current.children ??= []).push(c);
|
|
17209
|
+
else
|
|
17210
|
+
kept.push(c);
|
|
17211
|
+
}
|
|
17212
|
+
return { type: "steps", props, children: kept };
|
|
17095
17213
|
}
|
|
17096
17214
|
return { type: "steps", props, children };
|
|
17097
17215
|
}
|
|
@@ -17796,7 +17914,8 @@ function inlineMarkdown(nodes, blockEnd) {
|
|
|
17796
17914
|
flush();
|
|
17797
17915
|
lastWasOpen = false;
|
|
17798
17916
|
}
|
|
17799
|
-
const
|
|
17917
|
+
const after = nodes[index + 1];
|
|
17918
|
+
const rendered = node.type === "math" && after?.type === "text" && /^[0-9]/.test(after.text) ? `:math[${node.latex.replace(/[\\[\]]/g, "\\$&")}]` : renderInline(node);
|
|
17800
17919
|
out.push(rendered);
|
|
17801
17920
|
if (rendered.length > 0)
|
|
17802
17921
|
lastWasOpen = false;
|
|
@@ -18334,6 +18453,7 @@ function inertDogsbaySyntax(md) {
|
|
|
18334
18453
|
return out.split("\n").map((line, i) => code.has(i) ? line : mapOutsideCodeSpans(line, (p) => p.replace(/:(?=:)|(?<=:):|(?<![\p{L}\p{N}:]):(?=[A-Za-z])/gu, ":"))).join("\n");
|
|
18335
18454
|
}
|
|
18336
18455
|
var CODE_LINES_PARSER = new lib_default();
|
|
18456
|
+
var LITERAL_LINES_PARSER = new lib_default({ html: true });
|
|
18337
18457
|
var ENDPOINT_FIELD_DEPTH = 8;
|
|
18338
18458
|
var ENDPOINT_FIELD_LINES = 400;
|
|
18339
18459
|
var ENDPOINT_EXAMPLE_CHARS = 8e3;
|
|
@@ -18586,7 +18706,12 @@ function renderCode(node) {
|
|
|
18586
18706
|
"minja",
|
|
18587
18707
|
// `{choices}` — the fence holds `:choice-value[]{…}` the reader's choice fills in
|
|
18588
18708
|
// (plans/reader-choices.md); boolean like `{minja}`
|
|
18589
|
-
"choices"
|
|
18709
|
+
"choices",
|
|
18710
|
+
// `{image alt}` on a diagram fence (```mermaid): the image of it the source site showed, and
|
|
18711
|
+
// that image's alt text. A build that draws the diagram ignores them; a host may show the
|
|
18712
|
+
// image instead (format-html's diagram option, agreed with dogsbay-research 2026-12-04)
|
|
18713
|
+
"image",
|
|
18714
|
+
"alt"
|
|
18590
18715
|
];
|
|
18591
18716
|
const attrParts = [];
|
|
18592
18717
|
if (node.props?.id)
|
|
@@ -18604,7 +18729,7 @@ function renderCode(node) {
|
|
|
18604
18729
|
attrParts.push(key);
|
|
18605
18730
|
continue;
|
|
18606
18731
|
}
|
|
18607
|
-
const s = String(v).replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "");
|
|
18732
|
+
const s = String(v).replace(/[\r\n]+/g, " ").replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "");
|
|
18608
18733
|
attrParts.push(`${key}="${s}"`);
|
|
18609
18734
|
}
|
|
18610
18735
|
let infoLine = lang;
|
|
@@ -18682,6 +18807,15 @@ function holdsHtml(node) {
|
|
|
18682
18807
|
}
|
|
18683
18808
|
var TIGHT_NEXT = /* @__PURE__ */ new Set(["unordered-list", "ordered-list", "code", "blockquote", "heading", "callout", "table", "math-block"]);
|
|
18684
18809
|
var OPEN_ENDED = /* @__PURE__ */ new Set(["table", "paragraph", "html", "prose"]);
|
|
18810
|
+
function needsBlankLine(item) {
|
|
18811
|
+
const types = [...item.inline?.length ? ["paragraph"] : [], ...(item.children ?? []).map((c) => c.type)];
|
|
18812
|
+
const inline = !!item.inline?.length;
|
|
18813
|
+
for (let i = 1; i < types.length; i++) {
|
|
18814
|
+
if (!(TIGHT_NEXT.has(types[i]) && (i === 1 && inline ? true : !OPEN_ENDED.has(types[i - 1]))))
|
|
18815
|
+
return true;
|
|
18816
|
+
}
|
|
18817
|
+
return false;
|
|
18818
|
+
}
|
|
18685
18819
|
function renderListItem(node, ctx, loose = true) {
|
|
18686
18820
|
const box = typeof node.props?.checked === "boolean" ? node.props.checked ? "[x] " : "[ ] " : "";
|
|
18687
18821
|
const text3 = inlineToDogsbayMd(node.inline);
|
|
@@ -18707,6 +18841,24 @@ function renderInlineOrChildren(node, ctx) {
|
|
|
18707
18841
|
const children = (node.children ?? []).map((c) => renderNode2(c, ctx)).join("\n\n");
|
|
18708
18842
|
return [inline, children].filter(Boolean).join("\n\n");
|
|
18709
18843
|
}
|
|
18844
|
+
var READ_AS_CALLOUT = /* @__PURE__ */ new Set([
|
|
18845
|
+
"note",
|
|
18846
|
+
"tip",
|
|
18847
|
+
"info",
|
|
18848
|
+
"important",
|
|
18849
|
+
"warning",
|
|
18850
|
+
"caution",
|
|
18851
|
+
"danger",
|
|
18852
|
+
"success",
|
|
18853
|
+
"hint",
|
|
18854
|
+
"attention",
|
|
18855
|
+
"error",
|
|
18856
|
+
"failure",
|
|
18857
|
+
"bug",
|
|
18858
|
+
"question",
|
|
18859
|
+
"abstract",
|
|
18860
|
+
"quote"
|
|
18861
|
+
]);
|
|
18710
18862
|
var GITHUB_CALLOUT_TYPES = /* @__PURE__ */ new Set([
|
|
18711
18863
|
"note",
|
|
18712
18864
|
"tip",
|
|
@@ -18715,6 +18867,11 @@ var GITHUB_CALLOUT_TYPES = /* @__PURE__ */ new Set([
|
|
|
18715
18867
|
"caution"
|
|
18716
18868
|
]);
|
|
18717
18869
|
function renderCallout(node, ctx) {
|
|
18870
|
+
const variant = node.props?.variant;
|
|
18871
|
+
if (node.props?.type === void 0 && typeof variant === "string" && READ_AS_CALLOUT.has(variant.toLowerCase())) {
|
|
18872
|
+
const { variant: _v, ...rest } = node.props ?? {};
|
|
18873
|
+
node = { ...node, props: { type: variant.toLowerCase(), ...rest } };
|
|
18874
|
+
}
|
|
18718
18875
|
const type = String(node.props?.type ?? "note").toLowerCase();
|
|
18719
18876
|
const body = (node.children ?? []).map((c) => renderNode2(c, ctx)).join("\n\n");
|
|
18720
18877
|
const props = node.props ?? {};
|
|
@@ -19047,7 +19204,7 @@ function renderTabs(node, ctx) {
|
|
|
19047
19204
|
const body2 = children.map((c) => renderNode2(c, ctx)).join("\n\n");
|
|
19048
19205
|
return renderBlockDirective({ name: "tabs", props: node.props, body: body2 }, ctx);
|
|
19049
19206
|
}
|
|
19050
|
-
if (tabs.some(isEmptyItem) || tabs.some((tab) => startsWithInclude(tab, ctx))) {
|
|
19207
|
+
if (tabs.some(isEmptyItem) || tabs.some((tab) => startsWithInclude(tab, ctx)) || tabs.some((tab) => typeof tab.props?.id === "string" && tab.props.id !== "")) {
|
|
19051
19208
|
const body2 = tabs.map((tab) => renderBlockDirective({ name: "tab", props: tab.props, body: (tab.children ?? []).map((c) => renderNode2(c, ctx)).join("\n\n") }, ctx)).join("\n\n");
|
|
19052
19209
|
return renderBlockDirective({ name: "tabs", props: node.props, body: body2 }, ctx);
|
|
19053
19210
|
}
|
|
@@ -19056,7 +19213,7 @@ function renderTabs(node, ctx) {
|
|
|
19056
19213
|
return renderBlockDirective({ name: "tabs", props: node.props, body }, ctx);
|
|
19057
19214
|
}
|
|
19058
19215
|
function termLabel(text3) {
|
|
19059
|
-
return inlineToDogsbayMd([{ type: "text", text: text3 }], { blockEnd: false }).replace(/^(\s*)([-+*>#]|\d+[.)])(?=\s|$)/, (_, ws, m) => `${ws}${m.replace(/[-+*>#.)]/, (c) => `\\${c}`)}`).replace(/\{/g, "\\{");
|
|
19216
|
+
return inlineToDogsbayMd([{ type: "text", text: text3 }], { blockEnd: false }).replace(/^(\s*)([-+*>#]|\d+[.)])(?=\s|$)/, (_, ws, m) => `${ws}${m.replace(/[-+*>#.)]/, (c) => `\\${c}`)}`).replace(/^(\s*)(?=::|-{3}|~{3}|`{3}|\*{3}|_{3}|={3})/, "$1\\").replace(/\{/g, "\\{");
|
|
19060
19217
|
}
|
|
19061
19218
|
function startsWithInclude(node, ctx) {
|
|
19062
19219
|
const first = node.children?.[0];
|
|
@@ -19077,7 +19234,26 @@ function renderTabItem(node, ctx) {
|
|
|
19077
19234
|
: ${first}${restLines ? "\n" + restLines : ""}`;
|
|
19078
19235
|
}
|
|
19079
19236
|
function renderSteps(node, ctx) {
|
|
19080
|
-
const
|
|
19237
|
+
const all = node.children ?? [];
|
|
19238
|
+
const stepCount = all.filter((c) => c.type === "step").length;
|
|
19239
|
+
if (stepCount > 0 && stepCount < all.length) {
|
|
19240
|
+
const lead = [];
|
|
19241
|
+
const steps = [];
|
|
19242
|
+
for (const c of all) {
|
|
19243
|
+
if (c.type === "step")
|
|
19244
|
+
steps.push({ ...c, children: [...c.children ?? []] });
|
|
19245
|
+
else if (steps.length)
|
|
19246
|
+
steps[steps.length - 1].children.push(c);
|
|
19247
|
+
else
|
|
19248
|
+
lead.push(c);
|
|
19249
|
+
}
|
|
19250
|
+
return [...lead.map((c) => renderNode2(c, ctx)), renderSteps({ ...node, children: steps }, ctx)].filter(Boolean).join("\n\n");
|
|
19251
|
+
}
|
|
19252
|
+
if (stepCount === 0 && all.length > 0 && !all.every((c) => c.type === "list-item")) {
|
|
19253
|
+
const body2 = all.map((c) => renderNode2(c, ctx)).filter(Boolean).join("\n\n");
|
|
19254
|
+
return renderBlockDirective({ name: "steps", props: node.props, body: body2 }, ctx);
|
|
19255
|
+
}
|
|
19256
|
+
const children = all;
|
|
19081
19257
|
const stepChildren = children.filter((c) => c.type === "step");
|
|
19082
19258
|
if (stepChildren.length > 0 && stepChildren.length === children.length && stepChildren.some((st) => typeof st.props?.title === "string" && st.props.title.trim())) {
|
|
19083
19259
|
const body2 = stepChildren.map((st) => {
|
|
@@ -19090,7 +19266,10 @@ function renderSteps(node, ctx) {
|
|
|
19090
19266
|
if (stepChildren.length > 0) {
|
|
19091
19267
|
list2 = {
|
|
19092
19268
|
type: "ordered-list",
|
|
19093
|
-
|
|
19269
|
+
// loose as written, or when a step's blocks need a blank line between them even in a tight
|
|
19270
|
+
// list (renderListItem): CommonMark then reads the list as loose, so a tight first write
|
|
19271
|
+
// changed on the next one (review; importers build steps with no meta)
|
|
19272
|
+
...node.meta?.loose === true || stepChildren.some(needsBlankLine) ? { meta: { loose: true } } : {},
|
|
19094
19273
|
children: stepChildren.map((step) => ({
|
|
19095
19274
|
type: "list-item",
|
|
19096
19275
|
inline: step.inline,
|
|
@@ -19200,10 +19379,22 @@ function renderDeflist(node, ctx) {
|
|
|
19200
19379
|
const parts = [];
|
|
19201
19380
|
let currentTerm = null;
|
|
19202
19381
|
let termOpen = false;
|
|
19382
|
+
let termId;
|
|
19383
|
+
const withId = (term) => {
|
|
19384
|
+
const attrs = !termId || /["\\{}\r\n]/.test(termId) ? "" : /^[\w-]+$/.test(termId) ? renderAttrs({ id: termId }) : renderAttrs({ props: { id: termId } });
|
|
19385
|
+
return attrs ? `${term} ${attrs}` : term;
|
|
19386
|
+
};
|
|
19203
19387
|
for (const child of children) {
|
|
19204
19388
|
if (child.type === "dt") {
|
|
19205
19389
|
const term = inlineToDogsbayMd(child.inline) || (child.html ?? "");
|
|
19206
|
-
|
|
19390
|
+
const id = typeof child.props?.id === "string" && child.props.id ? child.props.id : void 0;
|
|
19391
|
+
if (currentTerm !== null && !termOpen) {
|
|
19392
|
+
currentTerm = `${currentTerm}<br>${term}`;
|
|
19393
|
+
termId ??= id;
|
|
19394
|
+
} else {
|
|
19395
|
+
currentTerm = term;
|
|
19396
|
+
termId = id;
|
|
19397
|
+
}
|
|
19207
19398
|
termOpen = false;
|
|
19208
19399
|
} else if (child.type === "dd" && currentTerm !== null) {
|
|
19209
19400
|
const dd = joinCodeBreaks(child);
|
|
@@ -19218,7 +19409,7 @@ function renderDeflist(node, ctx) {
|
|
|
19218
19409
|
parts[parts.length - 1] += `
|
|
19219
19410
|
${definition}`;
|
|
19220
19411
|
else {
|
|
19221
|
-
parts.push(`${currentTerm}
|
|
19412
|
+
parts.push(`${withId(currentTerm)}
|
|
19222
19413
|
${definition}`);
|
|
19223
19414
|
termOpen = true;
|
|
19224
19415
|
}
|
|
@@ -24066,6 +24257,7 @@ export {
|
|
|
24066
24257
|
offsetIncludeMaps,
|
|
24067
24258
|
RESERVED_ID,
|
|
24068
24259
|
pageId,
|
|
24260
|
+
followRenamedId,
|
|
24069
24261
|
stepTitle,
|
|
24070
24262
|
stepLead,
|
|
24071
24263
|
isSafeHref,
|