sphinx-llm¶
Make your docs readable by AI assistants and coding tools. sphinx-llm generates LLM-friendly versions of your documentation following the llms.txt convention — Lumina links to llms.txt automatically once the extension is enabled.
What It Produces¶
llms.txt— A markdown index of all pages with titles, URLs, and descriptions, plus a scopedllms.txtin each section folderllms-full.txt— The full content of every page concatenated into a single markdown file (opt-in, seellms_txt_full_build)Per-page
.mdfiles — Each HTML page gets a companion markdown file (e.g.,getting-started.html.mdandgetting-started.md)
Lumina Integration¶
Lumina automatically adds a <link rel="alternate"> tag in the HTML <head> pointing to llms.txt when this extension is detected — no extra configuration needed. sphinx-llm 1.1 and later also add their own <link rel="describedby"> tag.
Setup¶
uv add sphinx-llm
extensions = ["sphinx_llm.txt"]
That’s it. On the next build, llms.txt and per-page .md files appear alongside your HTML output.
Lumina’s own documentation builds with -W and also sets these options:
llms_txt_full_build = True
# Skip nodes the Markdown export can't render (tips, sidebars, diagrams)
# instead of warning about each one.
llms_txt_suppress_unknown_node_warnings = True
Configuration¶
All options are optional — the defaults work well for most projects:
Option |
Default |
Description |
|---|---|---|
|
|
Master on/off switch. Disable with |
|
Auto-detected |
Project description shown in the |
|
|
Run the markdown build in parallel with the HTML build. |
|
|
Controls per-page markdown filenames: |
|
|
Whether to generate |
|
|
Glob patterns of document names (e.g. |
|
|
Skip document nodes the Markdown export can’t render without warning. |
How It Works¶
The extension runs a parallel Sphinx build using a markdown builder. All directives (including autodoc, toctree, cross-references) are fully expanded in the output — you get clean, rendered markdown, not raw source.
Each entry in llms.txt includes a description sourced from the page’s meta description or the first 100 characters of content.