-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
flutter_markdown: search (and highlight) rendered text
I want to search and highlight text in the Markdown widget.
Currently, it can be done in several nonideal ways:
-
Preprocess input to Markdown(data: ..), making found text bold:
**found text**
. Highlight by setting style: MarkdownStyleSheet(
strong: ...)
This approach has drawbacks of highlighting all entries with the themed tag, not only searched ones. Also, simple preprocessing without taking context into account can break syntax elements: links, tables e.t.c. -
Create InlineSyntax, to locate searched text and insert node with a custom tag. Create MarkdownElementBuilder for the custom tag.
This approach has a drawback of losing parent element style, as described in Flutter-markdown: Writing an inline sytax/builder for colored text #105571. Also, the text of elements like links seems to be unavailable for inline syntaxes and will not be found.
Proposal
flutter_markdown builds Markdown widget out of standard Flutter widgets. Giving access to children's widgets, especially with an ability to assign TextEditingController, may help to achieve search and highlighting goals.