Skip to main content

render_body

Function render_body 

Source
pub fn render_body(body: &str, format: ContentFormat) -> String
Expand description

Render a document body to HTML.

format is the document’s own grammar — taken from its extension, not from the vault’s content_format, because a vault may hold both (an imported .html artifact beside a .md transcription is the normal case, not the exotic one).

A body twig cannot parse renders as escaped source in a <pre> rather than failing the page: a publish that drops one document’s prose on the floor is worse than one that shows it unformatted, and the alternative — comrak’s infallible signature — was only infallible because it silently accepted anything as Markdown.