zulip/docs/conf.py
Alex Vandiver 430536ad47 docs: Automatically generate labels.
MyST automatically generates header anchors, but does not generates
Sphinx labels.  This means that they cannot be used for cross-project
linking.

Turn on Sphinx's auto-generated labels for the first two levels.
Unlike heading anchors, labels do not append, e.g., `-1` for
uniqueness, and instead generate warnings.  Tweak one title, and
suppress one warning accordingly.
2025-12-12 09:15:36 -08:00

65 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# For documentation on Sphinx configuration options, see:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# https://myst-parser.readthedocs.io/en/latest/sphinx/reference.html
# https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html
# https://sphinx-design.readthedocs.io/en/latest/tabs.html
import os
import sys
from typing import Any
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from version import LATEST_RELEASE_VERSION, ZULIP_VERSION
on_rtd = os.environ.get("READTHEDOCS") == "True"
# General configuration
extensions = [
"sphinx.ext.autosectionlabel",
"myst_parser",
"sphinx_rtd_theme",
"sphinx_design",
]
templates_path = ["_templates"]
project = "Zulip"
copyright = "20122015 Dropbox, Inc., 20152021 Kandra Labs, Inc., and contributors"
author = "The Zulip Team"
version = ZULIP_VERSION
release = ZULIP_VERSION
exclude_patterns = ["_build", "README.md"]
suppress_warnings = [
"myst.header",
"autosectionlabel.git/terminology", # HEAD vs head
]
pygments_style = "sphinx"
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 2
# Options for Markdown parser
myst_enable_extensions = [
"colon_fence",
"substitution",
]
myst_heading_anchors = 6
myst_substitutions = {
"LATEST_RELEASE_VERSION": LATEST_RELEASE_VERSION,
}
# Options for HTML output
html_theme = "sphinx_rtd_theme"
html_theme_options = {
"collapse_navigation": not on_rtd, # makes local builds much faster
"logo_only": True,
}
html_logo = "images/zulip-logo.svg"
html_static_path = ["_static"]
def setup(app: Any) -> None:
# overrides for wide tables in RTD theme
app.add_css_file("theme_overrides.css") # path relative to _static