Module parser

Source
Expand description

This module contains the parser for converting tokenized Markdown lines into structured Markdown elements.

It provides functions to parse block-level elements like headings, lists, and code blocks, as well as inline elements like links, images, and emphasis.

FunctionsΒ§

attach_to_previous_block πŸ”’
Attaches the current line to the previous block, optionally adding a separator token.
flatten_inline πŸ”’
Flattens a vector of inline Markdown elements into a single string.
group_asterisked_lines πŸ”’
Groups lines that start with asterisks into blocks.
group_dashed_lines πŸ”’
Groups dashed lines into blocks based on the previous block’s content.
group_lines_to_blocks
Groups adjacent tokenized lines into groups (blocks) for further parsing.
group_lines_with_leading_whitespace πŸ”’
Groups lines with leading whitespace into blocks based on the previous block’s content.
group_ordered_list πŸ”’
Groups ordered list lines into a block by appending the line to the previous block if it is part of the same list.
group_setext_heading_one πŸ”’
Groups Setext heading 1 lines into a block by prepending the previous block with β€œ# β€œ.
group_tabbed_lines πŸ”’
Groups tabbed lines into blocks based on the previous block’s content.
group_table_rows πŸ”’
Groups lines beginning with β€œ|” denoting Markdown tables.
group_text_lines πŸ”’
Groups text lines into blocks based on the previous block’s content.
make_image πŸ”’
Helper function used in parse_link_type to circumvent Rust’s limitation on closure recursion
make_link πŸ”’
Helper function used in parse_link_type to circumvent Rust’s limitation on closure recursion
parse_block πŸ”’
Parses a single line of tokens into a block-level Markdown element.
parse_blockquote πŸ”’
Parses a blockquote from a vector of tokens into an MdBlockElement::BlockQuote.
parse_blocks
Parses a vector of tokenized markdown lines into a vector of block-level Markdown elements.
parse_code_span πŸ”’
Parses a code span starting from the current position of the cursor.
parse_codeblock πŸ”’
Parses a vector of tokens representing a code block into an MdBlockElement::CodeBlock.
parse_heading πŸ”’
Parses a vector of tokens representing a heading into an MdBlockElement::Header.
parse_indented_codeblock πŸ”’
Parses an indented code block from a vector of tokens.
parse_inline
Parses a vector of tokens into a vector of inline Markdown elements (i.e. links, images, bold/italics, etc.).
parse_link_type πŸ”’
Parses a link type (either a link or an image) from the current position of the cursor.
parse_list πŸ”’
Generic list parser used to reduce code duplication between ordered and unordered lists.
parse_ordered_list πŸ”’
Parses a vector of tokens representing an ordered list into an MdBlockElement::OrderedList.
parse_raw_html πŸ”’
Parses raw HTML tags from a vector of tokens into an MdBlockElement::RawHtml.
parse_table
Parses GitHub-style tables from the input vector of tokens.
parse_unordered_list πŸ”’
Parses a vector of tokens representing an unordered list into an MdBlockElement::UnorderedList.
resolve_emphasis πŸ”’
Wrapper function to start the call chain for resolve_emphasis_recursive if there is more than one delimiter in the stack.
resolve_emphasis_recursive πŸ”’
Recursively parses (resolves) emphasis in a vector of inline Markdown elements.
split_row πŸ”’
Helper function to split a row of tokens into individual cells.