Skip to content

style fix for li & ol: reduce margin and restore original disc#8768

Merged
Light2Dark merged 4 commits intomainfrom
sham/reduce-margin-lists
Mar 27, 2026
Merged

style fix for li & ol: reduce margin and restore original disc#8768
Light2Dark merged 4 commits intomainfrom
sham/reduce-margin-lists

Conversation

@Light2Dark
Copy link
Copy Markdown
Collaborator

@Light2Dark Light2Dark commented Mar 19, 2026

📝 Summary

  • Preserve original disc-styles when there are nested list elements.
  • Reduce margins for list items
  • Unwrap paragraph tags when there are nested list items

Before
image

After
image

Before
image

After
image

Before
image

After
image

🔍 Description of Changes

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 19, 2026 3:56pm

Request Review

@Light2Dark Light2Dark added the enhancement New feature or request label Mar 19, 2026
@Light2Dark Light2Dark changed the title fix li & ol: reduce margin and restore original list-style-disc style fix for li & ol: reduce margin and restore original disc Mar 19, 2026
@Light2Dark Light2Dark marked this pull request as ready for review March 19, 2026 15:41
@Light2Dark Light2Dark requested a review from manzt as a code owner March 19, 2026 15:41
Copilot AI review requested due to automatic review settings March 19, 2026 15:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Marimo’s markdown list rendering and styling to produce more compact HTML for nested lists, reduce list item margins in the frontend, and restore more typical nested bullet styles.

Changes:

  • Update the breakless-lists tree processor to unwrap a single <p> inside <li> when the rest of the list item is only nested lists.
  • Update/extend markdown output snapshot tests for nested list HTML structure and add new nested-list-focused test cases.
  • Add CSS rules to reduce vertical spacing for list items and tweak nested unordered list bullet styles.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/_output/test_md.py Updates snapshots for nested list HTML and adds new tests around paragraph unwrapping behavior.
marimo/_output/md_extensions/breakless_lists.py Refactors list-item paragraph unwrapping logic to allow unwrapping when nested lists are present.
frontend/src/css/md.css Reduces <li> margins and attempts to restore nested <ul> bullet style cycling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines markdown list rendering to better match expected browser/Markdown behavior by making nested lists more compact in the generated HTML and adjusting frontend CSS to reduce list-item spacing and restore default nested bullet styles.

Changes:

  • Update markdown HTML output snapshots for nested lists and add new tests around paragraph unwrapping behavior in list items.
  • Adjust the BreaklessLists treeprocessor to unwrap a single <p> inside <li> when it’s safe (including when followed by nested lists).
  • Update markdown CSS to reduce list item margins and restore default nested <ul> bullet cycling.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/_output/test_md.py Updates nested list snapshots and adds new tests for paragraph-unwrapping behavior in list items.
marimo/_smoke_tests/markdown/sane_lists.py Regenerates/normalizes a markdown smoke-test notebook to reflect updated list behavior.
marimo/_output/md_extensions/breakless_lists.py Refines <li> paragraph unwrapping logic to allow unwrapping when nested lists are present.
frontend/src/css/md.css Reduces li vertical margins and restores default nested bullet styling for nested unordered lists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +273 to +283
- `code item`"""

result = _md(input_text, apply_markdown_class=False).text
assert result == snapshot(
"""\
<ul>
<li><strong>Bold item</strong></li>
<li><em>Nested italic</em><ul>
<li><code>code item</code></li>
</ul>
</li>
@Light2Dark Light2Dark requested a review from akshayka March 27, 2026 01:58
@Light2Dark Light2Dark merged commit b93da60 into main Mar 27, 2026
47 checks passed
@Light2Dark Light2Dark deleted the sham/reduce-margin-lists branch March 27, 2026 02:40
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.21.2-dev71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants