Skip to content

Commit

Permalink
Restore anchor links to top of module docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Sep 27, 2022
1 parent 89b4f14 commit 635540c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sphinx/domains/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def run(self) -> List[Node]:
content_node.document = self.state.document
nested_parse_with_titles(self.state, self.content, content_node)

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

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

def make_old_id(self, modname: str) -> str:
Expand Down
3 changes: 2 additions & 1 deletion sphinx/domains/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def run(self) -> List[Node]:
content_node.document = self.state.document
nested_parse_with_titles(self.state, self.content, content_node)

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

def make_old_id(self, name: str) -> str:
Expand Down

0 comments on commit 635540c

Please sign in to comment.