Skip to main content

parse

Function parse 

Source
pub fn parse(src: &str) -> Result<Value, MarkdownError>
Expand description

Parse a Markdown source with the shared default engine instance.

The instance is built once, on first use, and reused after that: Tabnas::parse takes &self and builds a fresh parse context per call, and Tabnas is Send + Sync, so concurrent callers share one installed grammar instead of each rebuilding it. Use make or make_with when the parser needs configuring: that returns a fresh instance and leaves this one alone.

let doc = tabnas_markdown::parse("Hello *world*")?;
let para = &doc.to_json()["children"][0];
assert_eq!(para["type"], "paragraph");
assert_eq!(para["children"][1]["type"], "emphasis");