🚀 The markdown_widget 2.0 has now been released. The entire code has been completely redesigned according to the CommonMark Spec 3.0 compared to the 1.x versions. This brings a lot of breaking changes, but also more standardized markdown rendering logic and more robust and scalable code
The current package only implements the conversion of Markdown tags, so it does not support the conversion of HTML tags by default. However, you can extend the package to support this feature by using the html_support
🍑Custom tag implementation
By passing a SpanNodeGeneratorWithTag to MarkdownGeneratorConfig, you can add new tags and the corresponding SpanNodes for those tags. You can also use existing tags to override the corresponding SpanNodes.
You can also customize the parsing rules for Markdown strings using InlineSyntax and BlockSyntax, and generate new tags.
You can refer to the usage of SpanNodeGeneratorWithTag in video.dart for an example.
If you have any good ideas or suggestions, or have any issues using this package, please feel free to open a pull request or issue.
🧾Appendix
Here are the other libraries used in markdown_widget
Language:简体中文 | English
📖markdown_widget
A simple and easy-to-use markdown rendering component.
🚀Usage
Before starting, you can try out the online demo by clicking demo
If you want to use your own Column or other list widget, you can use
MarkdownGenerator
🌠Night mode
markdown_widget
supports night mode by default. Simply use a differentMarkdownConfig
to enable it.🔗Link
You can customize the style and click events of links, like this
📜TOC (Table of Contents) feature
Using the TOC is very simple
🎈Highlighting code
Highlighting code supports multiple themes.
🌐HTML tags
The current package only implements the conversion of Markdown tags, so it does not support the conversion of HTML tags by default. However, you can extend the package to support this feature by using the html_support
🍑Custom tag implementation
By passing a
SpanNodeGeneratorWithTag
toMarkdownGeneratorConfig
, you can add new tags and the correspondingSpanNode
s for those tags. You can also use existing tags to override the correspondingSpanNode
s.You can also customize the parsing rules for Markdown strings using
InlineSyntax
andBlockSyntax
, and generate new tags.You can refer to the usage of
SpanNodeGeneratorWithTag
in video.dart for an example.If you have any good ideas or suggestions, or have any issues using this package, please feel free to open a pull request or issue.
🧾Appendix
Here are the other libraries used in
markdown_widget