◐ Shell
reader mode source ↗
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ classifiers = [
"Topic :: Documentation",
"Topic :: Software Development :: Documentation",
]
urls.Code = "https://github.com/python/python-docs-theme"
urls.Download = "https://pypi.org/project/python-docs-theme/"
urls.Homepage = "https://github.com/python/python-docs-theme/"
Expand Down
72 changes: 71 additions & 1 deletion python_docs_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,85 @@

import hashlib
import os
from functools import lru_cache
from pathlib import Path
from typing import Any

import sphinx.application
from sphinx.builders.html import StandaloneHTMLBuilder

THEME_PATH = Path(__file__).parent.resolve()


@lru_cache(maxsize=None)
def _asset_hash(path: str) -> str:
"""Append a `?digest=` to an url based on the file content."""
Expand Up @@ -56,6 +125,7 @@ def setup(app):
current_dir = os.path.abspath(os.path.dirname(__file__))
app.add_html_theme("python_docs_theme", current_dir)

app.connect("html-page-context", _html_page_context)

return {
131 changes: 131 additions & 0 deletions python_docs_theme/static/switchers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
Toggle all file notes Toggle all file annotations