docs-react
Markdown documentation viewer and agent CLI. Drop .md files with front matter in a folder and get topic navigation, search, syntax-highlighted code, tables and dark and light themes, plus an index and a docs command that coding agents use to read, write and bundle the same docs.
Live demo ·
Quick start ·
Doc format ·
CLI ·
Agent skill
What it does
docs-react keeps documentation as plain Markdown files that people read in a fast React viewer and agents read from the shell. One folder, two readers:
flowchart LR
A[".md files with front matter<br/>content/ or DOCS_ROOT"] -->|docs index| B["index.json<br/>INDEX.md"]
B --> C["React viewer<br/>topic tree, search, code, tables"]
A --> C
A --> D["docs CLI<br/>list, search, get, new, bundle"]
B --> E["Agents<br/>read INDEX.md, fetch one doc"]
D --> E
D -->|docs bundle| F["one .md file<br/>for a web chat"]
| Feature | Detail |
|---|
| Markdown first | GitHub-flavoured Markdown: tables, task lists, strikethrough, fenced code |
| Topic navigation | The first topic in each doc's front matter places it in a nested tree (reference/api) |
| Search | Instant filter over titles, summaries, tags and topics in the viewer; full-text search in the CLI |
| Code | Prism highlighting for 16 languages, loaded only when a page has code, with a copy button |
| Index for agents | INDEX.md: one line per doc (title, path, topics, summary) that any agent can read |
| Bundles | docs bundle joins whole topics into one Markdown file with a table of contents |
| Themes | Dark and light, following the system until you pick one |
| Private by default | The content/ folder is ignored by git; the public demo builds from example/ only |
| Fast | One small JSON index on load, each doc fetched on demand and cached, Markdown and highlighter in lazy chunks |
Quick start
git clone https://github.com/hec-ovi/docs-react.git && cd docs-react
npm install
npm run dev # http://localhost:5173/ with the example library
Use your own library: put Markdown files in content/ (ignored by git), or point DOCS_ROOT at any folder.
mkdir content && node bin/docs.mjs new guide "Hello" --summary "My first doc."
npm run dev # now shows content/
DOCS_ROOT=/srv/team-docs npm run dev
| Command | Output |
|---|
npm run dev | Dev server; reindexes and reloads when a doc changes |
npm run build | dist/ with the library copied to dist/content/ |
npm run build:pages | docs/ for GitHub Pages, built from example/ only |
npm run docs -- <command> | The CLI without installing it |
The viewer resolves the library in this order: DOCS_ROOT (environment or .env), content/ when it exists, example/.
The doc format
---
title: Writing docs
topics: [guide, reference/format]
tags: [front-matter, topics]
summary: One line that tells a reader or an agent what the doc holds.
updated: 2026-11-03
order: 2
---
A short lead paragraph, then sections.
## First section
| Field | Required | Use |
|---|
title | yes | Page heading and navigation label (falls back to the first # heading) |
topics | yes | First topic places the doc in the navigation; nest with /; the rest feed lists, search and bundles |
tags | no | Extra search words |
summary | yes | One line, shown in the index and in INDEX.md |
updated | no | A date; defaults to the file's modification day |
order | no | Sorts docs inside a topic |