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

Skip to content

Commit 01fa5db

Browse files
authored
Merge pull request #15721 from timhoffm/rc-default-literal
DOC: Render default values in :rc: directive as literal
2 parents b91a12c + f690fc8 commit 01fa5db

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)