Skip to main content

normalize_markdown

Function normalize_markdown 

Source
pub fn normalize_markdown(source: &str) -> Result<String, Message>
Expand description

Normalize a Markdown document.

Parses CommonMark, GFM, frontmatter, and math (ParseOptions::normalize), then serializes the result with default formatting and soft source line breaks unwrapped. Explicit hard breaks, code content, and block boundaries are preserved. The output uses LF line endings and ends with one when non-empty. Tools that generate Markdown can pass their output through this function to produce exactly what bake-markdown’s markdown:normalize task writes.

use base_markdown::normalize_markdown;

assert_eq!(normalize_markdown("* A wrapped\r\nline.").unwrap(), "- A wrapped line.\n");

§Errors

Returns unsupported content shapes from serialization.