Skip to content

Commit 946d159

Browse files
authored
Merge pull request #310 from rtibblesbot/issue-309-aac38f
fix: restore jQuery/search on ReadTheDocs by removing deprecated Sphinx config
2 parents 5fae247 + b4e0a57 commit 946d159

4 files changed

Lines changed: 15 additions & 39 deletions

File tree

.github/workflows/check-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install uv
3030
uses: astral-sh/setup-uv@v7
3131
with:
32-
python-version: 3.9
32+
python-version: "3.10"
3333
activate-environment: "true"
3434
enable-cache: "true"
3535
- name: Install dependencies

docs/conf.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import sys
1818

1919
import django
20-
import sphinx_rtd_theme
2120
from django.utils.encoding import force_text
2221
from django.utils.html import strip_tags
2322

@@ -51,7 +50,8 @@
5150
files.FileDescriptor.__get__ = lambda *args: None
5251

5352

54-
# Auto list fields from django models - from https://djangosnippets.org/snippets/2533/#c5977
53+
# Auto list fields from django models
54+
# from https://djangosnippets.org/snippets/2533/#c5977
5555
def process_docstring(app, what, name, obj, options, lines):
5656
# This causes import errors if left outside the function
5757
from django.db import models
@@ -62,7 +62,8 @@ def process_docstring(app, what, name, obj, options, lines):
6262
fields = obj._meta.get_fields()
6363

6464
for field in fields:
65-
# Skip ManyToOneRel and ManyToManyRel fields which have no 'verbose_name' or 'help_text'
65+
# Skip ManyToOneRel and ManyToManyRel fields
66+
# which have no 'verbose_name' or 'help_text'
6667
if not hasattr(field, 'verbose_name'):
6768
continue
6869

@@ -85,9 +86,15 @@ def process_docstring(app, what, name, obj, options, lines):
8586
# Add the field's type to the docstring
8687
if isinstance(field, models.ForeignKey):
8788
to = field.remote_field.model
88-
lines.append(u':type %s: %s to :class:`~%s`' % (field.attname, type(field).__name__, to))
89+
lines.append(
90+
u':type %s: %s to :class:`~%s`'
91+
% (field.attname, type(field).__name__, to)
92+
)
8993
else:
90-
lines.append(u':type %s: %s' % (field.attname, type(field).__name__))
94+
lines.append(
95+
u':type %s: %s'
96+
% (field.attname, type(field).__name__)
97+
)
9198

9299
return lines
93100

@@ -96,14 +103,14 @@ def process_docstring(app, what, name, obj, options, lines):
96103

97104
# Add any Sphinx extension module names here, as strings. They can be
98105
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
99-
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "m2r"]
106+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
100107

101108
# Add any paths that contain templates here, relative to this directory.
102109
templates_path = ['_templates']
103110

104111
# The suffix(es) of source filenames.
105112
# You can specify multiple suffix as a list of string:
106-
source_suffix = [".rst", ".md"]
113+
source_suffix = [".rst"]
107114

108115
# The master toctree document.
109116
master_doc = 'index'
@@ -168,18 +175,11 @@ def process_docstring(app, what, name, obj, options, lines):
168175
# html_theme = 'default'
169176

170177
html_theme = "sphinx_rtd_theme"
171-
html_theme_path = [".", sphinx_rtd_theme.get_html_theme_path()]
172178

173179

174-
# Approach 2 for custom stylesheet:
175-
# adapted from: http://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html
176-
# and https://github.com/altair-viz/altair/pull/418/files
177-
# https://github.com/rtfd/sphinx_rtd_theme/issues/117
178180
def setup(app):
179181
# Register the docstring processor with sphinx
180182
app.connect("autodoc-process-docstring", process_docstring)
181-
# Add our custom CSS overrides
182-
app.add_css_file("theme_overrides.css")
183183

184184

185185
# Theme options are theme-specific and customize the look and feel of a

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ docs = [
6060
"sphinx-rtd-theme",
6161
"sphinx-autobuild",
6262
"watchdog",
63-
"m2r",
6463
"sphinx-notfound-page",
6564
"django==3.2.25",
6665
"djangorestframework==3.14.0",

uv.lock

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)