Function push_html

Source
pub fn push_html<'a, I>(
    output: &mut String,
    iter: I,
    config: &HtmlConfig,
) -> Result<(), HtmlError>
where I: Iterator<Item = Event<'a>>,
Expand description

Renders markdown events to HTML and appends to the provided string

§Arguments

  • output - String buffer to append the HTML output to
  • iter - Iterator of markdown events to process
  • config - Configuration for HTML rendering

§Example

use pulldown_cmark::Parser;
use pulldown_html_ext::{HtmlConfig, push_html};

let markdown = "# Hello\n* Item 1\n* Item 2";
let parser = Parser::new(markdown);
let mut output = String::new();
let config = HtmlConfig::default();

push_html(&mut output, parser, &config).unwrap();
assert!(output.contains("<h1"));