[docs] Clarify how to escape curly braces in `samp` text (#11987)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Demetrios Koziris
2024-02-22 00:48:12 -08:00
committed by GitHub
parent f4eea669e0
commit faa33a53a3

View File

@@ -240,7 +240,10 @@ different style:
:rst:role:`code` role instead.
.. versionchanged:: 1.8
Allowed to escape curly braces with backslash
Allowed to escape curly braces with double backslash. For example, in
``:samp:`print(f"answer=\\{1+{variable}*2\\}")```, the part ``variable``
would be emphasized and the escaped curly braces would be displayed:
:samp:`print(f"answer=\\{1+{variable}*2\\}")`
There is also an :rst:role:`index` role to generate index entries.