我想写下面这句话:
Don't forget to escape the :code:`\`` character, it will be interpreted as code mark
但我不知道如何转义“`
”反引号字符。甚至有可能吗?
答案 0 :(得分:2)
您无法在解释文本中转义反引号,因为反引号本身定义了要解释的内容。
至少有两个选择。后者产生的结果与使用 :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
答案 1 :(得分:0)
一对反引号定义解释文本:
<块引用>Doctree 元素:取决于显式或隐式角色和处理。
开始字符串 = 结束字符串 = "`"。
解释文本是指旨在相关、编入索引、链接、汇总或以其他方式处理的文本,但文本本身通常是单独留下的。解释的文本用单个反引号字符括起来:
这是interpreted text
。
问题中名为 :code:
的特定角色。需要注意的是,解释文本的处理方式取决于它所伴随的特定角色(角色可以是一般的 reST 或 Sphinx 特定的)。
解释文本的“角色”决定了文本的解释方式。 (...) 角色标记是解释文本的前缀或后缀
:role:`interpreted text`
`interpreted text`:role:
因为Interpreted Text有一个值得注意的特性,它对应的Doctree元素取决于角色:
<块引用>Doctree 元素:取决于显式或隐式的角色和处理
在 reST 中转义的一般规则在 Escaping Mechanism 中给出,它仅由使用 \
反冲字符组成。然而,这也有更广泛的影响,请参阅其余的 Inline Markup recognition rules。
在Inline Markup和Escaping with Backslashes中给出了一个方便的总结 - Quick reStructuredText reStructuredText 的备忘单。