forked from wagenaartje/neataptic
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrender-docs-html.ts
More file actions
38 lines (32 loc) · 1.18 KB
/
render-docs-html.ts
File metadata and controls
38 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Converts every README.md inside docs/ into an index.html in the same directory.
* Usage: npm run docs:html
*
* This file intentionally stays orchestration-first. The folder-owned boundary
* under `scripts/render-docs-html/` owns navigation, Markdown page rendering,
* static assets, and Mermaid validation.
*/
import { ensureRenderDocsAssets } from './render-docs-html/render-docs-html.assets.js';
import {
ensureMermaidBrowserAssets,
validateMermaidBlocks,
} from './render-docs-html/render-docs-html.mermaid.js';
import {
collectDocsPages,
emitDocsPages,
} from './render-docs-html/render-docs-html.pages.js';
async function main(): Promise<void> {
// Step 1: Ensure static assets and Mermaid browser bundles are published.
await ensureRenderDocsAssets();
await ensureMermaidBrowserAssets();
// Step 2: Discover markdown pages and collect Mermaid fences.
const { pages, mermaidBlocks } = await collectDocsPages();
// Step 3: Validate all Mermaid diagrams before emitting HTML.
await validateMermaidBlocks(mermaidBlocks);
// Step 4: Render the full HTML page set.
await emitDocsPages(pages);
}
main().catch((e) => {
console.error(e);
process.exit(1);
});