sphinx-mounts¶
Mount external source trees into a Sphinx build without copying or
symlinking. The sources stay where they live; Sphinx reads them in place
under a configured docname prefix. Any format Sphinx knows how to parse
is supported — .rst out of the box, .md via
myst-parser, plus anything else
a parser extension registers.
[[mounts]] entries in ubproject.toml map external directories
onto docname slots in the host project. Those slots (docs/api/,
docs/shared/) do not exist on disk — sphinx-mounts populates
them virtually and the host’s index.rst toctree attaches them into
the build.¶
Use cases:
Build-system-generated docs (Bazel, Buck2, Pants) where outputs land in directories outside
srcdirand you do not want a staging step.Mono-repo doc bundles owned by different teams and consumed by a host project.
Generated API references produced by a sibling tool whose output is pure RST.
Distributed Markdown files living next to the code they document —
README.mdfiles in each subpackage of a monorepo, design notes in sibling repositories, release notes generated underdist/— pulled into a single Sphinx documentation build without copying. Works as soon asmyst_parseris loaded; see Source formats: RST, Markdown, and anything Sphinx knows about.
Note
Beta software. sphinx-mounts is in early beta. The configuration
shape, mount semantics, and edge-case behavior may still change before
1.0. Feedback on the mount mechanism — what works, what surprises
you, what is missing — is very much appreciated; please open an issue
at github.com/useblocks/sphinx-mounts/issues.
Contents
- Motivation
- Installation
- Configuration
- Why a TOML file (and not just
conf.py)? - The conf.py-side configuration
- What “mount” means here
- The TOML schema
- Toctree integration
- Fallback:
mountsinconf.py - How relative paths in
dir/filesare resolved - Source formats: RST, Markdown, and anything Sphinx knows about
- File discovery
- Bundle discipline
- Why a TOML file (and not just
- Usage
- Integration with Sphinx
- Bazel integration
- Changelog