使用Sphinx / rst标记安全部分

时间:2016-08-12 22:22:35

标签: python-sphinx restructuredtext docutils

如何使用Sphinx / rst成功安全部分标记段落?

(U) This is a portion marked heading
------------------------------------

(U) This is a portion marked sentence that renders not what I'd expect.

(U) This too is portion marked, and renders unexpectedly.

(U) This too is portion marked, but it does render fine when another sentence is placed directly below.
Next sentence.

渲染时(见下文),标题看起来不错,但句子看起来像一个列表。由于对使用()字符的部分标记信息有严格要求,因此使用替换/替换指令不是可接受的解决方案。

渲染输出:

(U) This is a portion marked heading

  U. This is a portion marked sentence that renders not what I'd expect.

  U. This too is portion marked, and renders unexpectedly.

(U) This too is portion marked, but it does render fine when another sentence is placed directly below. Next sentence.

1 个答案:

答案 0 :(得分:0)

这一行,

(U) This is a portion marked sentence

被解释为枚举列表中的项,其中(U)是括号括起来的枚举器。

http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#enumerated-lists。这里说:

  

如果单行段落以与枚举器相同的文本开头(“A。”,“1。”,“(b)”,“I)”等,则第一个字符必须被转义为了将该行解析为普通段落:

因此(U)前面的反斜杠会使该行显示为普通段落:

\(U) This is a portion marked sentence