pub enum Rule {
Show 35 variants
EOI,
ws,
markdown,
empty_line,
block,
horizontal_rule,
code_block,
code_lang,
code_content,
quote,
paragraph,
paragraph_line,
paragraph_break,
text,
styled_text,
inline_image,
inline_link,
link_text,
alt_text,
url,
strikethrough,
underline,
bold,
italic,
content,
escaped,
plain_text,
char,
exclude_styles,
exclude_block_elems,
heading,
heading1,
heading2,
heading3,
single_line_text,
}Variants§
EOI
End-of-input
ws
Whitespace rules, allowing space or tabs as separators.
markdown
The main grammar for Markdown, starting with the start of input (SOI) and ending at end of input (EOI). Consists of blocks separated by zero or more empty lines.
empty_line
Defines an empty line, which is just a newline.
block
A block is any of the major Markdown constructs: headings, quotes, code blocks, horizontal rules, or paragraphs. Blocks can’t be used as inline elements like bold, italic, links and etc.
horizontal_rule
A horizontal rule, which is three or more dashes (---), asterisks (***), or en-dashes (–––).
It can optionally be followed by whitespace and ends with a newline or the end of input.
code_block
A fenced code block, which starts with three backticks (```).
Optionally includes a programming language (code_lang) after the opening backticks.
The content of the code block (code_content) is followed by closing backticks.
code_lang
The language of the code block, consisting of alphabetic characters and optional whitespace.
code_content
The content of the code block, which continues until it encounters the closing backticks. Ensures that it does not contain the closing sequence of backticks prematurely.
quote
A blockquote in Markdown, which starts with > followed by a paragraph.
paragraph
A paragraph consists of one or more lines of text.
paragraph_line
A paragraph line consists of one or more text elements, optionally followed by a paragraph break.
paragraph_break
A paragraph break is just a newline.
text
Defines the possible types of text within a paragraph: plain text, escaped characters, or styled text.
styled_text
Styled text includes various formatting options: bold, underline, italic, strikethrough, inline images, and inline links. Styling can be nested and may include escaped characters within.
inline_image
Inline images, written as  in Markdown.
They contain alternative text in case image within the url or path is inaccessible.
inline_link
Inline links, written as [link text](url) in Markdown.
They contain a link (url) and a text that replaces the link (link_text).
link_text
The text that appears as the clickable link within square brackets, excluding the closing ].
alt_text
The alternative text for an image, appearing within the square brackets of an inline image. It reads any characters until it reaches ‘]’ symbol.
url
The URL for inline links or images, enclosed in parentheses and excluding the closing ).
It reads any characters until it reaches ‘)’ symbol.
strikethrough
Strikethrough text, enclosed in double tildes (~~).
underline
Underlined text, enclosed in double underscores (__).
bold
Bold text, enclosed in double asterisks (**).
italic
Italicized text, enclosed in either single asterisks (*) or single underscores (_).
content
Content is any text not excluded by styling or block-level rules, used as plain text within styled elements.
escaped
Escaped characters, which are prefixed with a backslash (\) to include special characters in the text.
plain_text
Plain text excludes block-level elements and styled text, used for unformatted text in paragraphs.
char
Matches any single character.
exclude_styles
Defines the characters or elements that describe when a styled text starts.
exclude_block_elems
Excludes block-level elements like headings, quotes, code blocks, and horizontal rules.
heading
Defines Markdown headings, which come in three levels (H1, H2, H3).
heading1
A level-1 heading, starting with # followed by a single line of text.
heading2
A level-2 heading, starting with ## followed by a single line of text.
heading3
A level-3 heading, starting with ### followed by a single line of text.
single_line_text
A single line of text, not containing a newline.