Parse Markdown with Embedded HTML in Rust
This is how to process Markdown that has embedded HTML in it.
---
[dependencies]
markdown = "1.0.0"
---
#![allow(unused)]
use markdown::{to_html_with_options, CompileOptions, Options};
fn main() {
let content = r#"
# Converted Markdown
With <strong>embeded HTML</strong>
in it. "#;
let converted = markdown::to_html_with_options(
content,
&Options {
compile: CompileOptions {
allow_dangerous_html: true,
..CompileOptions::default()
},
..Options::default()
}
);
println!("{}", converted.unwrap());
}
<h1>Converted Markdown</h1>
<p>With <strong>embeded HTML</strong>
in it.</p>