Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f690fc8

Browse files
committed
Render default values in :rc: directive as literal
1 parent dc5fb0e commit f690fc8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

doc/sphinxext/custom_roles.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
1717
ref = nodes.reference(rawtext, rendered, refuri=refuri)
1818
node_list = [nodes.literal('', '', ref)]
1919
if text in rcParamsDefault:
20-
node_list.append(nodes.Text(f' (default: {rcParamsDefault[text]!r})'))
20+
node_list.extend([
21+
nodes.Text(' (default: '),
22+
nodes.literal('', repr(rcParamsDefault[text])),
23+
nodes.Text(')'),
24+
])
2125
return node_list, []
2226

2327

0 commit comments

Comments
 (0)