sphinx-longmd¶
Export an entire Sphinx project as one long-form Markdown document, with a JSON sidecar that preserves provenance, anchors, assets, warnings, and other build metadata.
Most users only need four things: install it, enable it, run it, and understand what comes out.
Note
sphinx-longmd is provided by Grainpool Holdings LLC under the Apache License, Version 2.0. Unless required by applicable law or agreed to in writing, the software is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Background¶
sphinx-longmd works from Sphinx’s assembled, resolved doctree instead of raw source files or rendered HTML. That means the builder sees Sphinx after toctree expansion, cross-reference resolution, domain object registration, and substitution handling.
The result is aimed at workflows that need one portable document instead of a many-page HTML tree, such as LLM ingestion, review packets, archival exports, or downstream publishing pipelines.
Quick path¶
Install:
pip install sphinx-longmd
Enable:
extensions = ["sphinx_longmd"]
Run:
sphinx-build -b longmd docs/source docs/_build/longmd
Expect:
docs/_build/longmd/
index.longmd.md
index.longmd.map.json
assets/
User guide
- Install
- Use the builder
- Output behavior
- Configuration
- Limitations and expectations
- Dialect Specification
- 1. Document structure
- 2. Anchors
- 3. Headings
- 4. Inline formatting
- 5. Links
- 6. Lists
- 7. Block quotes
- 8. Code blocks
- 9. Images
- 10. Tables
- 11. Transitions
- 12. Footnotes and citations
- 13. Definition lists
- 14. MyST colon-fenced directive blocks
- 15. Admonitions
- 16. Version-modified blocks
- 17. Object descriptions
- 18. Glossary terms
- 19. Generic field lists
- 20. Rubrics
- 21. Topics
- 22. Raw HTML
- 23. Fallback blocks
- 24. Provenance sidecar (
<root_doc>.longmd.map.json) - 25. Summary of syntactic forms
Project