You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: paint highlight ranges behind the rendered text (upstream #1218) - #17
This brings software-mansion#1218 to fork/t3-mobile, so that T3 Code can tint the paragraph and the word that read aloud speaks on mobile.
It adds three props to EnrichedMarkdownText:
highlights: UTF-16 ranges painted behind the rendered text.
onRenderedTextChange: sends the rendered text and its blocks.
onHighlightLayout: sends the rect of each range, so that the app can scroll to follow it.
A change to highlights does not parse or lay out the markdown again, and it does not change copied text. The details and limits are in software-mansion#1218.
The port to the fork needed no conflict fixes. The upstream branch needed some, because upstream's Android onDraw now draws text backgrounds.
Screenshots
The paragraph tint and the word tint are two entries in highlights. The screen that drives them is a test screen and is not in this PR.
iOS (iPhone 17 Pro Max, iOS 26.5)
Android (Pixel 8, Android 15)
Verification
Typecheck, eslint, jest, ktlint and the Android unit tests pass.
iOS XCTest runs 69 tests, and 3 of them are new.
I ran a test screen on an iPhone 17 Pro Max simulator (iOS 26.5) and a Pixel 8 emulator (Android 15), in light and dark mode. I also ran it in the T3 Code mobile app, with read aloud.
T3 Code uses a tarball of this branch, plus two fork-only fixes (1.2.0-t3.18-35a9c280), in its read-aloud highlight PR, until this lands.
Model and harness: Claude Opus 5.5 in Claude Code.
Add a highlights prop to EnrichedMarkdownText: ranges of the rendered text
with a color, border radius and padding, drawn behind the glyphs on iOS
(TextKit 1 layout manager background pass) and Android (TextView onDraw,
before the text). The text, selection, copy and measuring do not change, and
moving a highlight does not render the Markdown again. In GitHub flavor, code
blocks and tables are tinted as a whole.
onRenderedTextChange reports the text the offsets index into and its blocks.
onHighlightLayout reports each highlight's box when it moves, so a screen can
scroll a highlighted word into view.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No actionable comments were generated in the recent review.
Walkthrough
The change adds native text highlighting based on UTF-16 ranges in rendered Markdown text. iOS and Android report rendered text with block offsets and emit highlight layout rectangles. The TypeScript API exposes the highlight props and callbacks. Tests and documentation cover the API and native coordination. The example app adds a screen that highlights words as playback advances.
Highlight ranges and rendered-text callbacks are added on iOS, Android and in the TypeScript API. The earlier problem where a failed render left stale highlight metadata is fixed. No merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title says the PR paints highlight ranges behind rendered text. The changeset adds the highlights prop, which paints UTF-16 ranges behind rendered text on Android and iOS, plus the related rende…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description states the PR adds three EnrichedMarkdownText props (highlights, onRenderedTextChange, onHighlightLayout) that paint ranges behind rendered text, and it names the platforms tested. Thi…
Full details: Title check
Explanation
The title says the PR paints highlight ranges behind rendered text. The changeset adds the highlights prop, which paints UTF-16 ranges behind rendered text on Android and iOS, plus the related rendered-text and highlight-layout events. The title matches the main change. It also contains the upstream reference, which is a minor detail.
Full details: Description check
Explanation
The description states the PR adds three EnrichedMarkdownText props (highlights, onRenderedTextChange, onHighlightLayout) that paint ranges behind rendered text, and it names the platforms tested. This matches the changeset, which adds those props on iOS and Android. The description is related to the changeset, so the check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 549465fe-fed5-4205-8369-75647d0cde2c
Commits
Reviewing files that changed from the base of the PR and between edfcf85 and 35a9c28.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Update highlight metadata when a render failure clears the text. · EnrichedMarkdownText.kt:328
packages/react-native-enriched-markdown/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt:328 Minor · Data Integrity & Integration · Quick win
Update highlight metadata when a render failure clears the text.
After a successful render, these failure paths clear text without updating highlightCoordinator. If a listener is then enabled, setEnableRenderedTextChange emits the previous text and blocks although the view is empty. The event contract requires the text that the view shows. (raw.githubusercontent.com)
Route both clears through a helper that also refreshes coordinator state, emits the empty rendered-text snapshot when enabled, and schedules geometry reporting. Keep the existing render-ID and attachment guards.
Also applies to: 346-346
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: a3b7ded1-9253-420e-9e4a-a66e58457283
Commits
Reviewing files that changed from the base of the PR and between 497fbe6 and 3431ed0.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
…ackgrounds
A line background span added after the text's own draws the highlight once
those backgrounds are down and before the glyphs and the selection. Text
that is not Spannable keeps drawing it before the text. Boxes that touch on
one line, such as a trailing space, join into one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Outside-diff finding on EnrichedMarkdownText.kt:328 (a failed render clears the text without updating highlights): fixed in 214f1b7. Both failure paths now refresh the rendered text and emit the change.
gruckion
added a commit
to gruckion/t3code
that referenced
this pull request
Nov 24, 2026
Adds a highlights prop that paints colored ranges behind the rendered text on
iOS and Android, onRenderedTextChange, which reports the rendered plain text
and its blocks, and onHighlightLayout, which reports where the ranges were
painted, so a reader can follow along and scroll to them.
From software-mansion#1218 at 5f24630 (#17)
Upstream: software-mansion#1218
Adds a highlights prop that paints colored ranges behind the rendered text on
iOS and Android, onRenderedTextChange, which reports the rendered plain text
and its blocks, and onHighlightLayout, which reports where the ranges were
painted, so a reader can follow along and scroll to them.
From software-mansion#1218 at 5f24630 (#17)
Upstream: software-mansion#1218
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
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.
This brings software-mansion#1218 to
fork/t3-mobile, so that T3 Code can tint the paragraph and the word that read aloud speaks on mobile.It adds three props to
EnrichedMarkdownText:highlights: UTF-16 ranges painted behind the rendered text.onRenderedTextChange: sends the rendered text and its blocks.onHighlightLayout: sends the rect of each range, so that the app can scroll to follow it.A change to
highlightsdoes not parse or lay out the markdown again, and it does not change copied text. The details and limits are in software-mansion#1218.The port to the fork needed no conflict fixes. The upstream branch needed some, because upstream's Android
onDrawnow draws text backgrounds.Screenshots
The paragraph tint and the word tint are two entries in
highlights. The screen that drives them is a test screen and is not in this PR.Verification
T3 Code uses a tarball of this branch, plus two fork-only fixes (
1.2.0-t3.18-35a9c280), in its read-aloud highlight PR, until this lands.Model and harness: Claude Opus 5.5 in Claude Code.