markdown library
Parses text in a Markdown-like format and renders to HTML.
Classes
- AutolinkExtensionSyntax
-
Matches autolinks like
http://foo.com
. - AutolinkSyntax
-
Matches autolinks like
<http://foo.com>
. - BlockHtmlSyntax
- Parses inline HTML at the block level. This differs from other Markdown implementations in several ways:
- BlockParser
- Maintains the internal state needed to parse a series of lines into blocks of Markdown suitable for further inline parsing.
- BlockquoteSyntax
-
Parses email-style blockquotes:
> quote
. - BlockSyntax
- BlockTagBlockHtmlSyntax
- CodeBlockSyntax
- Parses preformatted code blocks that are indented four spaces.
- CodeSyntax
- Matches backtick-enclosed inline code blocks.
- CondensedHtmlRenderer
- Translates a parsed AST to HTML.
- Delimiter
- A delimiter indicating the possible "open" or possible "close" of a tag for a TagSyntax.
- DelimiterRun
- An implementation of Delimiter which uses concepts of "left-flanking" and "right-flanking" to determine the values of canOpen and canClose.
- Document
- Maintains the context needed to parse a Markdown document.
- Element
- A named tag that can contain other nodes.
- EmailAutolinkSyntax
-
Matches autolinks like
<foo@bar.example.com>
. - EmojiSyntax
-
Matches GitHub Markdown emoji syntax like
:smile:
. - EmptyBlockSyntax
- EscapeSyntax
- Escape punctuation preceded by a backslash.
- ExtensionSet
- ExtensionSets provide a simple grouping mechanism for common Markdown flavors.
- FencedCodeBlockSyntax
- Parses preformatted code blocks between two ~~~ or ``` sequences.
- HeaderSyntax
-
Parses atx-style headers:
## Header ##
. - HeaderWithIdSyntax
- Parses atx-style headers, and adds generated IDs to the generated elements.
- HorizontalRuleSyntax
-
Parses horizontal rules like
---
,_ _ _
,* * *
, etc. - HtmlRenderer
- Translates a parsed AST to HTML.
- ImageSyntax
-
Matches images like
![alternate text](url "optional title")
and![alternate text][label]
. - InlineHtmlSyntax
- Leave inline HTML tags alone, from CommonMark 0.28.
- InlineLink
- InlineParser
- Maintains the internal state needed to parse inline span elements in Markdown.
- InlineSyntax
- Represents one kind of Markdown tag that can be parsed.
- LineBreakSyntax
- Represents a hard line break.
- LinkReference
- A link reference definition.
- LinkSyntax
-
Matches links like
[blah][label]
and[blah](url)
. - ListItem
- ListSyntax
- Base class for both ordered and unordered lists.
- LongBlockHtmlSyntax
-
A BlockHtmlSyntax that has a specific
endPattern
. - Node
- Base class for any AST item.
- NodeVisitor
- Visitor pattern for the AST.
- OrderedListSyntax
- Parses ordered lists.
- OtherTagBlockHtmlSyntax
- ParagraphSyntax
- Parses paragraphs of regular text.
- SetextHeaderSyntax
- Parses setext-style headers.
- SetextHeaderWithIdSyntax
- Parses setext-style headers, and adds generated IDs to the generated elements.
- SimpleDelimiter
- A simple delimiter implements the Delimiter interface with basic fields, and does not have the concept of "left-flanking" or "right-flanking".
- SimpleParser
- A simple parser for using with DelimiterRun.
- StrikethroughSyntax
- Matches strikethrough syntax according to the GFM spec.
- TableSyntax
- Parses tables.
- TagSyntax
-
Matches syntax that has a pair of tags and becomes an element, like
*
for<em>
. Allows nested tags. - Text
- A plain text element.
- TextRenderer
- Translates a parsed AST to plain text.
- TextSyntax
- Matches stuff that should just be passed through as straight text.
- UnorderedListSyntax
- Parses unordered lists.
- UnparsedContent
- Inline content that has not been parsed into inline nodes (strong, links, etc).
Constants
Functions
-
markdownToHtml(
String markdown, {Iterable< BlockSyntax> blockSyntaxes = const [], Iterable<InlineSyntax> inlineSyntaxes = const [], ExtensionSet? extensionSet, Resolver? linkResolver, Resolver? imageLinkResolver, bool inlineOnly = false, bool checkable = false, bool emptyListDisabled = false}) → String - Converts the given string of Markdown to HTML.
-
parseInlineLink(
String source, int start) → InlineLink? -
Parses a link starting at
start
and end atend
(excludive) -
renderToHtml(
List< Node> nodes) → String -
Renders
nodes
to HTML.
Typedefs
- LinkMapper = String Function(InlineParser parser, String url)
-
Maps an URL (specified in a reference).
If nothing to change, just return
url
. It can return null (if not a link), a String or a Link. - Resolver = Node? Function(String name, [String? title])