Closed gs-ts closed 2 weeks ago
Good day @gs-ts
If I am understanding correctly, you attempt to implement custom links within the markdown which allow you to intercept and modify their behavior?
Overall url navigation is done by the LocalUriHandler
so you should be able to provide your own custom implementation and intercept the behavior.
thank you for your quick response @mikepenz
Actually, I was wrong and I thought the library would handle the custom tags as links and open the browser, but this is not true.
So my question now is it possible to create a handler for my custom tag? An onClick
when there is something like this:
[Important Note 1](?myCustomTag=note1)
As noted in my previous comment, the LocalUriHandler
is used to open links. So you can provide your own handler and handle links respectively.
val scrollState = rememberScrollState()
CompositionLocalProvider(LocalUriHandler provides object : UriHandler{
override fun openUri(uri: String) {
println("Handle this...: $uri")
}
}) {
Markdown(
"""
[Important Note 1](?myCustomTag=note1)
""".trimIndent(),
modifier = Modifier.fillMaxSize().verticalScroll(scrollState).padding(16.dp)
)
}
apologies for the confusion. You are right. It works as you mentioned.
I had a silly mistake in my previous implementation and the openUri
didn't work for me
About this issue
Let's say we have defined a tag:
MY_TAG = "myCustomTag"
and then I want to style and parse/handle the following (examples):
[Important Note 1](?myCustomTag=note1)
[Important Note 2](?myCustomTag=note2)
To style the above I think I can do something like this:
Now what I cannot achieve and I am not sure if the following are doable:
Details
com.mikepenz:multiplatform-markdown-renderer-m3:0.25.0
Checklist