How to add clickable button for code section in for Markdown on Android Compose?

1 day ago 1
ARTICLE AD BOX

I use a halilibo Composable to render Markdown text:

build.gradle:

implementation 'com.halilibo.compose-richtext:richtext-ui-material3:1.0.0-alpha02' implementation 'com.halilibo.compose-richtext:richtext-commonmark:1.0.0-alpha02'

My composable:

MarkdownText( text = message.content, modifier = Modifier.padding(12.dp), textColor = Color.White, linkColor = Color.White, )

I'd like to add my "Apply the code" button that would use the provided code block. Since the composable uses SpannableString behind the scene, can I preprocess the message.content to add a button and handle the button click?

Read Entire Article