Quick Start#
With Node.js 22.0.0 or newer (Node.js 22 / 24 LTS recommended), you can scaffold, preview, and build a documentation site directly — without running npm install.
Setup Steps#
Verify your Node.js version.
bashnode --version # Must be v22.x.x or newerScaffold a new documentation project.
bashnode ./bin/independoc.js init ./my-docs cd my-docsStart the local dev server with live reload.
bashnode ../bin/independoc.js serve --port 3000Check internal links and build the static site.
bashnode ../bin/independoc.js check node ../bin/independoc.js build --strict-links
Core Workflow#
Generate a minimal docs starter directory in seconds.
node ./bin/independoc.js init ./my-docs
cd my-docsThis creates independoc.config.json, docs/index.md, and docs/01-getting-started.md. To preview or build this repository's own official site, run npm run serve or npm run build from the repository root.
Start a local development server with file watching and SSE (Server-Sent Events) live reload.
# Run inside my-docs
node ../bin/independoc.js serve --port 3000By default it binds to 127.0.0.1 and validates the Host header to protect against DNS rebinding.
Compile Markdown under docs/ (plus i18n/ and versioned_docs/ when configured) and assets in static/ into dist/.
# Run inside my-docs
node ../bin/independoc.js build --strict-linksOutput is staged into a temporary directory and swapped atomically so a failed build never corrupts an existing dist/ directory.
Validate Markdown syntax, duplicate routes, internal links, heading anchors, and navbar links without writing output files.
# Run inside my-docs
node ../bin/independoc.js checkDirectory Layout & URL Rules#
Files under docs/ map directly to the sidebar hierarchy and clean trailing-slash URLs. For multi-language documentation, add i18n/<locale>/docs/ and register the locale in i18n.locales and i18n.localeConfigs.
docs/
- index.md →
/ - 01-getting-started.md →
/getting-started/ - 02-markdown-and-components.md →
/markdown-and-components/ - 03-configuration.md →
/configuration/ guides/
_category.jsonCategory label, order, and default collapse state- 01-zero-dependency-design.md →
/guides/zero-dependency-design/ - 03-deployment.md →
/guides/deployment/
- index.md →
i18n/
en/
- docs/ →
/en/...
- docs/ →
zh/
- docs/ →
/zh/...
- docs/ →
- static/ Static assets copied as-is
- independoc.config.json Site configuration
- Automatic numeric prefix stripping: Prefixes like
01-in01-getting-started.mdcontrol ordering and are stripped from final URLs. - Index pages:
index.md(orREADME.md) serves the directory root URL. - Relative
.mdlink rewriting: Links such as[Configuration Reference](./03-configuration.md)are rewritten at build time withbasePathand locale prefixes. - Draft exclusion: Pages with
draft: truein Frontmatter are excluded from production builds, search indexes, andllms.txtunless--include-draftsis passed.
Continue to Markdown & Web Components.