Skip to content

fix(android): drop the bottom margin of a block that ends a list item - #1067

Closed
jnowakow wants to merge 1 commit into
fix/android-list-item-code-blockfrom
fix/android-list-item-trailing-margin
Closed

jnowakow wants to merge 1 commit into
fix/android-list-item-code-blockfrom
fix/android-list-item-trailing-margin

Conversation

@jnowakow

@jnowakow jnowakow commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

What/Why?

Stacked on #1065. A quote, heading or code block that ends a list item left its bottom margin spacer before the next item, which showed as a blank gap (a double one after a quote). The trailing spacer is now removed, so the next item, or the list's own margin, follows directly, as it does after a paragraph. The block's own line ends stay, so a code block keeps its bottom padding and corners.

React Native keeps this margin; Android drops it on purpose.

Testing

Before After

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

A quote, heading or code block that ends a list item left its bottom margin
spacer before the next item, which showed as a blank gap (a double one after
a quote). Remove that trailing spacer so the next item, or the list's own
margin, follows directly. The block's own line ends stay, so a code block
keeps its bottom padding and corners. React Native keeps this margin.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Quotes ending in code blocks retain an inner margin spacer, and the new test does not detect the remaining gap.

1 open issue
What changed in this PR

This Android-only change builds on #1065 by removing trailing block margins from list items while preserving code-block padding and corners.

Changes:

  • Trim a trailing margin spacer before finalizing each list item.
  • Add regression coverage for items ending in code blocks and quotes.
File Description
packages/​enriched-markdown-android/​ui/​src/​test/​java/​com/​swmansion/​enriched/​markdown/​ListChildrenRenderingTest.kt Adds checks for spacing before the next list item.
packages/​enriched-markdown-android/​ui/​src/​main/​java/​com/​swmansion/​enriched/​markdown/​renderer/​ListItemRenderer.kt Removes the final block-margin spacer from list items.

Review effort: Balanced

Comment on lines +174 to +175
spacers.forEach(builder::removeSpan)
builder.delete(spacerStart, builder.length)
@jnowakow jnowakow closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants