Robert_LY
Robert_LY

Reputation: 651

Inconsistent line spacing in RestructuredText document

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

Upvotes: 4

Views: 1500

Answers (2)

Pierce Devol
Pierce Devol

Reputation: 125

I'm unsure how to apply Paebbels answer, however I was able to get rid of the <p> tags by changing to the html4 writer by adding this line to my conf.py.

html4_writer = true

This obviously changes it to the html4 writer, so you'll need to determine whether this is acceptable or not.

Upvotes: 1

Paebbels
Paebbels

Reputation: 16249

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:

Upvotes: 2

Related Questions