Skip to content

Commit

Permalink
Add complex list margins, use margin-less items for ul.simple margins
Browse files Browse the repository at this point in the history
0.5.0 was moving in the direction of treating everything like a simple
list. 0.4.3 had some bugs that made complex lists look closer to the
spacing that complex lists use. This resolves both and adds specific
item margins for both cases.

See https://docutils.sourceforge.io/sandbox/html4strict/data/simple-lists.html
  • Loading branch information
agjohnson committed Jun 16, 2020
1 parent d85f8f8 commit aa0a108
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
22 changes: 22 additions & 0 deletions docs/demo/lists_tables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,28 @@ Field list
Bullet Lists
------------

..
Docutils supports two types of lists, "simple" and "complex". Complex lists
have item margins, simple lists do not.
https://docutils.sourceforge.io/sandbox/html4strict/data/simple-lists.html
Simple
^^^^^^

- A simple list.
- There are no margins between list items.
- Simple lists do not contain multiple paragraphs. That's a complex list.
- In the case of a nested list

- There are no margins between elements

- Still no margins

- Still no margins

Complex
^^^^^^^

- A bullet list

+ Nested bullet list.
Expand Down
2 changes: 1 addition & 1 deletion sphinx_rtd_theme/static/css/theme.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/sass/_theme_rst.sass
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,23 @@
list-style: upper-alpha
.section ol, ol.arabic
@extend .wy-plain-list-decimal
// Complex bullet lists, they have more item margins than simple lists
.section ol li, .section ul li
> *
margin-top: $base-line-height / 2
margin-bottom: $base-line-height / 2
&:first-child
margin-top: 0rem
> p
margin-bottom: 0rem
> ul, > ol
margin-bottom: $base-line-height / 2
// Simple lists, no item margins
.section ol.simple li, .section ul.simple li
> *
margin-top: 0rem
margin-bottom: 0rem
ul, ol
margin-top: 0rem
margin-bottom: 0rem
.line-block
Expand Down

0 comments on commit aa0a108

Please sign in to comment.