Skip to main content

Crate umark_lib

Crate umark_lib 

Source
Expand description

umark-lib is a lightweight Markdown-to-HTML parser implemented in Rust.

It exposes two parsing modes:

  • regular parsing (parse*): keeps inline/raw HTML
  • safe parsing (safe_parse*): rejects script tags and any raw HTML

§Flavor overview

  • MarkdownFlavor::CommonMark: core CommonMark-style behavior
  • MarkdownFlavor::Gfm: CommonMark + tables, task lists, strikethrough, literal autolinks, footnotes, and Mermaid chart blocks

§Quick example

use umark_lib::parse;

let html = parse("# Hello");
assert!(html.contains("<h1>Hello</h1>"));

§Safe parsing example

use umark_lib::safe_parse;

assert!(safe_parse("plain text").is_ok());
assert!(safe_parse("x <span>y</span>").is_err());

Enums§

MarkdownFlavor
Controls which Markdown feature set is enabled during parsing.

Functions§

parse
Parse Markdown with the default flavor (MarkdownFlavor::Gfm) and return HTML.
parse_from_file
Parse Markdown from a file and write rendered HTML to another file using GFM.
parse_from_file_with_flavor
Parse Markdown from a file with an explicit flavor and write HTML to a file.
parse_with_flavor
Parse Markdown with an explicit flavor and return HTML.
safe_parse
Parse Markdown safely with the default flavor (MarkdownFlavor::Gfm).
safe_parse_from_file
Safely parse Markdown from a file and write output HTML with default GFM flavor.
safe_parse_from_file_with_flavor
Safely parse Markdown from a file with an explicit flavor and write HTML to a file.
safe_parse_with_flavor
Parse Markdown safely with an explicit flavor.