FAQ#
Short answers to the question that comes up most often: which file do I edit to change this? The site has no single layout file. Seven layers each own one part of the result, and editing the wrong one is the usual reason a change does nothing.
Which file controls what#
I want to change |
Edit |
|---|---|
The links in the header, the theme, the accent color, which source files are ignored |
|
Which sections exist, their order, which page nests under which |
The |
Which modules get an API page, and how they are grouped |
|
The anatomy of a generated API page |
|
How the sidebar nests and labels the API entries |
|
Either sidebar’s collapse control |
|
Where the built HTML lands |
|
How do I add a new page?#
Write the file, then add its name, without the extension, to the
toctree of the index of the section it belongs to. Position in
that list is position in the sidebar; the list is not sorted.
If the page is a new top-level section, create a directory with an
index.md inside it, add that index to the root toctree in
docs/index.md, and add a matching entry to nav_links in
docs/conf.py if it deserves a header link. The landing page grid
cards in docs/index.md are a separate, hand-written copy of the
same links, so update them too or the two will disagree.
Why does Sphinx say my page is not in any toctree?#
Because nothing links to it. Every source file under docs/ is
read, and a file no toctree references is an orphan. Under
make strict the warning is an error, so the build fails.
Three ways out: add it to a toctree, which is almost always what you
want; add it to exclude_patterns in docs/conf.py if it is a
working note that should not be published; or put :orphan: at the
top of the file if it is genuinely meant to be reachable only by
direct link.
How do I add a module to the API reference?#
Add its dotted name to one of the autosummary blocks in
docs/api/index.rst, under the heading that fits it. The section
headings in that file are the grouping you see on the page, and the
order inside each block is the order rendered.
Everything under docs/api/generated/ is written by autosummary at
build time from the templates in docs/_templates/autosummary/.
Never edit those files by hand and never commit them: your changes
will be silently overwritten on the next build. To change what a
generated page contains, for every module at once, edit the
template.
If adding a module breaks the build, do not fix the source file as part of a docs change. See the troubleshooting table in Building the docs.
Where does the built HTML go?#
Locally, into docs/_build/html, set by BUILDDIR in
docs/Makefile. The directory is build output and is not committed.
When hosted, the build is driven by .github/workflows/docs.yml,
which runs sphinx-build on every push to docs/v1 and publishes
docs/_build/html to GitHub Pages at
https://leepusp.github.io/rotifer/. Nothing is committed: the
artifact is built fresh each time, which is why docs/_build/ and
docs/api/generated/ are both gitignored.
The hosted build does not pass -W, so a warning will not fail the
deploy the way make strict does locally.
Why are some pages Markdown and some reStructuredText?#
Both work. Markdown pages are parsed by MyST, which supports every
Sphinx directive through the {directive} fence syntax, so nothing
is lost by writing prose in Markdown. reStructuredText is used where
a page is mostly directives, such as docs/api/index.rst, where the
reST form is shorter. Pick whichever makes the page you are writing
easier to read.
Further reading#
This site is a fairly ordinary Sphinx project, so the upstream documentation answers anything not covered above.
Sphinx documentation, the starting point for how a build works.
The toctree directive, which defines the page hierarchy.
HTML configuration, including
html_theme_optionsandhtml_sidebars.autosummary and autodoc, which generate the API pages.
MyST parser, for the Markdown syntax used here.
numpydoc, for the docstring format.
Shibuya, the theme, for the options accepted by
html_theme_options.Publishing with GitHub Pages, for how
.github/workflows/docs.ymldeploys the site.