Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting started

mdbook-llms is an mdBook 0.5 renderer that follows the llms.txt convention. Alongside your HTML site it writes:

  • llms.txt: an index of every chapter, grouped by SUMMARY.md parts
  • llms-full.txt: every chapter in reading order, in one file
  • <chapter>.md: each chapter’s Markdown at the path its HTML would use

How it fits into mdBook

flowchart LR
    A[SUMMARY.md + chapters] --> B["links preprocessor<br/>expands includes"]
    B --> C["strip-frontmatter + mermaid<br/>(HTML only)"]
    C --> D[html renderer] --> E[book/html/*.html]
    B --> F[mdbook-llms renderer]
    F --> G["llms.txt<br/>llms-full.txt<br/>chapter .md"]
    G -. written next to .-> E

The llms renderer reads the book before the HTML-only preprocessors run, so it sees chapter frontmatter and keeps Mermaid blocks as plain fenced code.

Quick start

Install the binaries:

cargo install --locked mdbook-llms

Add the renderer and the frontmatter preprocessor to your book.toml:

[preprocessor.strip-frontmatter]

[output.html]

[output.llms]

Run mdbook build. The llms files appear in book/html/, next to the site.

This book is built the same way. See Usage for every option and Contributing to work on the crate.