@dogsbay/format-mkdocs 0.2.0-beta.18 → 0.2.0-beta.181
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 +0 -1
- package/dist/cli.js +118 -5
- package/dist/export/capabilities.d.ts +22 -0
- package/dist/export/capabilities.js +213 -0
- package/dist/export/to-astro.d.ts +0 -1
- package/dist/export/to-astro.js +12 -4
- package/dist/export/to-mkdocs-project.d.ts +12 -1
- package/dist/export/to-mkdocs-project.js +289 -64
- package/dist/export/to-mkdocs.d.ts +53 -4
- package/dist/export/to-mkdocs.js +905 -104
- package/dist/importer.d.ts +2 -1
- package/dist/importer.js +16 -2
- package/dist/index.d.ts +22 -4
- package/dist/index.js +41 -4
- package/dist/inline-walker.d.ts +0 -1
- package/dist/inline-walker.js +0 -1
- package/dist/loader.d.ts +1 -2
- package/dist/loader.js +28 -9
- package/dist/nav-coverage.d.ts +17 -0
- package/dist/nav-coverage.js +76 -0
- package/dist/parse.d.ts +0 -1
- package/dist/parse.js +0 -1
- package/dist/renderers/mermaid.d.ts +0 -1
- package/dist/renderers/mermaid.js +0 -1
- package/dist/rules/admonition.d.ts +0 -1
- package/dist/rules/admonition.js +0 -1
- package/dist/rules/annotations.d.ts +0 -1
- package/dist/rules/annotations.js +0 -1
- package/dist/rules/autodoc.d.ts +1 -2
- package/dist/rules/autodoc.js +1 -3
- package/dist/rules/blocks.d.ts +0 -1
- package/dist/rules/blocks.js +0 -1
- package/dist/rules/content-tabs.d.ts +0 -1
- package/dist/rules/content-tabs.js +0 -1
- package/dist/rules/docusaurus-admonitions.d.ts +0 -1
- package/dist/rules/docusaurus-admonitions.js +0 -1
- package/dist/rules/file-include.d.ts +0 -1
- package/dist/rules/file-include.js +0 -1
- package/dist/rules/footnotes.d.ts +0 -1
- package/dist/rules/footnotes.js +0 -1
- package/dist/rules/icon-shortcode.d.ts +0 -1
- package/dist/rules/icon-shortcode.js +0 -1
- package/dist/rules/keys.d.ts +0 -1
- package/dist/rules/keys.js +0 -1
- package/dist/rules/link-rewrite.d.ts +0 -1
- package/dist/rules/link-rewrite.js +0 -1
- package/dist/rules/math.d.ts +0 -1
- package/dist/rules/math.js +0 -1
- package/dist/rules/md-in-html.d.ts +0 -1
- package/dist/rules/md-in-html.js +0 -1
- package/dist/rules/snippets.d.ts +0 -1
- package/dist/rules/snippets.js +0 -1
- package/dist/rules/templates.d.ts +0 -1
- package/dist/rules/templates.js +0 -1
- package/dist/rules/variants.d.ts +0 -1
- package/dist/rules/variants.js +0 -1
- package/dist/tree.d.ts +0 -1
- package/dist/tree.js +0 -1
- package/dist/utils/indent.d.ts +0 -1
- package/dist/utils/indent.js +0 -1
- package/dist/utils/types.d.ts +0 -1
- package/dist/utils/types.js +0 -1
- package/dist/walker.d.ts +0 -1
- package/dist/walker.js +26 -1
- package/package.json +13 -12
- package/dist/autodoc/markdown-generator.d.ts +0 -6
- package/dist/autodoc/markdown-generator.d.ts.map +0 -1
- package/dist/autodoc/markdown-generator.js +0 -242
- package/dist/autodoc/markdown-generator.js.map +0 -1
- package/dist/autodoc/module-resolver.d.ts +0 -8
- package/dist/autodoc/module-resolver.d.ts.map +0 -1
- package/dist/autodoc/module-resolver.js +0 -218
- package/dist/autodoc/module-resolver.js.map +0 -1
- package/dist/autodoc/python-docstring.d.ts +0 -7
- package/dist/autodoc/python-docstring.d.ts.map +0 -1
- package/dist/autodoc/python-docstring.js +0 -324
- package/dist/autodoc/python-docstring.js.map +0 -1
- package/dist/autodoc/python-parser.d.ts +0 -10
- package/dist/autodoc/python-parser.d.ts.map +0 -1
- package/dist/autodoc/python-parser.js +0 -541
- package/dist/autodoc/python-parser.js.map +0 -1
- package/dist/autodoc/tree-builder.d.ts +0 -9
- package/dist/autodoc/tree-builder.d.ts.map +0 -1
- package/dist/autodoc/tree-builder.js +0 -279
- package/dist/autodoc/tree-builder.js.map +0 -1
- package/dist/autodoc/types.d.ts +0 -128
- package/dist/autodoc/types.d.ts.map +0 -1
- package/dist/autodoc/types.js +0 -2
- package/dist/autodoc/types.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/export/to-astro.d.ts.map +0 -1
- package/dist/export/to-astro.js.map +0 -1
- package/dist/export/to-mkdocs-project.d.ts.map +0 -1
- package/dist/export/to-mkdocs-project.js.map +0 -1
- package/dist/export/to-mkdocs.d.ts.map +0 -1
- package/dist/export/to-mkdocs.js.map +0 -1
- package/dist/importer.d.ts.map +0 -1
- package/dist/importer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inline-walker.d.ts.map +0 -1
- package/dist/inline-walker.js.map +0 -1
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js.map +0 -1
- package/dist/parse.d.ts.map +0 -1
- package/dist/parse.js.map +0 -1
- package/dist/renderers/mermaid.d.ts.map +0 -1
- package/dist/renderers/mermaid.js.map +0 -1
- package/dist/rules/admonition.d.ts.map +0 -1
- package/dist/rules/admonition.js.map +0 -1
- package/dist/rules/annotations.d.ts.map +0 -1
- package/dist/rules/annotations.js.map +0 -1
- package/dist/rules/autodoc.d.ts.map +0 -1
- package/dist/rules/autodoc.js.map +0 -1
- package/dist/rules/blocks.d.ts.map +0 -1
- package/dist/rules/blocks.js.map +0 -1
- package/dist/rules/content-tabs.d.ts.map +0 -1
- package/dist/rules/content-tabs.js.map +0 -1
- package/dist/rules/docusaurus-admonitions.d.ts.map +0 -1
- package/dist/rules/docusaurus-admonitions.js.map +0 -1
- package/dist/rules/file-include.d.ts.map +0 -1
- package/dist/rules/file-include.js.map +0 -1
- package/dist/rules/footnotes.d.ts.map +0 -1
- package/dist/rules/footnotes.js.map +0 -1
- package/dist/rules/icon-shortcode.d.ts.map +0 -1
- package/dist/rules/icon-shortcode.js.map +0 -1
- package/dist/rules/keys.d.ts.map +0 -1
- package/dist/rules/keys.js.map +0 -1
- package/dist/rules/link-rewrite.d.ts.map +0 -1
- package/dist/rules/link-rewrite.js.map +0 -1
- package/dist/rules/math.d.ts.map +0 -1
- package/dist/rules/math.js.map +0 -1
- package/dist/rules/md-in-html.d.ts.map +0 -1
- package/dist/rules/md-in-html.js.map +0 -1
- package/dist/rules/snippets.d.ts.map +0 -1
- package/dist/rules/snippets.js.map +0 -1
- package/dist/rules/templates.d.ts.map +0 -1
- package/dist/rules/templates.js.map +0 -1
- package/dist/rules/variants.d.ts.map +0 -1
- package/dist/rules/variants.js.map +0 -1
- package/dist/tree.d.ts.map +0 -1
- package/dist/tree.js.map +0 -1
- package/dist/utils/indent.d.ts.map +0 -1
- package/dist/utils/indent.js.map +0 -1
- package/dist/utils/types.d.ts.map +0 -1
- package/dist/utils/types.js.map +0 -1
- package/dist/walker.d.ts.map +0 -1
- package/dist/walker.js.map +0 -1
package/dist/importer.d.ts
CHANGED
|
@@ -27,4 +27,5 @@ export declare function readMkdocsConfig(sourceDir: string): MkdocsConfig;
|
|
|
27
27
|
* Import a MkDocs project: parse all pages and extract navigation.
|
|
28
28
|
*/
|
|
29
29
|
export declare function importMkdocsProject(sourceDir: string, opts?: Record<string, unknown>): Promise<MkdocsImportResult>;
|
|
30
|
-
|
|
30
|
+
/** Mark the pages `pagesOutsideNav` names `unlisted: true`; returns how many. */
|
|
31
|
+
export declare function unlistOutsideNav(pages: ExportPage[], raw: Record<string, unknown>): number;
|
package/dist/importer.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Reads a MkDocs project directory (containing mkdocs.yml) and produces
|
|
5
5
|
* ExportPage[] + NavItem[] — the universal format contract.
|
|
6
6
|
*/
|
|
7
|
+
import { pagesOutsideNav } from "./nav-coverage.js";
|
|
7
8
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
8
9
|
import { join, relative, basename, dirname, resolve } from "node:path";
|
|
9
10
|
import MarkdownIt from "markdown-it";
|
|
@@ -75,7 +76,9 @@ export async function importMkdocsProject(sourceDir, opts = {}) {
|
|
|
75
76
|
const parseOpts = {
|
|
76
77
|
collapse: false,
|
|
77
78
|
youtubeEmbed: true,
|
|
78
|
-
diagrams
|
|
79
|
+
// `content.diagrams` (false, true, "mermaid-cli" or "pele"); it was always true here, so
|
|
80
|
+
// `content.diagrams: false` did not reach MkDocs sources
|
|
81
|
+
diagrams: opts.diagrams ?? true,
|
|
79
82
|
};
|
|
80
83
|
// Detect mkdocstrings autodoc config
|
|
81
84
|
const mkdocstringsConfig = extractMkdocstringsConfig(config.raw, sourceDir);
|
|
@@ -164,8 +167,20 @@ export async function importMkdocsProject(sourceDir, opts = {}) {
|
|
|
164
167
|
// where pages will actually be emitted.
|
|
165
168
|
const hrefPrefix = typeof opts.hrefPrefix === "string" ? opts.hrefPrefix : "/docs";
|
|
166
169
|
const nav = convertNav(config.raw.nav, hrefPrefix);
|
|
170
|
+
unlistOutsideNav(pages, config.raw);
|
|
167
171
|
return { pages, nav, config };
|
|
168
172
|
}
|
|
173
|
+
/** Mark the pages `pagesOutsideNav` names `unlisted: true`; returns how many. */
|
|
174
|
+
export function unlistOutsideNav(pages, raw) {
|
|
175
|
+
const out = new Set(pagesOutsideNav(pages.map((p) => p.slug), raw));
|
|
176
|
+
for (const page of pages)
|
|
177
|
+
if (out.has(page.slug))
|
|
178
|
+
page.frontmatter = { ...(page.frontmatter ?? {}), unlisted: true };
|
|
179
|
+
if (out.size > 0) {
|
|
180
|
+
console.log(` ${out.size} page(s) not in mkdocs.yml's nav are unlisted: built, out of the menu, and (unlike MkDocs) out of search, the sitemap and llms.txt (docs/unlisted-pages.md)`);
|
|
181
|
+
}
|
|
182
|
+
return out.size;
|
|
183
|
+
}
|
|
169
184
|
// ── Helpers ─────────────────────────────────────────────
|
|
170
185
|
/** Match a YAML frontmatter block at the start of an MD source. */
|
|
171
186
|
const FRONTMATTER_RE = /^---\n([\s\S]*?)\n---\n?/;
|
|
@@ -373,4 +388,3 @@ function extractMacrosData(config, sourceDir) {
|
|
|
373
388
|
}
|
|
374
389
|
return Object.keys(result).length > 0 ? result : null;
|
|
375
390
|
}
|
|
376
|
-
//# sourceMappingURL=importer.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { parseToTree } from "./parse.js";
|
|
|
7
7
|
export { parseShortcode } from "./rules/icon-shortcode.js";
|
|
8
8
|
export { treeToMkdocs } from "./export/to-mkdocs.js";
|
|
9
9
|
export { exportMkdocsProject } from "./export/to-mkdocs-project.js";
|
|
10
|
+
export { MKDOCS_CAPABILITIES } from "./export/capabilities.js";
|
|
11
|
+
export { pagesOutsideNav } from "./nav-coverage.js";
|
|
10
12
|
export type { MkdocsProjectOptions, MkdocsProjectExport } from "./export/to-mkdocs-project.js";
|
|
11
13
|
export interface MkdocsPluginOptions {
|
|
12
14
|
admonitions?: boolean;
|
|
@@ -50,8 +52,24 @@ export interface MkdocsPluginOptions {
|
|
|
50
52
|
*/
|
|
51
53
|
export declare function mkdocsPlugin(md: MarkdownIt, options?: MkdocsPluginOptions): void;
|
|
52
54
|
/**
|
|
53
|
-
* Build plugin options from a mkdocs.yml `markdown_extensions`
|
|
54
|
-
*
|
|
55
|
+
* Build plugin options from a mkdocs.yml `markdown_extensions`
|
|
56
|
+
* declaration. MkDocs accepts two shapes — list (canonical) and
|
|
57
|
+
* mapping (FastAPI-style):
|
|
58
|
+
*
|
|
59
|
+
* markdown_extensions:
|
|
60
|
+
* - admonition
|
|
61
|
+
* - pymdownx.tabbed:
|
|
62
|
+
* alternate_style: true
|
|
63
|
+
*
|
|
64
|
+
* markdown_extensions:
|
|
65
|
+
* admonition: null
|
|
66
|
+
* pymdownx.tabbed:
|
|
67
|
+
* alternate_style: true
|
|
68
|
+
*
|
|
69
|
+
* We accept either, plus `null` / `undefined` (no extensions
|
|
70
|
+
* declared). Without the mapping-form handling, FastAPI-style
|
|
71
|
+
* mkdocs.yml silently skips PyMdownX Blocks (`/// note`, etc.) and
|
|
72
|
+
* downstream parses fall through to raw paragraphs — surfaced by
|
|
73
|
+
* the migrate-mkdocs FastAPI smoke.
|
|
55
74
|
*/
|
|
56
|
-
export declare function configureFromMkdocs(extensions:
|
|
57
|
-
//# sourceMappingURL=index.d.ts.map
|
|
75
|
+
export declare function configureFromMkdocs(extensions: unknown): MkdocsPluginOptions;
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@ export { parseShortcode } from "./rules/icon-shortcode.js";
|
|
|
7
7
|
// MkDocs serializer (TreeNode[] → MkDocs markdown)
|
|
8
8
|
export { treeToMkdocs } from "./export/to-mkdocs.js";
|
|
9
9
|
export { exportMkdocsProject } from "./export/to-mkdocs-project.js";
|
|
10
|
+
export { MKDOCS_CAPABILITIES } from "./export/capabilities.js";
|
|
11
|
+
export { pagesOutsideNav } from "./nav-coverage.js";
|
|
10
12
|
import { admonitionPlugin } from "./rules/admonition.js";
|
|
11
13
|
import { blocksPlugin } from "./rules/blocks.js";
|
|
12
14
|
import { contentTabsPlugin } from "./rules/content-tabs.js";
|
|
@@ -150,8 +152,25 @@ const EXTENSION_MAP = {
|
|
|
150
152
|
},
|
|
151
153
|
};
|
|
152
154
|
/**
|
|
153
|
-
* Build plugin options from a mkdocs.yml `markdown_extensions`
|
|
154
|
-
*
|
|
155
|
+
* Build plugin options from a mkdocs.yml `markdown_extensions`
|
|
156
|
+
* declaration. MkDocs accepts two shapes — list (canonical) and
|
|
157
|
+
* mapping (FastAPI-style):
|
|
158
|
+
*
|
|
159
|
+
* markdown_extensions:
|
|
160
|
+
* - admonition
|
|
161
|
+
* - pymdownx.tabbed:
|
|
162
|
+
* alternate_style: true
|
|
163
|
+
*
|
|
164
|
+
* markdown_extensions:
|
|
165
|
+
* admonition: null
|
|
166
|
+
* pymdownx.tabbed:
|
|
167
|
+
* alternate_style: true
|
|
168
|
+
*
|
|
169
|
+
* We accept either, plus `null` / `undefined` (no extensions
|
|
170
|
+
* declared). Without the mapping-form handling, FastAPI-style
|
|
171
|
+
* mkdocs.yml silently skips PyMdownX Blocks (`/// note`, etc.) and
|
|
172
|
+
* downstream parses fall through to raw paragraphs — surfaced by
|
|
173
|
+
* the migrate-mkdocs FastAPI smoke.
|
|
155
174
|
*/
|
|
156
175
|
export function configureFromMkdocs(extensions) {
|
|
157
176
|
const opts = {
|
|
@@ -161,10 +180,28 @@ export function configureFromMkdocs(extensions) {
|
|
|
161
180
|
snippets: false,
|
|
162
181
|
annotations: false,
|
|
163
182
|
};
|
|
164
|
-
|
|
183
|
+
const entries = normalizeExtensions(extensions);
|
|
184
|
+
for (const ext of entries) {
|
|
165
185
|
const name = typeof ext === "string" ? ext : Object.keys(ext)[0];
|
|
166
186
|
EXTENSION_MAP[name]?.(opts);
|
|
167
187
|
}
|
|
168
188
|
return opts;
|
|
169
189
|
}
|
|
170
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Normalize the two forms of mkdocs.yml `markdown_extensions` into
|
|
192
|
+
* the canonical list shape EXTENSION_MAP expects.
|
|
193
|
+
*/
|
|
194
|
+
function normalizeExtensions(raw) {
|
|
195
|
+
if (raw == null)
|
|
196
|
+
return [];
|
|
197
|
+
if (Array.isArray(raw)) {
|
|
198
|
+
return raw;
|
|
199
|
+
}
|
|
200
|
+
if (typeof raw === "object") {
|
|
201
|
+
// Mapping form → list of single-key objects (or bare strings
|
|
202
|
+
// when the value is null, matching the canonical bare-string
|
|
203
|
+
// entry).
|
|
204
|
+
return Object.entries(raw).map(([name, value]) => (value == null ? name : { [name]: value }));
|
|
205
|
+
}
|
|
206
|
+
return [];
|
|
207
|
+
}
|
package/dist/inline-walker.d.ts
CHANGED
package/dist/inline-walker.js
CHANGED
package/dist/loader.d.ts
CHANGED
|
@@ -33,10 +33,9 @@ export declare function parseMkdocsMarkdown(source: string, md: MarkdownIt, opti
|
|
|
33
33
|
collapse?: boolean;
|
|
34
34
|
env?: Record<string, unknown>;
|
|
35
35
|
youtubeEmbed?: boolean;
|
|
36
|
-
diagrams?: boolean;
|
|
36
|
+
diagrams?: boolean | "mermaid-cli" | "pele";
|
|
37
37
|
autodoc?: {
|
|
38
38
|
sourceRoot: string;
|
|
39
39
|
globalOptions?: Record<string, unknown>;
|
|
40
40
|
};
|
|
41
41
|
}): Promise<MkdocsParseResult>;
|
|
42
|
-
//# sourceMappingURL=loader.d.ts.map
|
package/dist/loader.js
CHANGED
|
@@ -37,9 +37,10 @@ export async function parseMkdocsMarkdown(source, md, options) {
|
|
|
37
37
|
if (options?.youtubeEmbed) {
|
|
38
38
|
liftYouTubeEmbeds(tree);
|
|
39
39
|
}
|
|
40
|
-
// Render diagram code blocks (mermaid etc.) to SVG (opt-in)
|
|
40
|
+
// Render diagram code blocks (mermaid etc.) to SVG (opt-in): mmdc, or Pele
|
|
41
|
+
// (`content.diagrams: pele`, plans/pele-diagrams.md)
|
|
41
42
|
if (options?.diagrams) {
|
|
42
|
-
await renderDiagrams(tree);
|
|
43
|
+
await renderDiagrams(tree, options.diagrams === "pele" ? "pele" : "mermaid-cli");
|
|
43
44
|
}
|
|
44
45
|
// Convert api-params HTML comments into structured TreeNodes
|
|
45
46
|
convertApiParams(tree, md);
|
|
@@ -93,8 +94,7 @@ function convertApiParams(nodes, md) {
|
|
|
93
94
|
*/
|
|
94
95
|
const DIRECTIVE_RE = /^:::\s+(\S+)\s*$/;
|
|
95
96
|
async function processAutodocDirectives(nodes, options, md) {
|
|
96
|
-
const { resolveIdentifier } = await import("
|
|
97
|
-
const { symbolToTreeNode } = await import("./autodoc/tree-builder.js");
|
|
97
|
+
const { resolveIdentifier, symbolToTreeNode } = await import("@dogsbay/autodoc-python");
|
|
98
98
|
const YAML = (await import("yaml")).default;
|
|
99
99
|
// Defaults match mkdocstrings Python handler defaults.
|
|
100
100
|
// Projects override these via mkdocs.yml handler options (passed as globalOptions).
|
|
@@ -183,14 +183,31 @@ const DIAGRAM_LANGS = new Set(["mermaid"]);
|
|
|
183
183
|
* into { type: "diagram", props: { lang: "mermaid", code: "...", svg: "..." } }.
|
|
184
184
|
* Source code is preserved for round-trip export and search.
|
|
185
185
|
*/
|
|
186
|
-
async function renderDiagrams(nodes) {
|
|
186
|
+
async function renderDiagrams(nodes, engine) {
|
|
187
187
|
let renderMermaidSvg;
|
|
188
|
+
const failed = [];
|
|
188
189
|
try {
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
if (engine === "pele") {
|
|
191
|
+
// format-dogsbay-md's Pele renderer: one per page, so a repeated diagram gets its own ids
|
|
192
|
+
const { renderPeleSvg, diagramId } = await import("@dogsbay/format-dogsbay-md");
|
|
193
|
+
const seen = new Map();
|
|
194
|
+
renderMermaidSvg = async (code) => {
|
|
195
|
+
const base = diagramId(code);
|
|
196
|
+
const n = (seen.get(base) ?? 0) + 1;
|
|
197
|
+
seen.set(base, n);
|
|
198
|
+
const r = await renderPeleSvg(code, n === 1 ? base : `${base}-${n}`);
|
|
199
|
+
if ("error" in r)
|
|
200
|
+
failed.push(r.error);
|
|
201
|
+
return "svg" in r ? r.svg : null;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const mod = await import("./renderers/mermaid.js");
|
|
206
|
+
renderMermaidSvg = mod.renderMermaidSvg;
|
|
207
|
+
}
|
|
191
208
|
}
|
|
192
209
|
catch (e) {
|
|
193
|
-
console.warn("[diagrams] could not load
|
|
210
|
+
console.warn("[diagrams] could not load the diagram renderer:", e);
|
|
194
211
|
return;
|
|
195
212
|
}
|
|
196
213
|
async function walk(nodes) {
|
|
@@ -218,6 +235,9 @@ async function renderDiagrams(nodes) {
|
|
|
218
235
|
}
|
|
219
236
|
}
|
|
220
237
|
await walk(nodes);
|
|
238
|
+
if (failed.length > 0) {
|
|
239
|
+
console.warn(`[diagrams] Pele could not draw ${failed.length} diagram(s), left as code blocks: ${failed[0].split("\n")[0].slice(0, 160)}`);
|
|
240
|
+
}
|
|
221
241
|
}
|
|
222
242
|
/**
|
|
223
243
|
* Extract heading info for table of contents.
|
|
@@ -762,4 +782,3 @@ function slugify(text) {
|
|
|
762
782
|
.trim()
|
|
763
783
|
|| "tab"; // fallback for titles that are entirely punctuation
|
|
764
784
|
}
|
|
765
|
-
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which pages an MkDocs `nav:` leaves out (no Node: the importer and `migrate-mkdocs` share it).
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The pages (by slug) an explicit `nav:` does not list. MkDocs builds them out of its menu
|
|
6
|
+
* (`not_in_nav` only quiets the notice), so they are UNLISTED here (plans/unlisted-pages.md):
|
|
7
|
+
* built, reachable by link, out of the menu — and also out of search, the sitemap and llms.txt,
|
|
8
|
+
* and noindex, which MkDocs does not do. None when MkDocs lists every page or the nav is not all
|
|
9
|
+
* written in mkdocs.yml:
|
|
10
|
+
* - no `nav:` (MkDocs lists every page);
|
|
11
|
+
* - a plugin that builds or extends the nav (literate-nav, awesome-pages/awesome-nav, i18n,
|
|
12
|
+
* monorepo/multirepo), or a nav entry naming a folder (`reference/`), a glob or `...`;
|
|
13
|
+
* The home page (`index`) is never one: MkDocs serves it at the root whatever the nav says. A
|
|
14
|
+
* Material blog's posts (`blog_dir`, default `blog`) are listed by the blog's own index. An entry
|
|
15
|
+
* to part of a page (`a.md#part`) lists the page.
|
|
16
|
+
*/
|
|
17
|
+
export declare function pagesOutsideNav(slugs: readonly string[], raw: Record<string, unknown>): string[];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which pages an MkDocs `nav:` leaves out (no Node: the importer and `migrate-mkdocs` share it).
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The pages (by slug) an explicit `nav:` does not list. MkDocs builds them out of its menu
|
|
6
|
+
* (`not_in_nav` only quiets the notice), so they are UNLISTED here (plans/unlisted-pages.md):
|
|
7
|
+
* built, reachable by link, out of the menu — and also out of search, the sitemap and llms.txt,
|
|
8
|
+
* and noindex, which MkDocs does not do. None when MkDocs lists every page or the nav is not all
|
|
9
|
+
* written in mkdocs.yml:
|
|
10
|
+
* - no `nav:` (MkDocs lists every page);
|
|
11
|
+
* - a plugin that builds or extends the nav (literate-nav, awesome-pages/awesome-nav, i18n,
|
|
12
|
+
* monorepo/multirepo), or a nav entry naming a folder (`reference/`), a glob or `...`;
|
|
13
|
+
* The home page (`index`) is never one: MkDocs serves it at the root whatever the nav says. A
|
|
14
|
+
* Material blog's posts (`blog_dir`, default `blog`) are listed by the blog's own index. An entry
|
|
15
|
+
* to part of a page (`a.md#part`) lists the page.
|
|
16
|
+
*/
|
|
17
|
+
export function pagesOutsideNav(slugs, raw) {
|
|
18
|
+
const navRaw = raw.nav;
|
|
19
|
+
if (!Array.isArray(navRaw) || navRaw.length === 0)
|
|
20
|
+
return [];
|
|
21
|
+
const plugins = pluginEntries(raw.plugins);
|
|
22
|
+
if (plugins.some(([name]) => NAV_PLUGINS.test(name)))
|
|
23
|
+
return [];
|
|
24
|
+
const listed = new Set();
|
|
25
|
+
let partial = false;
|
|
26
|
+
const add = (path) => {
|
|
27
|
+
const bare = path.trim();
|
|
28
|
+
if (bare === "..." || bare.endsWith("/") || /[*?[\]]/.test(bare.split("#")[0]))
|
|
29
|
+
partial = true;
|
|
30
|
+
else {
|
|
31
|
+
const slug = navPathSlug(bare);
|
|
32
|
+
if (slug !== undefined)
|
|
33
|
+
listed.add(slug);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const walk = (items) => {
|
|
37
|
+
for (const entry of items) {
|
|
38
|
+
if (typeof entry === "string")
|
|
39
|
+
add(entry);
|
|
40
|
+
else if (entry && typeof entry === "object") {
|
|
41
|
+
for (const value of Object.values(entry)) {
|
|
42
|
+
if (typeof value === "string")
|
|
43
|
+
add(value);
|
|
44
|
+
else if (Array.isArray(value))
|
|
45
|
+
walk(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
walk(navRaw);
|
|
51
|
+
if (partial)
|
|
52
|
+
return [];
|
|
53
|
+
const blogDirs = plugins
|
|
54
|
+
.filter(([name]) => name === "blog" || name === "material/blog")
|
|
55
|
+
.map(([, cfg]) => {
|
|
56
|
+
const dir = cfg && typeof cfg === "object" ? cfg.blog_dir : undefined;
|
|
57
|
+
return typeof dir === "string" ? dir.replace(/^\.?\/+|\/+$/g, "").replace(/^\.$/, "") : "blog";
|
|
58
|
+
});
|
|
59
|
+
return slugs.filter((slug) => slug !== "index" && !listed.has(slug) && !blogDirs.some((d) => d === "" || slug === d || slug.startsWith(`${d}/`)));
|
|
60
|
+
}
|
|
61
|
+
/** Plugins that build or extend the nav from elsewhere: the `nav:` in mkdocs.yml is not all of it. */
|
|
62
|
+
const NAV_PLUGINS = /^(?:literate-nav|awesome-pages|awesome-nav|i18n|static-i18n|monorepo|multirepo|mkdocs-nav-weight|gen-files)$/;
|
|
63
|
+
/** `plugins:` as `[name, config]`, from the list form (`- blog`, `- blog: {…}`) or the mapping form. */
|
|
64
|
+
function pluginEntries(plugins) {
|
|
65
|
+
if (Array.isArray(plugins)) {
|
|
66
|
+
return plugins.flatMap((p) => typeof p === "string" ? [[p, undefined]] : p && typeof p === "object" ? Object.entries(p) : []);
|
|
67
|
+
}
|
|
68
|
+
return plugins && typeof plugins === "object" ? Object.entries(plugins) : [];
|
|
69
|
+
}
|
|
70
|
+
/** A nav entry's file as a page slug (`a/index.md` → `a`, `index.md` → `index`, `a.md#x` → `a`); a URL names none. */
|
|
71
|
+
function navPathSlug(path) {
|
|
72
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(path) || path.startsWith("//"))
|
|
73
|
+
return undefined;
|
|
74
|
+
const slug = path.split(/[#?]/)[0].replace(/^\.?\/+/, "").replace(/\.md$/, "").replace(/\/index$/, "").replace(/^index$/, "");
|
|
75
|
+
return slug || "index";
|
|
76
|
+
}
|
package/dist/parse.d.ts
CHANGED
package/dist/parse.js
CHANGED
package/dist/rules/admonition.js
CHANGED
package/dist/rules/autodoc.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AutodocOptions } from "@dogsbay/autodoc-python";
|
|
2
2
|
/**
|
|
3
3
|
* Preprocess markdown source: replace ::: directives with generated API docs.
|
|
4
4
|
* Called from the loader (async context) before md.parse().
|
|
5
5
|
*/
|
|
6
6
|
export declare function preprocessAutodoc(source: string, options: AutodocOptions): Promise<string>;
|
|
7
|
-
//# sourceMappingURL=autodoc.d.ts.map
|
package/dist/rules/autodoc.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import YAML from "yaml";
|
|
2
|
-
import { resolveIdentifier } from "
|
|
3
|
-
import { generateMarkdown } from "../autodoc/markdown-generator.js";
|
|
2
|
+
import { resolveIdentifier, generateMarkdown, } from "@dogsbay/autodoc-python";
|
|
4
3
|
/**
|
|
5
4
|
* Match ::: identifier (mkdocstrings directive)
|
|
6
5
|
*/
|
|
@@ -99,4 +98,3 @@ export async function preprocessAutodoc(source, options) {
|
|
|
99
98
|
}
|
|
100
99
|
return changed ? lines.join("\n") : source;
|
|
101
100
|
}
|
|
102
|
-
//# sourceMappingURL=autodoc.js.map
|
package/dist/rules/blocks.d.ts
CHANGED
package/dist/rules/blocks.js
CHANGED
|
@@ -25,4 +25,3 @@ export declare function remapHighlights(hlNums: number[], lnNums: number[]): num
|
|
|
25
25
|
* Runs after snippets but before normalize.
|
|
26
26
|
*/
|
|
27
27
|
export declare function fileIncludePlugin(md: MarkdownIt, options: FileIncludeOptions): void;
|
|
28
|
-
//# sourceMappingURL=file-include.d.ts.map
|
package/dist/rules/footnotes.js
CHANGED
package/dist/rules/keys.d.ts
CHANGED
package/dist/rules/keys.js
CHANGED
package/dist/rules/math.d.ts
CHANGED
package/dist/rules/math.js
CHANGED
package/dist/rules/md-in-html.js
CHANGED
package/dist/rules/snippets.d.ts
CHANGED
package/dist/rules/snippets.js
CHANGED
package/dist/rules/templates.js
CHANGED
package/dist/rules/variants.d.ts
CHANGED
package/dist/rules/variants.js
CHANGED
package/dist/tree.d.ts
CHANGED
package/dist/tree.js
CHANGED
package/dist/utils/indent.d.ts
CHANGED
|
@@ -15,4 +15,3 @@ export declare function findIndentedBlockEnd(state: StateBlock, startLine: numbe
|
|
|
15
15
|
* become top-level blocks in the inner parse pass.
|
|
16
16
|
*/
|
|
17
17
|
export declare function dedentAndTokenize(state: StateBlock, startLine: number, endLine: number, indent: number): void;
|
|
18
|
-
//# sourceMappingURL=indent.d.ts.map
|
package/dist/utils/indent.js
CHANGED
package/dist/utils/types.d.ts
CHANGED
package/dist/utils/types.js
CHANGED
package/dist/walker.d.ts
CHANGED