How to edit and build the documentation#

The Sphinx source for this site lives in docs/source/. Build output goes to docs/build/html/ (gitignored).

Build locally#

From the repository root:

cd docs
make html

That produces docs/build/html/index.html, which you can open in a browser:

xdg-open docs/build/html/index.html      # Linux
open docs/build/html/index.html          # macOS

For a full rebuild (also clears the auto-generated api/ tree):

make clean
make html

Build dependencies#

You need the [doc] optional dependencies installed:

pip install -e .[doc]      # docs-only
pip install -e .[all]      # docs + dev

This pulls in sphinx, myst_parser, sphinx-autoapi, sphinx-copybutton, sphinx-design, sphinx-tabs, pydata-sphinx-theme, and a few support libraries.

Source format#

Pages may be Markdown (.md, the default) or reStructuredText (.rst). Most new pages should be Markdown. Inside .md files, MyST extensions are enabled:

  • colon_fence:::{note}::: as an alternative to triple-backtick directives.

  • deflist – term / definition lists.

  • tasklist – GitHub-style - [ ] and - [x].

  • linkify – bare URLs auto-link.

  • attrs_inline / attrs_block{.class #id} attributes.

  • dollarmath$inline$ and $$display$$ LaTeX math.

Where to add a new page#

The docs follow the Diátaxis structure:

  • tutorials/ – learning-oriented walkthroughs.

  • how_to/ – task-oriented recipes (this very page).

  • reference/ – information-oriented lookup.

  • explanation/ – understanding-oriented background.

Add your new .md file to the appropriate directory and add an entry under the section’s toctree in <section>/index.md. Sphinx will warn if a file is not reachable from any toctree.

API reference#

docs/source/api/ is generated at build time by sphinx-autoapi from src/id3c/. Do not edit it; do not commit it. If you add a new Python module under src/id3c/, the next make html will pick it up automatically.

To skip API generation while iterating on prose docs:

SPHINXOPTS="-D extensions=sphinx.ext.autodoc,myst_parser,sphinx_copybutton,sphinx_design,sphinx_tabs.tabs" make html

(Remove autoapi.extension from the extension list. Useful when prose changes alone are being previewed and you do not want the ~10 s API parsing step.)

Cross-references#

Markdown cross-references between pages use the standard MyST syntax:

See [How to add a device](add_a_device.md) for details.

To reference a Sphinx target (e.g. a function in the auto-generated API):

See {func}`id3c.devices.laser_optics.LaserOptics.move_out`.

To reference a section heading on another page:

See [the cross-walk table](../tutorials/spec_to_bluesky.md#command-cross-walk).

Diagrams and images#

Place image files under docs/source/_static/. Reference them with standard Markdown:

![diagram](../_static/my_diagram.png)

For diagrams generated as code, use sphinx-design’s tabs and mermaid (not currently enabled; add to conf.py’s extensions list if you need it).

Style guidelines#

  • New pages default to .md. Use .rst only when a feature genuinely needs it.

  • Keep code examples short and runnable. If an example needs a device that does not exist yet, mark it clearly.

  • Prefer the RE(plan(...)) invocation pattern in all examples; see AGENTS.md > Plan invocation pattern.

  • Use a single-line heading-1 title at the top of every page (# Title). The pydata theme picks this up for the page .</p></li> </ul> </section> <section id="ci"> <h2>CI<a class="headerlink" href="#ci" title="Link to this heading">#</a></h2> <p>Pushes to <code class="docutils literal notranslate"><span class="pre">main</span></code> and pull requests trigger a docs build via <code class="docutils literal notranslate"><span class="pre">.github/workflows/docs.yml</span></code>. The build is <strong>advisory</strong> – a failure shows on the PR but does not block merging. Successful builds on <code class="docutils literal notranslate"><span class="pre">main</span></code> are deployed to the <code class="docutils literal notranslate"><span class="pre">gh-pages</span></code> branch.</p> </section> <section id="see-also"> <h2>See also<a class="headerlink" href="#see-also" title="Link to this heading">#</a></h2> <ul class="simple"> <li><p><a class="reference external" href="https://www.sphinx-doc.org/">Sphinx documentation</a>.</p></li> <li><p><a class="reference external" href="https://myst-parser.readthedocs.io/">MyST Markdown reference</a>.</p></li> <li><p><a class="reference external" href="https://diataxis.fr/">Diátaxis framework</a> – the four-quadrant doc structure used here.</p></li> </ul> </section> </section> </article> <footer class="prev-next-footer d-print-none"> <div class="prev-next-area"> <a class="left-prev" href="add_a_plan.html" title="previous page"> <i class="fa-solid fa-angle-left"></i> <div class="prev-next-info"> <p class="prev-next-subtitle">previous</p> <p class="prev-next-title">How to add a new plan</p> </div> </a> <a class="right-next" href="../reference/index.html" title="next page"> <div class="prev-next-info"> <p class="prev-next-subtitle">next</p> <p class="prev-next-title">Reference</p> </div> <i class="fa-solid fa-angle-right"></i> </a> </div> </footer> </div> <dialog id="pst-secondary-sidebar-modal"></dialog> <div id="pst-secondary-sidebar" class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner"> <div class="sidebar-secondary-item"> <div id="pst-page-navigation-heading-2" class="page-toc tocsection onthispage"> <i class="fa-solid fa-list"></i> On this page </div> <nav id="pst-page-toc-nav" class="page-toc" aria-labelledby="pst-page-navigation-heading-2"> <ul class="pst-show_toc_level nav section-nav flex-column"> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#build-locally">Build locally</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#build-dependencies">Build dependencies</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#source-format">Source format</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#where-to-add-a-new-page">Where to add a new page</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#api-reference">API reference</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#cross-references">Cross-references</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#diagrams-and-images">Diagrams and images</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#style-guidelines">Style guidelines</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#ci">CI</a></li> <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#see-also">See also</a></li> </ul> </nav></div> <div class="sidebar-secondary-item"> <div class="tocsection editthispage"> <a href="https://github.com/BCDA-APS/3idc-bits/edit/main/docs/source/how_to/edit_and_build_docs.md"> <i class="fa-solid fa-pencil"></i> Edit on GitHub </a> </div> </div> <div class="sidebar-secondary-item"> <div class="tocsection sourcelink"> <a href="../_sources/how_to/edit_and_build_docs.md.txt"> <i class="fa-solid fa-file-lines"></i> Show Source </a> </div> </div> </div></div> </div> <footer class="bd-footer-content"> </footer> </main> </div> </div> <!-- Scripts loaded after <body> so the DOM is not blocked --> <script defer src="../_static/scripts/bootstrap.js?digest=0790524f97105ba85085"></script> <script defer src="../_static/scripts/pydata-sphinx-theme.js?digest=0790524f97105ba85085"></script> <footer class="bd-footer"> <div class="bd-footer__inner bd-page-width"> <div class="footer-items__start"> <div class="footer-item"> <p class="copyright"> © Copyright 2014-2026, APS. <br/> </p> </div> <div class="footer-item"> <p class="sphinx-version"> Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 9.0.4. <br/> </p> </div> </div> <div class="footer-items__end"> <div class="footer-item"> <p class="theme-version"> <!-- # L10n: Setting the PST URL as an argument as this does not need to be localized --> Built with the <a href="https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html">PyData Sphinx Theme</a> 0.18.0. </p></div> </div> </div> </footer> </body> </html>