Skip to main content
independoc
Language: English

Markdown & Web Components#

independoc supports CommonMark core syntax, GFM extensions, Docusaurus-style Admonitions, and standard browser Web Components (Custom Elements) directly inside Markdown.

Admonitions (Callouts)#

::: directives are rendered to static <aside> HTML at build time with zero client JavaScript.

Tabs (<nd-tabs>)#

Standard Markdown (code blocks, lists, links) can be nested directly inside <nd-tabs> and <nd-tab>. Adding group-id synchronizes tab selection across instances and pages via localStorage.

build.mjs
import { buildSite } from 'independoc';

const result = await buildSite({
  cwd: process.cwd(),
  overrides: { onBrokenLinks: 'error' },
});
console.log(`Built ${result.pageCount} pages in ${result.durationMs}ms`);
independoc.config.json
{
  "title": "Team Docs",
  "docsDir": "docs",
  "outDir": "dist",
  "lang": "en",
  "onBrokenLinks": "error"
}
bash
node ./bin/independoc.js check
node ./bin/independoc.js build --base /team-docs/

Callouts, Badges, and Collapsible Details#

  • Inline badges: Zero Dep Stable Experimental Breaking
  • Component-style callout:

The built-in components.js bundle is only included on pages that actually contain <nd-*> elements. Plain Markdown pages ship zero component script.

  • Collapsible details (<nd-details> or native <details>):

Expands into a native HTML <details> element for accessible keyboard and screen-reader interaction. Nested <nd-tabs> keep their group sync intact.

Syntax Highlighting & Code Block Line Decorations#

Fenced code blocks (```lang title="filename") are highlighted at build time with zero client-side syntax-highlighting JS.

Supported languages: js / ts / json / bash / html / css / go / rust / python / yaml / markdown / diff / diff-<lang>

  • {1,3-5}: Highlight 1-based line numbers or ranges
  • showLineNumbers / showLineNumbers=10: Render CSS-based line numbers (excluded from copy)
  • // [!code highlight] / // [!code ++] / // [!code --]: Line-end markers for highlight, addition, or deletion (stripped from rendered output)
  • diff / diff-<lang>: Highlight leading +, -, and @@ lines (deleted lines are skipped when copying)

Live Example: Line Numbers, Line Highlights, and Add/Remove Markers#

src/example.js
export function greet(name) {
  const oldPrefix = 'Hi';
  const prefix = 'Hello';
  return `${prefix}, ${name}!`;
}

Live Example: diff Code Block#

independoc.config.json
@@ -5,3 +5,4 @@
   "lang": "en",
-  "onBrokenLinks": "warn"
+  "onBrokenLinks": "error",
+  "showLastUpdated": true

Card Grids (<nd-card-grid> / <nd-card>)#

Responsive cards for landing pages and feature overviews. href resolves relative Markdown paths at build time and strips dangerous schemes such as javascript:. Set cols to 2, 3, or 4, or omit for auto-fit.

Quick Start

Launch a zero-dependency documentation site in minutes.

Configuration Reference

Full reference for independoc.config.json and Frontmatter.

Step Lists (<nd-steps>)#

Renders an ordered list as a numbered step-by-step timeline using pure CSS (no client JS required).

  1. Clone the repository.

    bash
    git clone https://github.com/stakme/independoc.git
  2. Start the preview server.

    bash
    npm run serve

File Trees (<nd-file-tree>)#

Renders nested Markdown lists as a monospace directory tree while remaining readable as standard lists without JS.

  • docs/

    • index.md Homepage
    • guides/

      • _category.json
      • 01-zero-dependency-design.md
  • independoc.config.json

GFM Tables & Task Lists#

CapabilityExternal npm PackagesBrowser JS
Markdown → HTML0None
Syntax highlighting & line decorations0None (build-time)
Mobile drawer & language/version switchers0None (HTML/CSS)
Tabs, search, theme toggle, ToC scroll spy0Minimal vanilla JS
  • Build, preview, and test using only Node.js standard APIs
  • Automatic blocking of dangerous URL schemes (javascript:, vbscript:, data:text/html)
  • Unicode heading slugs and CJK 2-gram local full-text search

To add your own interactive components, see Custom Web Components Guide.

Edit this pageLast updated:
Built with independoc itself — 0 npm dependencies.