Crate comrak
A 100% CommonMark and GFM compatible Markdown parser.
Source repository and detailed README is at https://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 ;
#
Modules
- adapters Adapter traits for plugins.
- arena_tree Included from https://github.com/SimonSapin/rust-forest/blob/5783c8be8680b84c0438638bdee07d4e4aca40ac/arena-tree/lib.rs. MIT license (per Cargo.toml).
- html The HTML renderer for the CommonMark AST, as well as helper functions.
- nodes The CommonMark AST.
- plugins Plugins for enhancing the default implementation of comrak can be defined in this module.
Structs
- Arena
- BrokenLinkReference Struct to the broken link callback, containing details on the link reference which failed to find a match.
- ExtensionOptions Options to select extensions.
- Options Umbrella options struct.
- ParseOptions Options for parser functions.
- Plugins Umbrella plugins struct.
- RenderOptions Options for formatter functions.
- RenderPlugins Plugins for alternative rendering.
- ResolvedReference A reference link's resolved details.
Enums
-
ListStyleType
Options for bulleted list redering in markdown. See
link_styleinRenderOptionsfor more details.
Traits
- BrokenLinkCallback The type of the callback used when a reference link is encountered with no matching reference.
- URLRewriter Trait for link and image URL rewrite extensions.
Functions
- 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. See https://github.com/commonmark/commonmark-spec/blob/master/CommonMark.dtd.
- markdown_to_commonmark_xml_with_plugins Render Markdown to CommonMark XML using plugins. See https://github.com/commonmark/commonmark-spec/blob/master/CommonMark.dtd.
- 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.
-
parse_document_with_broken_link_callback
Parse a Markdown document to an AST, specifying
ParseOptions::broken_link_callback. - version Return the version of the crate.
Type Aliases
-
ComrakExtensionOptions
Legacy naming of
ExtensionOptions -
ComrakOptions
Legacy naming of
Options -
ComrakParseOptions
Legacy naming of
ParseOptions -
ComrakPlugins
Legacy naming of
Plugins -
ComrakRenderOptions
Legacy naming of
RenderOptions -
ComrakRenderPlugins
Legacy naming of
RenderPlugins