Repository navigation
fix(android): keep the inline code style inside headings and list items - #938
Merged
jnowakow merged 3 commits intoOct 12, 2026
Merged
Conversation
- Set HeadingSpan at top span priority, so Android applies it before the inline spans inside the heading and CodeSpan's font, size and color win - Apply the same change to the standalone enriched-markdown-android renderer
- Add SPAN_FLAGS_LIST_ITEM, a span priority just above the default and below SPAN_FLAGS_CONTAINER_BACKGROUND - Set list item spans with it, so Android applies them before the inline spans inside the item, while a blockquote still draws its leading margin before a list's - Apply the same change to the standalone enriched-markdown-android renderer
- Re-set the toggled TaskListSpan with the old span's flags instead of SPAN_FLAGS_EXCLUSIVE_EXCLUSIVE, so it keeps SPAN_FLAGS_LIST_ITEM's priority after a checkbox tap
jnowakow
reviewed
Oct 8, 2026
jnowakow
left a comment
Collaborator
There was a problem hiding this comment.
Code looks good, I've found one little thing that could be improved. Thanks for opening the PR!
| start, | ||
| end, | ||
| SPAN_FLAGS_EXCLUSIVE_EXCLUSIVE, | ||
| Spanned.SPAN_EXCLUSIVE_EXCLUSIVE or Spanned.SPAN_PRIORITY, |
Collaborator
There was a problem hiding this comment.
We already have SPAN_FLAGS_CONTAINER_BACKGROUND constant that is equal to Spanned.SPAN_EXCLUSIVE_EXCLUSIVE or Spanned.SPAN_PRIORITY. Could you rename it something more generic like SPAN_FLAGS_EXCULSIVE_EXCLUSIVE_PRIORITY and reuse it here?
| start, | ||
| end, | ||
| SPAN_FLAGS_EXCLUSIVE_EXCLUSIVE, | ||
| Spanned.SPAN_EXCLUSIVE_EXCLUSIVE or Spanned.SPAN_PRIORITY, |
Collaborator
|
I'm merging the PR and I'll open follow-up to fix the nitpicks. @jo-a-n , thanks for contributing! |
jnowakow
added a commit
that referenced
this pull request
Oct 12, 2026
#938 gives list item spans a priority above the default, so token spans set inside a list item apply after it and keep their color without being re-set.
3 of 6 tasks
1 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why
Fixes #937. On Android, inline code inside a heading or a list item renders in the block's font and size instead of the
codestyle.HeadingRendererandListItemRendererset their spans after the children at default priority, so Android applies them afterCodeSpanand overwrites it.HeadingSpannow has top priority, asSPAN_FLAGS_CONTAINER_BACKGROUNDgives blockquotes.SPAN_FLAGS_LIST_ITEMgives list spans a priority just above the default. Top priority would not work, because list spans draw a leading margin and a blockquote would then draw its bar after a list's.The heading and list changes go into both
react-native-enriched-markdownand the standaloneenriched-markdown-android. The standalone toggle already keeps the span's flags.Testing
We ship these changes as a patch on 1.0.2, whose renderer files match
main. On a Pixel 8 emulator (Android 17), inline code renders in the code font in an h4, a bullet, a nested bullet, a numbered item, a task item, a list inside a quote and a quote inside a list. Bullets, numbers, checkboxes and quote bars sit where they did before.We also ran this repo's example app and Android E2E suite (see the checklist). We have not run the standalone package or the checkbox-toggle change (our app turns task toggling off).
PR Checklist
list_code_block_*_combo_displaybaselines need regenerating in your environment. Screenshots from our machine would carry its rendering differences.