RestructuredText 文档中的行间距不一致 [英] Inconsistent line spacing in RestructuredText document

查看:50
本文介绍了RestructuredText 文档中的行间距不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

罗伯特

解决方案

这是docutils 的一个众所周知的问题,Sphinx 是基于该库构建的.

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

<块引用>

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

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

标记.>

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

来源:Spinx-Doc/Sphinx #2258 - 列表项内的嵌套字段列表导致HTML 输出中不需要的空间

<小时>

查看相关问题:

I'm build RST files for my company's documentation. One irritating thing is that enumerated lists don't seem to have any consistency in terms of line spacing.

Is there a simple way to solve this?

Robert

解决方案

It's a well known problem of docutils, the library on which Sphinx is built.

From Sphinx issue tracker on GitHub:

tk0miya wrote:
In my short investigation:

The behavior comes from docutils (base library of Sphinx). In docutils.writers.html4css1.HTMLTranslator, docutils generates <p> tag if list includes any items excepting paragraphs and nested lists.

To fix this, set self.compact_simple in visit_list_item instead of visit_bullet_list and visit_enumerated_list. But we have to know why docutils check whole of list.

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


See related issues:

这篇关于RestructuredText 文档中的行间距不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆