Crate comrak
A 100% CommonMark and GFM compatible Markdown parser.
Source repository and detailed README is at
github.com/kivikakk/comrak.
You can use comrak::markdown_to_html directly:
use ;
assert_eq!;
Or you can parse the input into an AST yourself, manipulate it, and then use your desired formatter:
use ;
use NodeValue;
#
Modules
- adapters Adapter traits for plugins.
-
arena_tree
A DOM-like tree data structure based on
&Nodereferences. - html HTML rendering infrastructure for the CommonMark AST, as well as helper functions.
- nodes The CommonMark AST.
- plugins Plugin definitions.
Structs
- Options Umbrella options struct.
- ResolvedReference A reference link's resolved details.
Functions
- escape_commonmark_inline Escapes the input, rendering it suitable for inclusion in a CommonMark document in a place where regular inline parsing is occurring. Note that this is not minimal --- there will be more escaping backslashes in the output than is strictly necessary. The rendering will not be affected, however.
- escape_commonmark_link_destination Escapes the input URL, rendering it suitable for inclusion as a [link destination] per the CommonMark spec.
- format_commonmark Formats an AST as CommonMark, modified by the given options.
- format_commonmark_with_plugins Formats an AST as CommonMark, modified by the given options. Accepts custom plugins.
- format_html Formats an AST as HTML, modified by the given options.
- format_html_with_plugins Formats an AST as HTML, modified by the given options. Accepts custom plugins.
- format_xml Formats an AST as HTML, modified by the given options.
- format_xml_with_plugins Formats an AST as HTML, modified by the given options. Accepts custom plugins.
- markdown_to_commonmark Render Markdown back to CommonMark.
- markdown_to_commonmark_xml Render Markdown to CommonMark XML.
- markdown_to_commonmark_xml_with_plugins Render Markdown to CommonMark XML using plugins.
- markdown_to_html Render Markdown to HTML.
- markdown_to_html_with_plugins Render Markdown to HTML using plugins.
- parse_document Parse a Markdown document to an AST.
- version Return the version of the crate.
Type Aliases
Macros
- create_formatter Create a formatter with specialised rules for certain node types.
- node_matches Shorthand for checking if a node's value matches the given expression.