LdMarkdown class
Renders a markdown string using native Liquid Flutter components.
The parser uses the GitHub Web extension set, supporting tables, fenced
code blocks, strikethrough, task lists, GitHub-flavored alerts
(> [!NOTE], > [!WARNING], etc.), and GFM footnotes ([^label]).
Footnote references open their definition in an LdContextMenu.
The parsed AST is cached: re-rendering with the same data string does not re-parse.
Basic usage
LdMarkdown(
data: '# Hello\n\nThis is **bold** and *italic*.',
)
Link handling
Supply onLinkTap to intercept link taps; the widget does not launch URLs automatically.
LdMarkdown(
data: '[Visit us](https://example.com)',
onLinkTap: (url, title) => launchUrl(Uri.parse(url)),
)
Live demo
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- LdMarkdown
Constructors
Properties
- animated → bool
-
final
- data → String
-
The markdown source string to render.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageBuilder → Widget? Function(String src, String alt)?
-
Called to build an image widget for a given
src/altpair. Returnnullto fall back to a plain Image.network.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onHashtagTap → void Function(String tag)?
-
Called when the user taps a hashtag (e.g.
#flutter).tagis the text without the#prefix.final - onLinkTap → void Function(String url, String title)?
-
Called when the user taps a link.
urlis the href;titleis the optional link title attribute (may be empty). The consumer is responsible for navigation or URL launching.final - padding → EdgeInsets
-
Padding applied around the rendered content.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shrinkWrap → bool
-
When
true(default), wraps the output inLdAutoSpacewhich adds automatic spacing between block elements. Set tofalseto use a plain Column instead.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< LdMarkdown> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited