Skip to content

Fix nested list style in Markdown preview #190936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2023
Merged

Conversation

hsfzxjy
Copy link
Contributor

@hsfzxjy hsfzxjy commented Aug 22, 2023

fix #190860

There could be two cases for nested list:

- a
  - b
- c

renders into

<ul>
 <li>a
   <ul><li>b</li></ul>
 </li>
 <li>c</li>
</ul>

- a
  - b

  some text
- c

renders into

<ul>
 <li><p>a</p>
   <ul><li>b</li></ul>
   <p>some text</p>
 </li>
 <li><p>c</p></li>
</ul>

PR #124445 fixed the first case, but did not take the second case into consideration. This PR carries the following modification:

  1. Instead of setting all ul ul with margin-bottom: 0, we set only ul ul:first-child, which should match exactly the first case;
  2. For the second case, we keep the margin-bottom of nested ul/ol, and further, we adjust li p's margin-bottom to 0.7em, which is the same as that of ul/ol and makes the style more consistent.

@mjbvz mjbvz added this to the August 2023 milestone Aug 22, 2023
@mjbvz mjbvz enabled auto-merge (squash) August 22, 2023 20:59
@mjbvz mjbvz merged commit 870d659 into microsoft:main Aug 22, 2023
@hsfzxjy hsfzxjy deleted the md-style-190860 branch August 23, 2023 05:14
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown: the height before and after sections of the sublist are inconsistent
3 participants