Skip to content

Commit

Permalink
cmdref.py: Support autoref for 'help <cmd>'
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed May 27, 2024
1 parent d86bdaf commit f0cc487
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/util/cmdref.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,12 @@ class CellDomain(CommandDomain):
TagIndex
}

def autoref(name, rawtext, text, lineno, inliner: Inliner,
def autoref(name, rawtext: str, text: str, lineno, inliner: Inliner,
options=None, content=None):
role = 'cell:ref' if text[0] == '$' else 'cmd:ref'
if text.startswith("help ") and text.count(' ') == 1:
_, cmd = text.split(' ', 1)
text = f'{text} <{cmd}>'
return inliner.interpreted(rawtext, text, role, lineno)

def setup(app: Sphinx):
Expand Down

0 comments on commit f0cc487

Please sign in to comment.