Skip to content

Commit

Permalink
Highlight :rc: category instead of full name
Browse files Browse the repository at this point in the history
  • Loading branch information
lukelbd committed Sep 16, 2019
1 parent 6f9f0d0 commit 279ec35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/sphinxext/custom_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def rc_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
relsource = source.split('/docs/', 1)
if len(relsource) == 1:
return [], []
cat = text.split('.')[0] # show category because there are issues highlighting dots
levels = relsource[1].count('/') # distance to 'docs' folder
refuri = ('../' * levels +
f'en/latest/rctools.html?highlight={text}#proplotrc-file')
f'en/latest/rctools.html?highlight={cat}#proplotrc-file')

ref = nodes.reference(rawtext, rendered, refuri=refuri)
node_list = [nodes.literal('', '', ref)]
Expand Down

0 comments on commit 279ec35

Please sign in to comment.