Skip to content

Commit 635540c

Browse files
committed
Restore anchor links to top of module docstring
1 parent 89b4f14 commit 635540c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sphinx/domains/javascript.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def run(self) -> List[Node]:
298298
content_node.document = self.state.document
299299
nested_parse_with_titles(self.state, self.content, content_node)
300300

301-
ret: List[Node] = [*content_node.children]
301+
ret: List[Node] = []
302302
if not noindex:
303303
domain = cast(JavaScriptDomain, self.env.get_domain('js'))
304304

@@ -315,6 +315,7 @@ def run(self) -> List[Node]:
315315
indextext = _('%s (module)') % mod_name
316316
inode = addnodes.index(entries=[('single', indextext, node_id, '', None)])
317317
ret.append(inode)
318+
ret.extend(content_node.children)
318319
return ret
319320

320321
def make_old_id(self, modname: str) -> str:

sphinx/domains/python.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ def run(self) -> List[Node]:
10241024
content_node.document = self.state.document
10251025
nested_parse_with_titles(self.state, self.content, content_node)
10261026

1027-
ret: List[Node] = [*content_node.children]
1027+
ret: List[Node] = []
10281028
if not noindex:
10291029
# note module to the domain
10301030
node_id = make_id(self.env, self.state.document, 'module', modname)
@@ -1045,6 +1045,7 @@ def run(self) -> List[Node]:
10451045
indextext = '%s; %s' % (pairindextypes['module'], modname)
10461046
inode = addnodes.index(entries=[('pair', indextext, node_id, '', None)])
10471047
ret.append(inode)
1048+
ret.extend(content_node.children)
10481049
return ret
10491050

10501051
def make_old_id(self, name: str) -> str:

0 commit comments

Comments
 (0)