Getting Started¶
Installation¶
Directly install by using:
pip install sphinx-llms-txt
conda install -c conda-forge sphinx-llms-txt
Usage¶
Add the extension to your Sphinx configuration (conf.py):
extensions = [
'sphinx_llms_txt',
]
After the HTML finishes building, sphinx-llms-txt will output the location of the output files:
sphinx-llms-txt: Created /path/to/_build/html/llms-full.txt with 45 sources and 6879 lines
sphinx-llms-txt: created /path/to/_build/html/llms.txt
Choosing an Output Format¶
By default, sphinx-llms-txt requires no additional configuration and links to raw reStructuredText source files created by the HTML builder. For optimal LLM support, see the alternative builders below and the CMake workflow for setup.
Default |
Markdown |
reStructuredText |
|
|---|---|---|---|
Setup |
No config |
CMake [1] |
CMake |
Builder |
Native [2] |
||
Format |
Raw reStructuredText source |
Rendered Markdown [5] |
Rendered reStructuredText [5] |
LLM Readability |
Good - preserves structure for simple syntax |
Excellent - native LLM format |
Good - Can provide more structured content |
Key Advantage |
Zero setup required |
More compact (less input tokens) |
Can preserve Sphinx semantics |
Key Disadvantage |
Raw directives won’t be parsed [3] |
Loses structure from complex directives |
Can lose structure from complex directives |
llms-full.txt support |
Supported with above caveats |
Footnotes