Highlight certain keywords #196
-
Hi! Thanks for this amazing library. I am trying to implement a search feature and I was wondering if it's possible to apply certain styling to the searched keywords. For example, if the user searches for "This", then I want to change the text background color to yellow wherever the word "This" appears in the markdown. Appreciate any suggestions you can provide. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @umsheikh, You could achieve that by using Markdown syntax to emphasize every search term occurrence in the results (i.e., However, I think that using MarkdownUI for this use case is a bit of a killer. You can achieve the same by setting the background attribute in an |
Beta Was this translation helpful? Give feedback.
Hi @umsheikh,
You could achieve that by using Markdown syntax to emphasize every search term occurrence in the results (i.e.,
"*this*"
) and customizing the emphasis text style in aMarkdown
view to use the background color you wish.However, I think that using MarkdownUI for this use case is a bit of a killer. You can achieve the same by setting the background attribute in an
AttributedString
and rendering it with aText
view.