@dogsbay/format-mkdocs 0.2.0-beta.103 → 0.2.0-beta.109
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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +108 -3
- package/dist/cli.js.map +1 -1
- package/dist/export/to-mkdocs-project.d.ts +3 -0
- package/dist/export/to-mkdocs-project.d.ts.map +1 -1
- package/dist/export/to-mkdocs-project.js +198 -66
- package/dist/export/to-mkdocs-project.js.map +1 -1
- package/dist/export/to-mkdocs.d.ts +53 -3
- package/dist/export/to-mkdocs.d.ts.map +1 -1
- package/dist/export/to-mkdocs.js +842 -100
- package/dist/export/to-mkdocs.js.map +1 -1
- package/package.json +6 -4
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAqC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAqC,MAAM,gBAAgB,CAAC;AAKtF,eAAO,MAAM,MAAM,EAAE,YA6GpB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
1
|
+
import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, writeFileSync, copyFileSync } from "node:fs";
|
|
2
|
+
import { dirname, extname, join } from "node:path";
|
|
3
3
|
import { importMkdocsProject } from "./importer.js";
|
|
4
|
+
import { exportMkdocsProject } from "./export/to-mkdocs-project.js";
|
|
5
|
+
import { formatLedgerReport } from "@dogsbay/serialize-core";
|
|
4
6
|
export const plugin = {
|
|
5
7
|
name: "mkdocs",
|
|
6
8
|
canImport: true,
|
|
@@ -12,7 +14,15 @@ export const plugin = {
|
|
|
12
14
|
{ flags: "--custom-css <files>", description: "Custom CSS files to copy (comma-separated)" },
|
|
13
15
|
{ flags: "--docusaurus-admonitions", description: "Enable Docusaurus-style ::: admonitions" },
|
|
14
16
|
],
|
|
15
|
-
|
|
17
|
+
// NOT `--theme`: `dogsbay convert` already owns that flag for the Astro
|
|
18
|
+
// preset, with a default of "default" — which reached this exporter as
|
|
19
|
+
// `theme: name: default`, a theme MkDocs does not have, and every
|
|
20
|
+
// `convert --to mkdocs` project failed its first `mkdocs build`.
|
|
21
|
+
exportOptions: [
|
|
22
|
+
{ flags: "--mkdocs-theme <name>", description: "MkDocs theme for the emitted mkdocs.yml (material | mkdocs | readthedocs)", default: "material" },
|
|
23
|
+
{ flags: "--site-url <url>", description: "site_url for the emitted mkdocs.yml" },
|
|
24
|
+
{ flags: "--repo-url <url>", description: "repo_url for the emitted mkdocs.yml" },
|
|
25
|
+
],
|
|
16
26
|
async import(source, opts) {
|
|
17
27
|
const { pages, nav, config } = await importMkdocsProject(source, opts);
|
|
18
28
|
// Attach config metadata for the exporter to consume
|
|
@@ -30,5 +40,100 @@ export const plugin = {
|
|
|
30
40
|
// `{% include %}` in a page means a file under THERE.
|
|
31
41
|
return { pages, nav, contentRoot: join(source, config.docsDir) };
|
|
32
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* Export: TreeNode pages + nav → a complete MkDocs project.
|
|
45
|
+
*
|
|
46
|
+
* `exportMkdocsProject` is I/O-free and returns a path → content map, so
|
|
47
|
+
* everything this method does is create directories and write bytes. It was
|
|
48
|
+
* written and unit-tested long before it was reachable: `cli.ts` declared
|
|
49
|
+
* `canExport: true` with no `export` method, and `resolveExporter()` filters
|
|
50
|
+
* on `canExport && f.export`, so `--to mkdocs` reported an unknown target
|
|
51
|
+
* while the serializer sat in the same package. That predicate exists
|
|
52
|
+
* BECAUSE of this plugin.
|
|
53
|
+
*/
|
|
54
|
+
async export(pages, nav, output, opts) {
|
|
55
|
+
const result = exportMkdocsProject(pages, nav, {
|
|
56
|
+
siteName: opts.siteName ?? "Documentation",
|
|
57
|
+
siteUrl: opts.siteUrl,
|
|
58
|
+
repoUrl: opts.repoUrl,
|
|
59
|
+
theme: mkdocsTheme(opts),
|
|
60
|
+
});
|
|
61
|
+
for (const [filePath, content] of result.files) {
|
|
62
|
+
const fullPath = join(output, filePath);
|
|
63
|
+
mkdirSync(dirname(fullPath), { recursive: true });
|
|
64
|
+
writeFileSync(fullPath, content);
|
|
65
|
+
}
|
|
66
|
+
console.log(`Generated ${result.files.size} MkDocs files`);
|
|
67
|
+
// Mounted asset dirs, copied under docs/ at the ROOT their refs were
|
|
68
|
+
// rewritten to (`_assets` for an imported corpus, `images`/`assets` for
|
|
69
|
+
// hand-authored content). The serializer emits those refs relative to
|
|
70
|
+
// each page, so the file has to land exactly there or every image 404s
|
|
71
|
+
// with a clean exit code.
|
|
72
|
+
const mounts = opts.assetMounts;
|
|
73
|
+
for (const mount of mounts ?? []) {
|
|
74
|
+
if (!existsSync(mount.dir))
|
|
75
|
+
continue;
|
|
76
|
+
const root = mount.root ?? "_assets";
|
|
77
|
+
const dest = mount.into ? join(output, "docs", root, mount.into) : join(output, "docs", root);
|
|
78
|
+
mkdirSync(dest, { recursive: true });
|
|
79
|
+
if (mount.mediaOnly) {
|
|
80
|
+
copyMediaTree(mount.dir, dest);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// Skip symlinks rather than copy them: relative links are rewritten to
|
|
84
|
+
// ABSOLUTE paths into the source checkout, so the output only works on
|
|
85
|
+
// the machine that produced it. AsciiBinder corpora are full of them.
|
|
86
|
+
cpSync(mount.dir, dest, {
|
|
87
|
+
recursive: true,
|
|
88
|
+
dereference: false,
|
|
89
|
+
filter: (src) => !lstatSync(src).isSymbolicLink(),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Co-located media next to the markdown (the mkdocs shape itself).
|
|
93
|
+
const sourceDir = opts.sourceDir;
|
|
94
|
+
if (sourceDir && existsSync(sourceDir))
|
|
95
|
+
copyMediaTree(sourceDir, join(output, "docs"));
|
|
96
|
+
if (!result.ledger.isEmpty) {
|
|
97
|
+
console.log(formatLedgerReport(result.ledger, "mkdocs"));
|
|
98
|
+
}
|
|
99
|
+
},
|
|
33
100
|
};
|
|
101
|
+
const MEDIA_EXT = new Set([".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".avif", ".mp4", ".webm", ".pdf", ".ico"]);
|
|
102
|
+
/**
|
|
103
|
+
* Copy media files only, preserving the directory shape. Never follows a
|
|
104
|
+
* symlink: AsciiBinder corpora symlink every section back to one images
|
|
105
|
+
* tree, and following them copied a 64 MB tree once per link.
|
|
106
|
+
*/
|
|
107
|
+
function copyMediaTree(from, to) {
|
|
108
|
+
for (const entry of readdirSync(from, { withFileTypes: true })) {
|
|
109
|
+
if (entry.isSymbolicLink())
|
|
110
|
+
continue;
|
|
111
|
+
const src = join(from, entry.name);
|
|
112
|
+
if (entry.isDirectory()) {
|
|
113
|
+
if (entry.name === "node_modules" || entry.name.startsWith("."))
|
|
114
|
+
continue;
|
|
115
|
+
copyMediaTree(src, join(to, entry.name));
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (!MEDIA_EXT.has(extname(entry.name).toLowerCase()))
|
|
119
|
+
continue;
|
|
120
|
+
// Always copy. A same-size skip saved nothing measurable and silently
|
|
121
|
+
// kept a stale file when a one-character SVG edit left the size unchanged.
|
|
122
|
+
mkdirSync(to, { recursive: true });
|
|
123
|
+
copyFileSync(src, join(to, entry.name));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const MKDOCS_THEMES = new Set(["material", "mkdocs", "readthedocs"]);
|
|
127
|
+
/**
|
|
128
|
+
* The MkDocs theme to write. `--mkdocs-theme` wins; a bare `theme` is honoured
|
|
129
|
+
* only when it names a theme MkDocs actually has, so the Astro preset default
|
|
130
|
+
* ("default") that `convert` passes through can never reach mkdocs.yml.
|
|
131
|
+
*/
|
|
132
|
+
function mkdocsTheme(opts) {
|
|
133
|
+
for (const candidate of [opts.mkdocsTheme, opts.theme]) {
|
|
134
|
+
if (typeof candidate === "string" && MKDOCS_THEMES.has(candidate))
|
|
135
|
+
return candidate;
|
|
136
|
+
}
|
|
137
|
+
return "material";
|
|
138
|
+
}
|
|
34
139
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACpE,aAAa,EAAE;QACb,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,kCAAkC,EAAE,OAAO,EAAE,SAAS,EAAE;QAChG,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gDAAgD,EAAE;QAC3F,EAAE,KAAK,EAAE,s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}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExportPage, NavItem } from "@dogsbay/types";
|
|
2
|
+
import { ExportLedger } from "@dogsbay/serialize-core";
|
|
2
3
|
/**
|
|
3
4
|
* Options for project export.
|
|
4
5
|
*/
|
|
@@ -18,6 +19,8 @@ export interface MkdocsProjectOptions {
|
|
|
18
19
|
export interface MkdocsProjectExport {
|
|
19
20
|
files: Map<string, string>;
|
|
20
21
|
mkdocsYml: string;
|
|
22
|
+
/** What could not be represented, per page. Empty is the goal, not the assumption. */
|
|
23
|
+
ledger: ExportLedger;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* Export a set of pages + navigation to a complete MkDocs project.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-mkdocs-project.d.ts","sourceRoot":"","sources":["../../src/export/to-mkdocs-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"to-mkdocs-project.d.ts","sourceRoot":"","sources":["../../src/export/to-mkdocs-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAgC,MAAM,yBAAyB,CAAC;AAGrF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EAAE,EACnB,GAAG,EAAE,OAAO,EAAE,EACd,OAAO,EAAE,oBAAoB,GAC5B,mBAAmB,CA6CrB"}
|
|
@@ -1,26 +1,95 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExportLedger, frontmatterBlock, yamlScalar } from "@dogsbay/serialize-core";
|
|
2
|
+
import { treeToMkdocs, hrefToSlugKey } from "./to-mkdocs.js";
|
|
2
3
|
/**
|
|
3
4
|
* Export a set of pages + navigation to a complete MkDocs project.
|
|
4
5
|
* Returns file map (path → content) including mkdocs.yml and all .md files.
|
|
5
6
|
*/
|
|
6
7
|
export function exportMkdocsProject(pages, nav, options) {
|
|
7
8
|
const files = new Map();
|
|
9
|
+
const ledger = new ExportLedger();
|
|
10
|
+
const slugs = new Set(pages.map((p) => p.slug));
|
|
8
11
|
// Generate markdown files
|
|
9
12
|
const allTrees = [];
|
|
10
13
|
for (const page of pages) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
ledger.setPage(page.slug);
|
|
15
|
+
// A slug is a path under docs/. One that climbs out of it (`../x`),
|
|
16
|
+
// starts at the root, or carries a backslash is not a page name, it is a
|
|
17
|
+
// write outside the output tree. Refuse it, on the record.
|
|
18
|
+
if (!isSafeSlug(page.slug)) {
|
|
19
|
+
ledger.record({ feature: "page", action: "dropped", detail: `unsafe slug ${JSON.stringify(page.slug)} — not written` });
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const path = `docs/${page.slug}.md`;
|
|
23
|
+
// Two pages on one slug (the importer strips `/index`, so `a.md` and
|
|
24
|
+
// `a/index.md` both arrive as `a`) used to overwrite silently — last one
|
|
25
|
+
// won, the ledger stayed empty, and the page count said 4 while 3 files
|
|
26
|
+
// existed. Keep the first, record the second.
|
|
27
|
+
if (files.has(path)) {
|
|
28
|
+
ledger.record({ feature: "page", action: "dropped", detail: `duplicate slug ${page.slug} — a second page with this slug was not written` });
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const body = treeToMkdocs(page.tree, { pageSlug: page.slug, slugs, ledger });
|
|
32
|
+
// MkDocs reads `title:` from page meta; without it the nav label falls back
|
|
33
|
+
// to the first heading (fine) or the filename (not fine).
|
|
34
|
+
const fm = pageFrontmatter(page, ledger);
|
|
35
|
+
files.set(path, fm ? `${fm}\n\n${body}\n` : `${body}\n`);
|
|
14
36
|
allTrees.push(page.tree);
|
|
15
37
|
}
|
|
38
|
+
ledger.setPage(undefined);
|
|
16
39
|
// Auto-detect required extensions from tree content
|
|
17
40
|
const extensions = detectExtensions(allTrees, options.extraExtensions);
|
|
18
41
|
// Convert nav to mkdocs.yml nav format
|
|
19
|
-
const navYaml = navToYaml(nav,
|
|
42
|
+
const navYaml = navToYaml(nav, slugs, ledger);
|
|
20
43
|
// Generate mkdocs.yml
|
|
21
44
|
const yml = buildMkdocsYml(options, extensions, navYaml);
|
|
22
45
|
files.set("mkdocs.yml", yml);
|
|
23
|
-
return { files, mkdocsYml: yml };
|
|
46
|
+
return { files, mkdocsYml: yml, ledger };
|
|
47
|
+
}
|
|
48
|
+
function isSafeSlug(slug) {
|
|
49
|
+
if (!slug || slug.startsWith("/") || slug.includes("\\"))
|
|
50
|
+
return false;
|
|
51
|
+
return !slug.split("/").some((seg) => seg === ".." || seg === "." || seg === "");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Frontmatter keys MkDocs Material reads from page meta. Anything else the
|
|
55
|
+
* source carried is recorded as dropped rather than silently discarded — a
|
|
56
|
+
* mkdocs → mkdocs round trip that loses `tags:` looks like success otherwise.
|
|
57
|
+
*/
|
|
58
|
+
const MATERIAL_META = new Set(["tags", "hide", "status", "template", "icon", "search", "subtitle"]);
|
|
59
|
+
function pageFrontmatter(page, ledger) {
|
|
60
|
+
const fm = (page.frontmatter ?? {});
|
|
61
|
+
const entries = [];
|
|
62
|
+
const rawTitle = fm.title ?? page.title;
|
|
63
|
+
const title = typeof rawTitle === "string" ? rawTitle : page.title;
|
|
64
|
+
if (title)
|
|
65
|
+
entries.push(["title", title]);
|
|
66
|
+
if (typeof fm.description === "string")
|
|
67
|
+
entries.push(["description", fm.description]);
|
|
68
|
+
const extra = [];
|
|
69
|
+
for (const [key, value] of Object.entries(fm)) {
|
|
70
|
+
if (key === "title" || key === "description")
|
|
71
|
+
continue;
|
|
72
|
+
if (MATERIAL_META.has(key)) {
|
|
73
|
+
if (Array.isArray(value) && value.every((v) => typeof v === "string" || typeof v === "number")) {
|
|
74
|
+
extra.push(`${key}:\n${value.map((v) => ` - ${yamlScalar(String(v))}`).join("\n")}`);
|
|
75
|
+
}
|
|
76
|
+
else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
77
|
+
extra.push(`${key}: ${typeof value === "string" ? yamlScalar(value) : String(value)}`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
ledger.record({ feature: `frontmatter:${key}`, action: "dropped", detail: "unsupported value shape" });
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
ledger.record({ feature: `frontmatter:${key}`, action: "dropped", detail: "no MkDocs equivalent" });
|
|
85
|
+
}
|
|
86
|
+
if (entries.length === 0 && extra.length === 0)
|
|
87
|
+
return "";
|
|
88
|
+
const base = entries.length ? frontmatterBlock(entries) : "";
|
|
89
|
+
if (!extra.length)
|
|
90
|
+
return base;
|
|
91
|
+
const inner = base ? base.replace(/\n---$/, "") : "---";
|
|
92
|
+
return `${inner}\n${extra.join("\n")}\n---`;
|
|
24
93
|
}
|
|
25
94
|
// ── Extension Detection ─────────────────────────────────────────
|
|
26
95
|
/**
|
|
@@ -29,8 +98,12 @@ export function exportMkdocsProject(pages, nav, options) {
|
|
|
29
98
|
*/
|
|
30
99
|
function detectExtensions(allTrees, extra) {
|
|
31
100
|
const found = new Set();
|
|
32
|
-
// Always
|
|
101
|
+
// Always-on. `attr_list` because every heading carries `{ #id }`; the rest
|
|
102
|
+
// are cheap and what the serializer emits assumes them.
|
|
33
103
|
found.add("toc:\n permalink: true");
|
|
104
|
+
found.add("attr_list");
|
|
105
|
+
found.add("md_in_html");
|
|
106
|
+
found.add("tables");
|
|
34
107
|
for (const tree of allTrees) {
|
|
35
108
|
walkForExtensions(tree, found);
|
|
36
109
|
}
|
|
@@ -53,40 +126,92 @@ function walkForExtensions(nodes, found) {
|
|
|
53
126
|
case "tabs":
|
|
54
127
|
case "tab":
|
|
55
128
|
found.add("pymdownx.tabbed:\n alternate_style: true");
|
|
129
|
+
found.add("pymdownx.superfences");
|
|
56
130
|
break;
|
|
57
|
-
case "code":
|
|
131
|
+
case "code":
|
|
58
132
|
found.add("pymdownx.highlight:\n anchor_linenums: true");
|
|
59
133
|
found.add("pymdownx.superfences");
|
|
60
|
-
if (node.props?.hasAnnotations) {
|
|
61
|
-
found.add("pymdownx.superfences");
|
|
62
|
-
}
|
|
63
134
|
break;
|
|
64
|
-
|
|
135
|
+
case "diagram":
|
|
136
|
+
found.add("pymdownx.superfences:\n custom_fences:\n - name: mermaid\n class: mermaid\n format: !!python/name:pymdownx.superfences.fence_code_format");
|
|
137
|
+
break;
|
|
65
138
|
case "deflist":
|
|
66
139
|
case "dt":
|
|
67
140
|
case "dd":
|
|
68
141
|
found.add("def_list");
|
|
69
142
|
break;
|
|
70
|
-
case "html-container":
|
|
71
|
-
found.add("md_in_html");
|
|
72
|
-
break;
|
|
73
143
|
case "task-list":
|
|
74
144
|
case "task-item":
|
|
75
145
|
found.add("pymdownx.tasklist:\n custom_checkbox: true");
|
|
76
146
|
break;
|
|
147
|
+
// Checkboxes are `list-item` nodes with `props.checked` — the shape the
|
|
148
|
+
// parser emits and the serializer reads; there is no `task-item` node.
|
|
149
|
+
case "list-item":
|
|
150
|
+
if (node.props?.checked !== undefined)
|
|
151
|
+
found.add("pymdownx.tasklist:\n custom_checkbox: true");
|
|
152
|
+
break;
|
|
77
153
|
case "math":
|
|
154
|
+
case "math-block":
|
|
78
155
|
case "math-inline":
|
|
79
156
|
found.add("pymdownx.arithmatex:\n generic: true");
|
|
80
157
|
break;
|
|
81
158
|
case "footnote":
|
|
82
|
-
case "footnote-
|
|
159
|
+
case "footnote-list":
|
|
160
|
+
case "footnote-def":
|
|
83
161
|
found.add("footnotes");
|
|
84
162
|
break;
|
|
163
|
+
// The serializer emits `:octicons-arrow-right-24:` on a card link.
|
|
164
|
+
case "card":
|
|
165
|
+
case "cards":
|
|
166
|
+
case "link-card":
|
|
167
|
+
found.add(EMOJI_EXT);
|
|
168
|
+
break;
|
|
169
|
+
// An unrealized include is emitted as `--8<-- "path"`.
|
|
170
|
+
case "include":
|
|
171
|
+
found.add("pymdownx.snippets");
|
|
172
|
+
break;
|
|
85
173
|
}
|
|
174
|
+
if (node.inline)
|
|
175
|
+
walkInlineForExtensions(node.inline, found);
|
|
86
176
|
if (node.children)
|
|
87
177
|
walkForExtensions(node.children, found);
|
|
88
178
|
}
|
|
89
179
|
}
|
|
180
|
+
const EMOJI_EXT = "pymdownx.emoji:\n emoji_index: !!python/name:material.extensions.emoji.twemoji\n emoji_generator: !!python/name:material.extensions.emoji.to_svg";
|
|
181
|
+
/**
|
|
182
|
+
* Inline nodes NEST — a highlight inside a link, a struck span inside bold.
|
|
183
|
+
* Walking one level detected `==x==` at top level and missed the same mark
|
|
184
|
+
* one link deeper, so the extension was absent and the marks rendered as
|
|
185
|
+
* literal `==`.
|
|
186
|
+
*/
|
|
187
|
+
function walkInlineForExtensions(nodes, found) {
|
|
188
|
+
for (const inline of nodes) {
|
|
189
|
+
switch (inline.type) {
|
|
190
|
+
case "footnote-ref":
|
|
191
|
+
found.add("footnotes");
|
|
192
|
+
break;
|
|
193
|
+
case "highlight":
|
|
194
|
+
found.add("pymdownx.mark");
|
|
195
|
+
break;
|
|
196
|
+
case "kbd":
|
|
197
|
+
found.add("pymdownx.keys");
|
|
198
|
+
break;
|
|
199
|
+
case "math":
|
|
200
|
+
found.add("pymdownx.arithmatex:\n generic: true");
|
|
201
|
+
break;
|
|
202
|
+
case "icon":
|
|
203
|
+
found.add(EMOJI_EXT);
|
|
204
|
+
break;
|
|
205
|
+
case "text":
|
|
206
|
+
if (inline.strikethrough)
|
|
207
|
+
found.add("pymdownx.tilde");
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
const kids = inline.children;
|
|
211
|
+
if (kids)
|
|
212
|
+
walkInlineForExtensions(kids, found);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
90
215
|
// ── Nav Conversion ──────────────────────────────────────────────
|
|
91
216
|
/**
|
|
92
217
|
* Convert NavItem[] to mkdocs.yml nav YAML string.
|
|
@@ -95,82 +220,89 @@ function walkForExtensions(nodes, found) {
|
|
|
95
220
|
* - Home: index.md
|
|
96
221
|
* - Section:
|
|
97
222
|
* - Page: path.md
|
|
223
|
+
*
|
|
224
|
+
* An href is matched EXACTLY against the exported slugs (after stripping the
|
|
225
|
+
* origin, query, fragment and slashes). The previous last-segment fuzzy match
|
|
226
|
+
* would map `/installing/index/` to whichever page's slug ended in `index`
|
|
227
|
+
* first — wrong for any corpus with more than one index page.
|
|
98
228
|
*/
|
|
99
|
-
function navToYaml(items,
|
|
229
|
+
function navToYaml(items, slugs, ledger, indent = 2) {
|
|
100
230
|
const lines = [];
|
|
101
231
|
const prefix = " ".repeat(indent);
|
|
102
232
|
for (const item of items) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
lines.push(navToYaml(item.children, pages, indent + 4));
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// Group without own page
|
|
116
|
-
lines.push(`${prefix}- ${item.label}:`);
|
|
117
|
-
lines.push(navToYaml(item.children, pages, indent + 4));
|
|
118
|
-
}
|
|
233
|
+
const label = yamlScalar(item.label ?? "");
|
|
234
|
+
const target = item.href ? navTarget(item.href, slugs) : null;
|
|
235
|
+
// Children FIRST, so a group whose entries all failed to resolve is
|
|
236
|
+
// skipped rather than emitted as `- Group:` — a null section, which is a
|
|
237
|
+
// hard `mkdocs build` configuration abort, not a warning.
|
|
238
|
+
const inner = item.children?.length ? navToYaml(item.children, slugs, ledger, indent + 4) : "";
|
|
239
|
+
if (item.href && !target) {
|
|
240
|
+
ledger.record({ feature: "nav-entry", action: "dropped", detail: `${item.label ?? ""} → ${item.href}: not an exported page` });
|
|
119
241
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
242
|
+
if (inner) {
|
|
243
|
+
lines.push(`${prefix}- ${label}:`);
|
|
244
|
+
if (target)
|
|
245
|
+
lines.push(`${prefix} - ${label}: ${target}`);
|
|
246
|
+
lines.push(inner);
|
|
247
|
+
}
|
|
248
|
+
else if (target) {
|
|
249
|
+
lines.push(`${prefix}- ${label}: ${target}`);
|
|
250
|
+
}
|
|
251
|
+
else if (item.children?.length) {
|
|
252
|
+
ledger.record({ feature: "nav-entry", action: "dropped", detail: `${item.label ?? ""}: section with no exported pages` });
|
|
126
253
|
}
|
|
127
254
|
}
|
|
128
255
|
return lines.filter(Boolean).join("\n");
|
|
129
256
|
}
|
|
130
257
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
258
|
+
* What a nav href becomes in mkdocs.yml: a `slug.md` for an exported page,
|
|
259
|
+
* the URL itself for an external link (MkDocs supports `- Label: https://…`
|
|
260
|
+
* natively), or null when it names nothing we emit.
|
|
133
261
|
*/
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return parts[parts.length - 1] || null;
|
|
262
|
+
function navTarget(href, slugs) {
|
|
263
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//"))
|
|
264
|
+
return href;
|
|
265
|
+
const slug = hrefToSlug(href, slugs);
|
|
266
|
+
return slug ? `${slug}.md` : null;
|
|
267
|
+
}
|
|
268
|
+
function hrefToSlug(href, slugs) {
|
|
269
|
+
const key = hrefToSlugKey(href);
|
|
270
|
+
if (slugs.has(key))
|
|
271
|
+
return key;
|
|
272
|
+
if (slugs.has(`${key}/index`))
|
|
273
|
+
return `${key}/index`;
|
|
274
|
+
if (key === "" && slugs.has("index"))
|
|
275
|
+
return "index";
|
|
276
|
+
return null;
|
|
150
277
|
}
|
|
151
278
|
// ── YAML Generation ─────────────────────────────────────────────
|
|
152
279
|
function buildMkdocsYml(options, extensions, navYaml) {
|
|
153
280
|
const lines = [];
|
|
154
|
-
lines.push(`site_name: ${options.siteName}`);
|
|
281
|
+
lines.push(`site_name: ${yamlScalar(options.siteName)}`);
|
|
155
282
|
if (options.siteUrl)
|
|
156
|
-
lines.push(`site_url: ${options.siteUrl}`);
|
|
283
|
+
lines.push(`site_url: ${yamlScalar(options.siteUrl)}`);
|
|
157
284
|
if (options.repoUrl)
|
|
158
|
-
lines.push(`repo_url: ${options.repoUrl}`);
|
|
285
|
+
lines.push(`repo_url: ${yamlScalar(options.repoUrl)}`);
|
|
286
|
+
lines.push("use_directory_urls: true");
|
|
159
287
|
lines.push("");
|
|
160
288
|
// Theme
|
|
161
289
|
lines.push("theme:");
|
|
162
290
|
lines.push(` name: ${options.theme ?? "material"}`);
|
|
163
291
|
lines.push(" features:");
|
|
164
292
|
lines.push(" - content.code.copy");
|
|
165
|
-
lines.push(" -
|
|
293
|
+
lines.push(" - content.tabs.link");
|
|
166
294
|
lines.push(" - navigation.tracking");
|
|
167
295
|
lines.push(" - navigation.sections");
|
|
168
|
-
lines.push(" -
|
|
296
|
+
lines.push(" - navigation.indexes");
|
|
297
|
+
lines.push(" - navigation.top");
|
|
298
|
+
lines.push(" - toc.follow");
|
|
169
299
|
lines.push("");
|
|
170
300
|
// Nav
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
301
|
+
if (navYaml) {
|
|
302
|
+
lines.push("nav:");
|
|
303
|
+
lines.push(navYaml);
|
|
304
|
+
lines.push("");
|
|
305
|
+
}
|
|
174
306
|
// Extensions
|
|
175
307
|
lines.push("markdown_extensions:");
|
|
176
308
|
for (const ext of extensions) {
|
|
@@ -179,7 +311,7 @@ function buildMkdocsYml(options, extensions, navYaml) {
|
|
|
179
311
|
const extLines = ext.split("\n");
|
|
180
312
|
lines.push(` - ${extLines[0]}`);
|
|
181
313
|
for (let i = 1; i < extLines.length; i++) {
|
|
182
|
-
lines.push(`
|
|
314
|
+
lines.push(` ${extLines[i]}`);
|
|
183
315
|
}
|
|
184
316
|
}
|
|
185
317
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-mkdocs-project.js","sourceRoot":"","sources":["../../src/export/to-mkdocs-project.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAwB9C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAmB,EACnB,GAAc,EACd,OAA6B;IAE7B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAExC,0BAA0B;IAC1B,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,QAAQ,IAAI,CAAC,IAAI,KAAK,CAAC;QACxC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,oDAAoD;IACpD,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;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,EAAE,CAAC;QACZ,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,aAAa;IACb,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACnC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,mFAAmF;YACnF,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACzC,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,6 +1,56 @@
|
|
|
1
|
-
import type { TreeNode } from "../tree.js";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* MkDocs serializer — TreeNode[] → MkDocs (Python-Markdown + PyMdown) Markdown.
|
|
3
|
+
*
|
|
4
|
+
* Built on `@dogsbay/serialize-core`: shape-tolerant leaf reads, the shared
|
|
5
|
+
* inline walk, and a ledger for what could not be represented. The first
|
|
6
|
+
* version of this file predated the core and read `node.children` only, so
|
|
7
|
+
* every heading and paragraph parsed from real dogsbay-md — where the text is
|
|
8
|
+
* on `node.inline` — serialized as `# ` with no title. The tier-3 export
|
|
9
|
+
* conformance suite caught it the moment the exporter was wired in.
|
|
10
|
+
*
|
|
11
|
+
* Python-Markdown differs from CommonMark in ways that matter here:
|
|
12
|
+
*
|
|
13
|
+
* - Nested block content inside a list item, admonition or tab must be
|
|
14
|
+
* indented by FOUR spaces. Two-space continuation (fine in CommonMark)
|
|
15
|
+
* detaches the block and renders it at top level.
|
|
16
|
+
* - There is no native tabs/steps/cards syntax; PyMdown supplies
|
|
17
|
+
* `=== "Tab"`, and the rest is expressed with `attr_list` / `md_in_html`.
|
|
18
|
+
* - Heading ids come from `attr_list` (`# Title { #id }`), and the corpus
|
|
19
|
+
* cross-references depend on the AUTHORED ids surviving — AsciiDoc-derived
|
|
20
|
+
* ids like `additional-resources_welcome-index` would not be regenerated by
|
|
21
|
+
* the toc extension's slugifier.
|
|
4
22
|
*/
|
|
5
|
-
|
|
23
|
+
import type { TreeNode, NavItem } from "@dogsbay/types";
|
|
24
|
+
import { ExportLedger } from "@dogsbay/serialize-core";
|
|
25
|
+
export interface MkdocsSerializeOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Slug of the page being serialized (`welcome/oke_about`). Used to make
|
|
28
|
+
* site-rooted links (`/welcome/index/#anchor`) and asset refs
|
|
29
|
+
* (`/images/x.png`) RELATIVE to the emitted file, which is how MkDocs
|
|
30
|
+
* resolves and validates them. Without it links are emitted verbatim.
|
|
31
|
+
*/
|
|
32
|
+
pageSlug?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Every page slug in the export. A site-rooted href is rewritten to a
|
|
35
|
+
* relative `.md` link only when it names a page we are actually emitting;
|
|
36
|
+
* anything else (an asset, an external route) is left alone.
|
|
37
|
+
*/
|
|
38
|
+
slugs?: ReadonlySet<string>;
|
|
39
|
+
/** Loss recorder. One per export run; entries are stamped with the page. */
|
|
40
|
+
ledger?: ExportLedger;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Convert a TreeNode[] to MkDocs-compatible Markdown.
|
|
44
|
+
*/
|
|
45
|
+
export declare function treeToMkdocs(nodes: TreeNode[], options?: MkdocsSerializeOptions): string;
|
|
46
|
+
/**
|
|
47
|
+
* Site-rooted page links → relative `.md` links, which MkDocs resolves,
|
|
48
|
+
* validates, and rewrites for `use_directory_urls`. Only rewritten when the
|
|
49
|
+
* target is a page in this export; everything else passes through so an
|
|
50
|
+
* asset or external route is never turned into a dead `.md`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function mkdocsHref(href: string): string;
|
|
53
|
+
/** Normalise an href or slug to the slug form pages are keyed by. */
|
|
54
|
+
export declare function hrefToSlugKey(href: string): string;
|
|
55
|
+
export type { NavItem };
|
|
6
56
|
//# sourceMappingURL=to-mkdocs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-mkdocs.d.ts","sourceRoot":"","sources":["../../src/export/to-mkdocs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"to-mkdocs.d.ts","sourceRoot":"","sources":["../../src/export/to-mkdocs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAc,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAcL,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AASD;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAQ5F;AAyUD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqB/C;AAgiBD,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,YAAY,EAAE,OAAO,EAAE,CAAC"}
|