Markdown loose lists have incorrect bottom margin
What does this MR do and why?
Markdown lists can either be "tight" (such as the most basic of lists), or "loose" (such as one with a paragraph embedded in the list item). A tight list should not have any additional spacing between items. A loose list gets additional padding between items to separate paragraphs, etc.
This MR fixes some spacing inconsistencies.
The orginal MR removed the bottom margin from all lists. This fixed the problem where tight lists were displayed incorrectly. But then loose lists were broken (had no bottom margin on lists).
A loose list can be distinguished from a tight list because the list item starts with a paragraph rather than a simple text node.
- tight list:
<li>this is a tight list item</li>
- loose list:
<li><p>this is a loose list item</p></li>
So this MR targets lists in a loose list by using a general sibling selector, such as p ~ ul
- any ul
that is preceded by a p
with the same parent.
In this way, we're able to add back the bottom margin to lists inside a loose list.
Screenshots or screen recordings
How to set up and validate locally
Insert the various markdown snippets in the table above and check how they render.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #31164 (closed)