r/androiddev • u/Sea-Arm9235 • Oct 15 '26
I built a native Markdown renderer for Jetpack Compose, now with tap-to-reveal text, LaTeX math and tree-sitter code highlighting
enriched-markdown-android is an open-source Markdown renderer for Jetpack Compose. Parsing is md4c over JNI, rendering is native Android text, so you get platform selection handles, copy and TalkBack for free.
What's new in 0.3.0:
- Spoilers - ||text|| is drawn transparent and concealed by an animated particle overlay on the text view's canvas, tap to reveal. You can plug in your own overlay with a draw callback per concealed slice.
- LaTeX math –
$inline$and$$block$$, wide equations scroll sideways, long-press to copy. - Syntax highlighting – fenced code colored by tree-sitter, 14 grammars, every token type themeable.
- Better code blocks – language header, copy button, long lines scroll instead of wrapping.
- Highlight –
==text==with `Flags(highlight = true)`. - Optional plugins – math and highlighting are separate artifacts, so you only add what you need.
- Native Selection – Standard Android text selection handles and native copy behavior.
💎 Available on Maven Central:
dependencies {
implementation("com.swmansion.enriched.markdown:compose:0.3.0")
implementation("com.swmansion.enriched.markdown:math:0.3.0") // optional
implementation("com.swmansion.enriched.markdown:code-highlight:0.3.0") // optional
}
Quick Usage:
MarkdownPlugins(LatexMathPlugin, CodeHighlightPlugin) {
EnrichedMarkdownText(
markdown = content,
flags = Flags(highlight = true),
onLinkClick = { url -> openUrl(url) },
)
}
GitHub & Docs:
https://github.com/software-mansion/enriched-markdown/blob/main/packages/enriched-markdown-android/README.md
85
Upvotes
6
u/KainTae0922 Oct 15 '26
This is long overdue, I've been waiting for someone to do this 🙏 I'm not updated in android space now, maybe someone already did this... Thank you OP 🥰 I will star this repo.
3
u/ravi_k-98 Oct 15 '26
Great! I had made my own hacky utility for bullet points in one of my apps but thanks to this I can opt for something much cleaner.
I'll definitely try it!
2
u/Infamous_Sorbet4021 Oct 16 '26
Do have plans for making also available for Compose Multiplatform in the future?
2
u/I_DontFeelGood_2 Oct 16 '26
finally something nice in this sub