Skip to content

Commit faa33a5

Browse files
[docs] Clarify how to escape curly braces in samp text (#11987)
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent f4eea66 commit faa33a5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/usage/restructuredtext/roles.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ different style:
240240
:rst:role:`code` role instead.
241241

242242
.. versionchanged:: 1.8
243-
Allowed to escape curly braces with backslash
243+
Allowed to escape curly braces with double backslash. For example, in
244+
``:samp:`print(f"answer=\\{1+{variable}*2\\}")```, the part ``variable``
245+
would be emphasized and the escaped curly braces would be displayed:
246+
:samp:`print(f"answer=\\{1+{variable}*2\\}")`
244247

245248
There is also an :rst:role:`index` role to generate index entries.
246249

0 commit comments

Comments
 (0)