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

1

6

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?

Unlash answered 2/3, 2021 at 8:3 Comment(1)
This seems to be impossible, which does not surprise me based on my generally terrible experience with RST. I would recommend Asciidoc or Djot instead. I've used Asciidoc and it is much saner than RST. I haven't used Djot but it looks nice too.Tatty
K
6

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

Kasiekask answered 5/3, 2021 at 9:58 Comment(1)
Note that raw:: html will not show up in PDF (and other non-HTML) versions of the doc.Traps

© 2022 - 2024 — McMap. All rights reserved.