Skip to content

Commit 4ee6da0

Browse files
authored
Another attempt at circumventing the pydata theme hack (#71)
1 parent c1a5e37 commit 4ee6da0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ __pycache__/
33
_version.py
44
/build/
55
/dist/
6+
/.python-version
67

78
# Testing
89
/.coverage

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ test = [
3131
]
3232
doc = [
3333
'scanpydoc[typehints]',
34+
'sphinx<7', # https://github.com/readthedocs/sphinx_rtd_theme/issues/1463
3435
'sphinx-rtd-theme',
3536
]
3637
typehints = ['sphinx-autodoc-typehints>=1.15.2']

src/scanpydoc/definition_list_typed_field.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def make_refs(role_name, name, node):
4848
def handle_item(
4949
fieldarg: str, content: list[nodes.inline]
5050
) -> nodes.definition_list_item:
51-
head = nodes.term()
51+
head = nodes.inline()
5252
head += make_refs(self.rolename, fieldarg, addnodes.literal_strong)
5353
field_type = types.pop(fieldarg, None)
5454
if field_type is not None:
@@ -61,15 +61,16 @@ def handle_item(
6161
else:
6262
head += field_type
6363

64+
# Contents are wrapped into a span for pydata sphinx theme
65+
head_wrap = nodes.term("", "", head)
6466
body_content = nodes.paragraph("", "", *content)
6567
body = nodes.definition("", body_content)
6668

67-
return nodes.definition_list_item("", head, body)
69+
return nodes.definition_list_item("", head_wrap, body)
6870

6971
field_name = nodes.field_name("", self.label)
7072
assert not self.can_collapse
71-
# “field-list” for pydata sphinx theme
72-
body_node = self.list_type(classes=["field-list"])
73+
body_node = self.list_type(classes=["simple"])
7374
for field_arg, content in items:
7475
body_node += handle_item(field_arg, content)
7576
field_body = nodes.field_body("", body_node)

0 commit comments

Comments
 (0)