escapingpython-sphinxrestructuredtextbackticks

How to escape the "`" backtick character in a .rst file?


I want to write the following sentence:

Don't forget to escape the :code:`\`` character, it will be interpreted as code mark

But I don't know how to escape the "`" backtick character. Is it even possible?


Solution

  • You cannot escape backticks within interpreted text, as backticks themselves define what gets interpreted.

    There are at least two options. The latter yields the same result as if you code use :code: with escaping the backtick.

    No formatting

    Don't forget to escape the \` character, it will be interpreted as code mark
    

    With formatting

    .. |bt| raw:: html
    
        <code class="code docutils literal notranslate">`</code>
    
    Don't forget to escape the |bt| character, it will be interpreted as code mark
    

    Above examples rendered

    rendered examples