Function pulldown_cmark::html::push_html
source · [−]Expand description
Iterate over an Iterator
of Event
s, generate HTML for each Event
, and
push it to a String
.
Examples
use pulldown_cmark::{html, Parser};
let markdown_str = r#"
hello
=====
* alpha
* beta
"#;
let parser = Parser::new(markdown_str);
let mut html_buf = String::new();
html::push_html(&mut html_buf, parser);
assert_eq!(html_buf, r#"<h1>hello</h1>
<ul>
<li>alpha</li>
<li>beta</li>
</ul>
"#);