Build a docs site
charon build docs -o site
That reads every .md file under docs/ and writes a finished site to
site/. Every page gets:
- a sidebar, previous and next links, and an "On this page" list
- an anchor link on every
h2andh3 - links between pages by file path,
[Install](install.md), or by wikilink,[[Install]] - a Markdown copy at its URL plus
.md - search over every section, run in the browser
- a "Last updated" date from git
- a social card image, if you ask for one
The site also gets llms.txt, llms-full.txt and, with a site URL,
sitemap.xml. A link to a missing page or heading fails the build.
This site is one, built by charon build from a folder of Markdown.
Two ways to build #
charon buildwrites a static site in charon's default theme. Nothing else to install.- The Vite plugin renders the pages inside your own Vite site, with your template, CSS and scripts.
Both run the same core, so pages read the same either way.
Serve it #
charon build docs -o site --name "Acme Docs" --site-url https://acme.dev
charon build docs -o public --base /docs
-o is the web root: with --base /docs the pages land in public/docs/.
Any static host that maps /guide to /guide/index.html serves it.
A rebuild deletes what the last build wrote and this one did not, such as a
removed page. It reads that list from _charon/files.json and leaves every
other file in the output folder alone.
charon.json #
Put options in docs/charon.json instead of flags. Paths in it are relative to
the file:
{
"name": "Acme Docs",
"siteUrl": "https://acme.dev",
"sections": [
{ "title": "Start", "pages": ["", "install"] },
{ "title": "Guides", "pages": ["guides/deploy"] }
],
"links": { "app:/": "https://app.acme.dev/" }
}
| Flag | Key | Default |
|---|---|---|
-o, --out |
out |
site |
--name |
name |
Docs |
--base |
base |
none |
--site-url |
siteUrl |
none |
--template |
template |
charon's own |
--assets |
assets |
<dir>/assets |
--diagram-font |
diagrams |
pele's default |
--og-font |
og |
no cards |
--config |
<dir>/charon.json |
|
sections |
one per folder | |
links |
{} |
|
lang |
en |
|
labels |
English | |
contents |
{ "minHeadings": 3 } |
--diagram-font Inter is "diagrams": { "fontFamily": "Inter" } in the file.
sectionsgroups the sidebar and sets the order of previous and next. See Write pages.linksswaps a link prefix for another, so[Open the app](app:/settings)points athttps://app.acme.dev/settings.contents.minHeadingsis how manyh2s a page needs before it gets an "On this page" list.langandlabelsset the language; see Labels and styles.
What it writes #
| Path | Holds |
|---|---|
index.html, <page>/index.html |
each page |
index.md, <page>.md |
each page's Markdown copy |
search-index.json |
the search index |
llms.txt, llms-full.txt |
page lists for language models |
sitemap.xml |
every page, with a site URL |
<page>/og.png |
social cards, with og |
assets/ |
the assets folder, as is |
_charon/ |
the theme's CSS and script |
Pages with math load KaTeX's CSS from jsDelivr.