【问题标题】:Inconsistent line spacing in RestructuredText documentRestructuredText 文档中的行距不一致
【发布时间】:2018-04-06 20:22:01
【问题描述】:

我正在为我公司的文档构建 RST 文件。一件恼人的事情是枚举列表在行距方面似乎没有任何一致性。

有没有简单的方法来解决这个问题?

罗伯特

【问题讨论】:

标签: python-sphinx restructuredtext


【解决方案1】:

我不确定如何应用 Paebbels 的答案,但是通过将此行添加到我的 conf.py 来更改为 html4 编写器,我能够摆脱 <p> 标记。

html4_writer = true

这显然将其更改为 html4 编写器,因此您需要确定这是否可以接受。

【讨论】:

    【解决方案2】:

    这是 docutils 的一个众所周知的问题,Sphinx 是在该库上构建的。

    来自 GitHub 上的 Sphinx 问题跟踪器:

    tk0miya 写道:
    在我的简短调查中:

    该行为来自docutils(Sphinx 的基础库)。 在docutils.writers.html4css1.HTMLTranslator 中,如果列表包含除段落和嵌套列表之外的任何项目,docutils 将生成<p> 标记。

    要解决此问题,请将 self.compact_simple 设置为 visit_list_item 而不是 visit_bullet_listvisit_enumerated_list。 但是我们必须知道为什么 docutils 会检查整个列表。

    来源:Spinx-Doc/Sphinx #2258 - Nested field lists inside list items cause unwanted space in HTML output


    查看相关问题:

    【讨论】:

      猜你喜欢
      • 2014-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      相关资源
      最近更新 更多