Function pulldown_cmark::html::write_html_fmt

source ·
pub fn write_html_fmt<'a, I, W>(writer: W, iter: I) -> Result
where I: Iterator<Item = Event<'a>>, W: Write,
Expand description

Iterate over an Iterator of Events, generate HTML for each Event, and write it into Unicode-accepting buffer or stream.

§Examples

use pulldown_cmark::{html, Parser};

let markdown_str = r#"
hello
=====

* alpha
* beta
"#;
let mut buf = String::new();
let parser = Parser::new(markdown_str);

html::write_html_fmt(&mut buf, parser);

assert_eq!(buf, r#"<h1>hello</h1>
<ul>
<li>alpha</li>
<li>beta</li>
</ul>
"#);