Access the parts of a Markdown Text #217
-
I have an app, where I would like to display Markdown in all of it's glory. So with all the formatting but also with inline images and so on. But I'd also like my Speech-Synthesizer to be able to speak out the text. But as images in markdown are in general large links, that nobody cares about (spoken), I'd need to be able to access the parts that make up the whole content. Here's an example:
I've seen that And in the debugger I can now see, that the Or maybe is there any other solution? Or is there a good reason for Thanks so much for you help, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @georgbachmann, To keep MarkdownUI public API simple, the https://twitter.com/twostraws/status/1639263285995356166?s=20 Would that fulfill your use case? |
Beta Was this translation helpful? Give feedback.
Hey @georgbachmann,
It depends on how you'd like the UI to trigger the text-to-speech. With the changes introduced in MarkdownUI 2.1.0, you can access a plain text representation of any
MarkdownContent
value by usingrenderPlainText()
.So, depending on what you want to do, you can construct a
MarkdownContent
value and get its text representation before creating aMarkdown
view, or you can access theMarkdownContent
value of a specific type of block (i.e., a paragraph) by overriding its style.