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/