fn markdown_renderer_helper(h: &Helper<'_, '_>, out: &mut dyn Output) -> HelperResult {
    // Expect one parameter with the markdown payload.
    let markdown_source: &str =
        h.param(0)
            .and_then(|param| param.value().as_str())
            .ok_or(RenderError::new(
                "render_markdown expects a markdown string parameter.",
            ))?;
    // Escape all the HTML in the markdown source to avoid cross-site-scripting issues.
    let escaped: String = v_htmlescape::escape(markdown_source).to_string();
    // Make a new parser with all options enabled.
    let parser = MarkdownParser::new_ext(escaped.as_str(), MarkdownOptions::all());
    // Make and write an HTML buffer with the rendered markdown.
    // Set the initial capacity at at least the length of the escaped markdown.
    let mut buffer = String::with_capacity(escaped.len());
    pulldown_cmark::html::push_html(&mut buffer, parser);
    // Write the rendered HTML to the handlebars output.
    out.write(buffer.as_str())?;
    return Ok(());
}
/// Helper to parse and render a markdown string.
Helper to parse and render a markdown string.
Helper to parse and render a markdown string .
fn markdown_renderer_helper(h: &Helper<'_, '_>, out: &mut dyn Output) -> HelperResult {
    // Expect one parameter with the markdown payload.
    let markdown_source: &str =
        h.param(0)
            .and_then(|param| param.value().as_str())
            .ok_or(RenderError::new(
                "render_markdown expects a markdown string parameter.",
            ))?;
    // Escape all the HTML in the markdown source to avoid cross-site-scripting issues.
    let escaped: String = v_htmlescape::escape(markdown_source).to_string();
    // Make a new parser with all options enabled.
    let parser = MarkdownParser::new_ext(escaped.as_str(), MarkdownOptions::all());
    // Make and write an HTML buffer with the rendered markdown.
    // Set the initial capacity at at least the length of the escaped markdown.
    let mut buffer = String::with_capacity(escaped.len());
    pulldown_cmark::html::push_html(&mut buffer, parser);
    // Write the rendered HTML to the handlebars output.
    out.write(buffer.as_str())?;
    return Ok(());
}
fn markdown_renderer_helper ( h : & Helper < ' _ , ' _ > , out : & mut dyn Output ) -> HelperResult { // Expect one parameter with the markdown payload. let markdown_source : & str = h . param ( 0 ) . and_then ( | param | param . value ( ) . as_str ( ) ) . ok_or ( RenderError :: new ( " " , ) ) ? ; // Escape all the HTML in the markdown source to avoid cross-site-scripting issues. let escaped : String = v_htmlescape :: escape ( markdown_source ) . to_string ( ) ; // Make a new parser with all options enabled. let parser = MarkdownParser :: new_ext ( escaped . as_str ( ) , MarkdownOptions :: all ( ) ) ; // Make and write an HTML buffer with the rendered markdown. // Set the initial capacity at at least the length of the escaped markdown. let mut buffer = String :: with_capacity ( escaped . len ( ) ) ; pulldown_cmark :: html :: push_html ( & mut buffer , parser ) ; // Write the rendered HTML to the handlebars output. out . write ( buffer . as_str ( ) ) ? ; return Ok ( ( ) ) ; }
Helper to parse and render a markdown string.
Helper to parse and render a markdown string .
h
&Helper<'_, '_>
out
&mut dyn Output
h
&Helper<'_, '_>
out
&mut dyn Output