Skip to content

[Repo Assist] fix: Markdown.ToMd preserves tight list formatting#1157

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-tomd-tight-list-2026-04-10-180b727864bdfb09
Draft

[Repo Assist] fix: Markdown.ToMd preserves tight list formatting#1157
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-tomd-tight-list-2026-04-10-180b727864bdfb09

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist.

Summary

Fixes a bug where Markdown.ToMd converts tight lists (no blank lines between items in the source) into loose lists during serialisation.

Root Cause

In MarkdownUtils.fs, the ListBlock(Unordered, ...) and ListBlock(Ordered, ...) arms of formatParagraph unconditionally emitted yield "" (a blank line) after every list item — regardless of whether the original list was tight or loose.

The parser correctly distinguishes tight from loose via the paragraph type:

  • Tight items: stored as Span(...) (single paragraph per item)
  • Loose items: stored as Paragraph(...) (may have multiple paragraphs per item)

Fix

Detect a tight list by checking whether all items are single Span paragraphs. When the list is tight, suppress inter-item blank lines; emit one trailing blank line after the entire list only. This is consistent with how other block elements (headings, paragraphs, code blocks) are serialised.

Tests Added

  • ToMd preserves tight unordered list without blank lines between items
  • ToMd preserves tight ordered list without blank lines between items
  • ToMd preserves loose list with blank lines between items

Test Status

✅ Build: 0 warnings, 0 errors
✅ Tests: 284/284 Markdown tests pass (3 new tests added)

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@e1ecf341a90b7bc2021e77c58685d7e269e20b99

Tight lists (no blank lines between items in source) were converted to
loose lists by ToMd because the list serialiser always emitted a blank
line after every item.

Root cause: the Unordered and Ordered ListBlock arms in formatParagraph
unconditionally yielded "" after each item, regardless of whether the
list was tight or loose.

Fix: detect a tight list (every item is a single Span paragraph, as
produced by the parser for simple/tight items) and suppress inter-item
blank lines. A single trailing blank line is still emitted after the
entire list so the document structure is preserved.

Added three tests:
- tight unordered list round-trip (no blank lines)
- tight ordered list round-trip (no blank lines)
- loose list round-trip (items with blank lines preserved)

All 284 Markdown tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decouple surface/component colors from --header-background

0 participants