Skip to main content

format_markdown

Function format_markdown 

Source
pub fn format_markdown(input: &str) -> Result<String>
Expand description

Normalizes a Markdown string by round-tripping it through a parser and re-emitter.

This tidies up formatting that is tedious to get right in a Tera template (heading styles, list markers, blank lines between blocks) without the user having to fiddle with {%- / trim everywhere. The GitHub-flavored extensions git-cliff templates commonly use (tables, strikethrough, task lists, footnotes, and the rest of GFM) are enabled so they survive the round-trip.

The formatter options are intentionally conservative: it doesn’t reflow text or rewrite links, so template output that is already valid Markdown keeps its structure.