pub enum Tag<'a> {
Show 23 variants
Paragraph,
Heading {
level: HeadingLevel,
id: Option<CowStr<'a>>,
classes: Vec<CowStr<'a>>,
attrs: Vec<(CowStr<'a>, Option<CowStr<'a>>)>,
},
BlockQuote(Option<BlockQuoteKind>),
CodeBlock(CodeBlockKind<'a>),
HtmlBlock,
List(Option<u64>),
Item,
FootnoteDefinition(CowStr<'a>),
DefinitionList,
DefinitionListTitle,
DefinitionListDefinition,
Table(Vec<Alignment>),
TableHead,
TableRow,
TableCell,
Emphasis,
Strong,
Strikethrough,
Superscript,
Subscript,
Link {
link_type: LinkType,
dest_url: CowStr<'a>,
title: CowStr<'a>,
id: CowStr<'a>,
},
Image {
link_type: LinkType,
dest_url: CowStr<'a>,
title: CowStr<'a>,
id: CowStr<'a>,
},
MetadataBlock(MetadataBlockKind),
}
Expand description
Tags for elements that can contain other elements.
Variants§
Paragraph
A paragraph of text and other inline elements.
Heading
A heading, with optional identifier, classes and custom attributes.
The identifier is prefixed with #
and the last one in the attributes
list is chosen, classes are prefixed with .
and custom attributes
have no prefix and can optionally have a value (myattr
or myattr=myvalue
).
id
, classes
and attrs
are only parsed and populated with Options::ENABLE_HEADING_ATTRIBUTES
, None
or empty otherwise.
Fields
level: HeadingLevel
BlockQuote(Option<BlockQuoteKind>)
A block quote.
The BlockQuoteKind
is only parsed & populated with Options::ENABLE_GFM
, None
otherwise.
> regular quote
> [!NOTE]
> note quote
CodeBlock(CodeBlockKind<'a>)
A code block.
HtmlBlock
An HTML block.
A line that begins with some predefined tags (HTML block tags) (see CommonMark Spec for more details) or any tag that is followed only by whitespace.
Most HTML blocks end on an empty line, though some e.g. <pre>
like <script>
or <!-- Comments -->
don’t.
<body> Is HTML block even though here is non-whitespace.
Block ends on an empty line.
<some-random-tag>
This is HTML block.
<pre> Doesn't end on empty lines.
This is still the same block.</pre>
List(Option<u64>)
A list. If the list is ordered the field indicates the number of the first item. Contains only list items.
Item
A list item.
FootnoteDefinition(CowStr<'a>)
A footnote definition. The value contained is the footnote’s label by which it can be referred to.
Only parsed and emitted with Options::ENABLE_FOOTNOTES
or Options::ENABLE_OLD_FOOTNOTES
.
DefinitionList
Only parsed and emitted with Options::ENABLE_DEFINITION_LIST
.
DefinitionListTitle
Only parsed and emitted with Options::ENABLE_DEFINITION_LIST
.
DefinitionListDefinition
Only parsed and emitted with Options::ENABLE_DEFINITION_LIST
.
Table(Vec<Alignment>)
A table. Contains a vector describing the text-alignment for each of its columns.
Only parsed and emitted with Options::ENABLE_TABLES
.
TableHead
A table header. Contains only TableCell
s. Note that the table body starts immediately
after the closure of the TableHead
tag. There is no TableBody
tag.
Only parsed and emitted with Options::ENABLE_TABLES
.
TableRow
A table row. Is used both for header rows as body rows. Contains only TableCell
s.
Only parsed and emitted with Options::ENABLE_TABLES
.
TableCell
Only parsed and emitted with Options::ENABLE_TABLES
.
Emphasis
half*emph* _strong_ _multi _level__
Strong
half**strong** __strong__ __multi __level____
Strikethrough
Only parsed and emitted with Options::ENABLE_STRIKETHROUGH
.
~strike through~
Superscript
Only parsed and emitted with Options::ENABLE_SUPERSCRIPT
.
^superscript^
Subscript
Only parsed and emitted with Options::ENABLE_SUBSCRIPT
, if disabled ~something~
is parsed as Strikethrough
.
~subscript~ ~~if also enabled this is strikethrough~~
Link
A link.
Fields
Image
An image. The first field is the link type, the second the destination URL and the third is a title, the fourth is the link identifier.
Fields
MetadataBlock(MetadataBlockKind)
A metadata block.
Only parsed and emitted with Options::ENABLE_YAML_STYLE_METADATA_BLOCKS
or Options::ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS
.