如何在.rst文件中转义"`"反引号字符?

6

我想写下以下句子:

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

但我不知道如何转义反引号 "`" 字符。这是否可能呢?


这似乎是不可能的,这并不让我感到惊讶,因为我在使用RST时的经验通常都很糟糕。我建议使用Asciidoc或Djot代替。我已经使用过Asciidoc了,它比RST要好得多。我没有使用过Djot,但它看起来也很不错。 - Timmmm
1个回答

5

在解释文本中,你无法避免反引号的使用,因为反引号本身定义了需要被解释的内容。

至少有两个选项。后一个选项与使用:code:并转义反引号的结果相同。

不进行格式化

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

带格式的文字

.. |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

上述例子的渲染结果

渲染的例子


请注意,raw:: html 不会在 PDF(和其他非 HTML)版本的文档中显示。 - Petr Viktorin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接