[docs] [issue32523] inconsistent spacing in changelog.html

Julien Palard report at bugs.python.org
Mon Jun 4 17:42:47 EDT 2018

Julien Palard <julien+python at palard.fr> added the comment:

It's from docutils (see details below), it can be fixed in pydoctheme.css by adding something like:

li p {
    margin-bottom: 0;

Would look like: https://mdk.fr/list-before.pnghttps://mdk.fr/list-after.png is it better? (If it's better I still have to ensure this rule won't break something else in another place.)

For more information I quote here the docstring of `class HTMLTranslator`:

The html4css1 writer has been optimized to produce visually compact
lists (less vertical whitespace).  HTML's mixed content models
allow list items to contain "<li><p>body elements</p></li>" or
"<li>just text</li>" or even "<li>text<p>and body
elements</p>combined</li>", each with different effects.  It would
be best to stick with strict body elements in list items, but they
affect vertical spacing in older browsers (although they really
The html5_polyglot writer solves this using CSS2.

Here is an outline of the optimization:

- Check for and omit <p> tags in "simple" lists: list items
  contain either a single paragraph, a nested simple list, or a
  paragraph followed by a nested simple list.  This means that
  this list can be compact:

      - Item 1.
      - Item 2.

  But this list cannot be compact:

      - Item 1.

        This second paragraph forces space between list items.

      - Item 2.

- In non-list contexts, omit <p> tags on a paragraph if that
  paragraph is the only child of its parent (footnotes & citations
  are allowed a label first).

- Regardless of the above, in definitions, table cells, field bodies,
  option descriptions, and list items, mark the first child with
  'class="first"' and the last child with 'class="last"'.  The stylesheet
  sets the margins (top & bottom respectively) to 0 for these elements.


Python tracker <report at bugs.python.org>

More information about the docs mailing list