nominal-sphinx-theme
Nominal's look for Sphinx docs, based on the Shibuya theme
Install
uv add "nominal-sphinx-theme @ git+https://github.com/nominal-io/nominal-sphinx-theme"
# or: pip install git+https://github.com/nominal-io/nominal-sphinx-theme
Use
In conf.py:
from nominal_sphinx_theme import theme_options
extensions = [..., "nominal_sphinx_theme"]
html_theme = "shibuya"
html_theme_options = theme_options(
github_url="https://github.com/nominal-io/<repo>",
# optional: the project's own logo, shown after the Nominal logo
light_logo="_static/logo/<project>-black.svg",
dark_logo="_static/logo/<project>-white.svg",
# optional: header tabs; each link's folder is a section
nav_links=[
{"title": "Guides", "url": "index"},
{"title": "Examples", "url": "examples/index"},
],
)
Any other keyword to theme_options is passed through as a Shibuya option.
What goes in the theme
The theme holds what every repo using it shares, so a repo gets a change by bumping its pin:
- the look: the header, logo, palette, fonts, code highlighting and API page styling
- fixes to Shibuya and to the extensions repos share, such as MyST, sphinx-design and
sphinxcontrib-mermaid
- directives more than one repo uses, such as
{nominal-snippet}
- default Sphinx and MyST settings, which a repo's
conf.py can override
A repo keeps what only its own docs need: its pages, its logo, and styles and extensions for one
page or project. What exists only because of the docs hub, such as its landing page and the links
between its projects, stays in dev.nominal.io
(its README, "Theme or hub"). The theme knows the hub only by its URLs, nominal_hub_url and
nominal_docs_url.
When a second repo needs something one repo has, move it here rather than copy it. Don't override
the theme's templates or restyle its header in a repo; change them here.
Config
| Setting | Default | Effect |
|---|
nominal_hub_url | None | The docs hub's home page, where DEVELOPERS in the logo links. None = the docs hub's home page, one level up. Set to "https://dev.nominal.io/" for standalone sites. |
nominal_docs_url | "https://dev.nominal.io/" | Where DOCS in the logo links, in a new tab. |
nominal_hub_depth | 1 | How many folders the hub's home page is above the project's home, when nominal_hub_url is None. 0 for the hub's own home page. |
nominal_header_project | True | The project's logo or name after the Nominal logo. |
nominal_header_search | True | The search box in the header. |
nominal_header_buttons | ["product-guides", "request-demo", "open-app"] | The header's buttons to show. |
nominal_section_sidebar | True | Sidebar shows only the current tab's captioned toctrees. |
nominal_sidebar_open | None | Sidebar groups fold under their captions. See Folding sidebar groups. |
nominal_ga_id | "G-6KQ94CEW2M" | Google Analytics measurement ID, dev.nominal.io's by default. None turns analytics off. |
nominal_posthog_token | nominal.io's project token | PostHog project token. Pages report to nominal.io's PostHog project through its proxy, and a click on a link into the Nominal app is sent as outbound_link_clicked. A local preview, or a copy opened from disk, reports nothing. None turns PostHog off. |
nominal_scramble_output_ids | True when the CI environment variable is set, else False | Each UUID in an executed notebook's outputs becomes a stand-in derived from a hash of it, so pages don't publish the IDs of resources the build created. Code cells keep their values. A local build keeps the real IDs, so the links and copy buttons on its pages work; don't deploy it. Changing the value needs a full rebuild (sphinx-build -E). |
A project's own _static and _templates override the theme's files of the same name.
Defaults
The theme sets these Sphinx and MyST settings, which every repo using it had in its conf.py. A
setting in conf.py, or on the command line with -D, wins. The MyST ones apply only with
myst_parser in extensions.