Step 02 · Alembic Toolkit · Alembic Toolkit · Publishing Markdown with alembic docs ENPT
Alembic · Visual Course

Publishing Markdown with alembic docs

Convert a directory of notes into a styled, navigable HTML site in one command.

Read the plain version, or open the technical layer on any section.
1

How it works


alembic docs walks the source directory, converts every Markdown file it finds, and writes a matching .html file. It also builds an index page that links to every generated page, using the first # heading as the page title.

Think of it like… a photocopier that takes loose pages and binds them into a booklet with a table of contents.

Under the hood

The converter supports headings up to four levels, paragraphs, unordered and ordered lists, fenced code blocks with language classes, inline code, bold, italic, and links. It escapes HTML entities and wraps the output in a complete HTML document with a responsive, light/dark stylesheet. The implementation lives in packages/docs/src/markdown.ts and packages/docs/src/site.ts.

2

In one picture


readme.mdguide.mdreadme.htmlguide.htmlindex.html
Every .md file maps to one .html file; an index lists them all.
3

In the code


# basic usage
alembic docs ./docs ./site

# with a custom site title
alembic docs ./docs ./site --site-title "Project Docs"

# machine-readable output
alembic docs ./docs ./site --json

Implementation notes

The --site-title argument is optional and defaults to "Documentation". The --json flag prints {"pages": N, "indexPath": "..."} so CI steps can parse the result without scraping text. Subdirectories are preserved: docs/api/core.md becomes site/api/core.html.

4

Try it


Write a Markdown file with a heading, a list, and a fenced code block. Run alembic docs and verify the generated HTML keeps the structure and styling.

Try this: Add a nested folder with another Markdown file and re-run. Does the index update automatically?