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 behaviorMarkdownFlavor::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§
- Markdown
Flavor - 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.