Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.highlight .go {
color: #707070;
}

/* Let the sidebar scroll past the last entry. */
.sidebar-tree {
padding-bottom: 8rem;
}
29 changes: 29 additions & 0 deletions docs/_templates/components/edit-this-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends "!components/edit-this-page.html" %}

{#- Add a repo link next to the view/edit icons at the top of the page, using
furo's `source_repository` option. Reuses furo's `.muted-link` styling so it
matches and stays responsive. -#}
{%- macro furo_github_button() -%}
{%- if theme_source_repository -%}
<div class="github-this-page">
<a class="muted-link" href="{{ theme_source_repository }}"
title="{{ _("View on GitHub") }}">
<svg viewBox="0 0 16 16" stroke="currentColor" fill="currentColor" stroke-width="0"
style="height: 1.25rem; width: 1.25rem;" aria-hidden="true">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
</svg>
<span class="visually-hidden">{{ _("View on GitHub") }}</span>
</a>
</div>
{%- endif -%}
{%- endmacro -%}

{% block link_available -%}
{{ super() }}
{{ furo_github_button() }}
{%- endblock %}

{% block link_not_available -%}
{{ super() }}
{{ furo_github_button() }}
{%- endblock %}
65 changes: 40 additions & 25 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,29 @@
extensions = [
"breathe",
"myst_parser",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx_llm.txt",
"sphinxcontrib.rsvgconverter",
"sphinxcontrib.moderncmakedomain",
]

intersphinx_mapping = {
"cmake": ("https://cmake.org/cmake/help/latest/", None),
"python": ("https://docs.python.org/3", None),
}

# sphinx-llm relays the markdown builder's warnings for nodes it can't render.
llms_txt_suppress_unknown_node_warnings = True
# Both builders run doxygen into the same XML directory.
llms_txt_build_parallel = False

breathe_projects = {"pybind11": ".build/doxygenxml/"}
breathe_default_project = "pybind11"
breathe_domain_by_extension = {"h": "cpp"}

# Add any paths that contain templates here, relative to this directory.
templates_path = [".templates"]
templates_path = ["_templates"]

# The suffix(es) of source filenames.
source_suffix = [".rst", ".md"]
Expand Down Expand Up @@ -132,7 +144,25 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
html_theme_options = {
"source_repository": "https://github.com/pybind/pybind11",
"source_branch": "master",
"source_directory": "docs/",
"footer_icons": [
{
"name": "GitHub",
"url": "https://github.com/pybind/pybind11",
"html": """
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
</svg>
""",
"class": "",
},
],
}
html_copy_source = False
html_show_sourcelink = False

# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
Expand Down Expand Up @@ -191,9 +221,6 @@
# If true, the index is split into individual pages for each letter.
# html_split_index = False

# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True

Expand Down Expand Up @@ -339,31 +366,19 @@ def generate_doxygen_xml(app):
sys.stderr.write(f"doxygen execution failed: {e}\n")


def prepare(app):
with open(DIR.parent / "README.rst") as f:
contents = f.read()
def prepare_readme(app, relative_path, parent_docname, content): # noqa: ARG001
if app.builder.name != "latex" or relative_path.name != "README.rst":
return

if app.builder.name == "latex":
# Remove badges and stuff from start
contents = contents[contents.find(r".. start") :]
# Remove badges and stuff from start
contents = content[0][content[0].find(".. start") :]

# Filter out section titles for index.rst for LaTeX
contents = re.sub(r"^(.*)\n[-~]{3,}$", r"**\1**", contents, flags=re.MULTILINE)

with open(DIR / "readme.rst", "w") as f:
f.write(contents)


def clean_up(app, exception): # noqa: ARG001
(DIR / "readme.rst").unlink()
# Filter out section titles for index.rst for LaTeX
content[0] = re.sub(r"^(.*)\n[-~]{3,}$", r"**\1**", contents, flags=re.MULTILINE)


def setup(app):
# Add hook for building doxygen xml when needed
app.connect("builder-inited", generate_doxygen_xml)

# Copy the readme in
app.connect("builder-inited", prepare)

# Clean up the generated readme
app.connect("build-finished", clean_up)
app.connect("include-read", prepare_readme)
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Intro
=====

.. include:: readme.rst
.. include:: ../README.rst

.. only:: not latex

Expand Down
1 change: 1 addition & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ furo
myst_parser
sphinx
sphinx-copybutton
sphinx-llm
sphinxcontrib-moderncmakedomain
sphinxcontrib-svg2pdfconverter
29 changes: 21 additions & 8 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# This file was autogenerated by uv via the following command:
# uv pip compile docs/requirements.in -o docs/requirements.txt
accessible-pygments==0.0.5
# via furo
alabaster==0.7.16
# via sphinx
babel==2.14.0
# via sphinx
beautifulsoup4==4.12.3
# via furo
breathe==4.35.0
# via -r requirements.in
# via -r docs/requirements.in
certifi==2026.10.19
# via requests
charset-normalizer==3.3.2
Expand All @@ -17,8 +19,9 @@ docutils==0.20.1
# breathe
# myst-parser
# sphinx
furo==2024.1.29
# via -r requirements.in
# sphinx-markdown-builder
furo==2025.12.19
# via -r docs/requirements.in
idna==3.15
# via requests
imagesize==1.4.1
Expand All @@ -31,18 +34,20 @@ markdown-it-py==3.0.0
# via
# mdit-py-plugins
# myst-parser
# sphinx-llm
markupsafe==2.1.5
# via jinja2
mdit-py-plugins==0.4.2
# via myst-parser
mdurl==0.1.2
# via markdown-it-py
myst-parser==3.0.1
# via -r requirements.in
# via -r docs/requirements.in
packaging==24.0
# via sphinx
pygments==2.20.0
# via
# accessible-pygments
# furo
# sphinx
pyyaml==6.0.2
Expand All @@ -55,18 +60,24 @@ soupsieve==4.0
# via beautifulsoup4
sphinx==7.2.6
# via
# -r requirements.in
# -r docs/requirements.in
# breathe
# furo
# myst-parser
# sphinx-basic-ng
# sphinx-copybutton
# sphinx-llm
# sphinx-markdown-builder
# sphinxcontrib-moderncmakedomain
# sphinxcontrib-svg2pdfconverter
sphinx-basic-ng==1.0.0b2
# via furo
sphinx-copybutton==0.5.2
# via -r requirements.in
# via -r docs/requirements.in
sphinx-llm==1.1.0
# via -r docs/requirements.in
sphinx-markdown-builder==0.6.11
# via sphinx-llm
sphinxcontrib-applehelp==1.0.8
# via sphinx
sphinxcontrib-devhelp==1.0.6
Expand All @@ -76,12 +87,14 @@ sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-moderncmakedomain==3.27.0
# via -r requirements.in
# via -r docs/requirements.in
sphinxcontrib-qthelp==1.0.7
# via sphinx
sphinxcontrib-serializinghtml==1.1.10
# via sphinx
sphinxcontrib-svg2pdfconverter==1.2.2
# via -r requirements.in
# via -r docs/requirements.in
tabulate==0.10.0
# via sphinx-markdown-builder
urllib3==2.8.0
# via requests
Loading