A port of pulldown-cmark's parser to MoonBit.
let events = @cmark.parse(source, options)let options = @cmark.Options::empty()
options.insert(@cmark.enable_tables())
options.insert(@cmark.enable_footnotes())
let events = @cmark.parse(markdown, options)pub(all) enum LinkType {
Inline
Reference
ReferenceUnknown
Collapsed
CollapsedUnknown
Shortcut
ShortcutUnknown
Autolink
Email
WikiLink(Bool)
} derive(Debug)pub struct Options {
flags : UInt
}pub struct Parser {
text : Bytes
options : Options
tree : Tree[Item]
allocs : Allocations
html_scan_guard : HtmlScanGuard
link_ref_expansion_limit : Int
inline_stack : InlineStack
link_stack : LinkStack
wikilink_stack : LinkStack
code_delims : CodeDelims
math_delims : MathDelims
}pub(all) enum Tag {
Paragraph
Heading(level~ : HeadingLevel, id~ : String?, classes~ : Array[String], attrs~ : Array[(String, String?)])
BlockQuote(BlockQuoteKind?)
CodeBlock(CodeBlockKind)
ContainerBlock(ContainerKind, String)
HtmlBlock
List(Int64?)
Item
FootnoteDefinition(String)
DefinitionList
DefinitionListTitle
DefinitionListDefinition
Table(Array[Alignment])
TableHead
TableRow
TableCell
Emphasis
Strong
Strikethrough
Highlight
Superscript
Subscript
Link(link_type~ : LinkType, dest_url~ : String, title~ : String, id~ : String)
Image(link_type~ : LinkType, dest_url~ : String, title~ : String, id~ : String)
MetadataBlock(MetadataBlockKind)
} derive(Debug)pub(all) enum TagEnd {
Paragraph
Heading(HeadingLevel)
BlockQuote(BlockQuoteKind?)
CodeBlock
ContainerBlock(ContainerKind)
HtmlBlock
List(Bool)
Item
FootnoteDefinition
DefinitionList
DefinitionListTitle
DefinitionListDefinition
Table
TableHead
TableRow
TableCell
Emphasis
Strong
Strikethrough
Highlight
Superscript
Subscript
Link
Image
MetadataBlock(MetadataBlockKind)
} derive(Debug)A port of pulldown-cmark's parser to MoonBit.