pub fn to_html_with_options(value: &str, options: &Options) -> StringExpand description
Turn markdown into HTML, with configuration.
Markdown has no syntax errors, so this returns the rendered string directly.
ยงExamples
use base_markdown::{to_html_with_options, CompileOptions, Options};
// Use GFM:
let result = to_html_with_options("~Venus~Mars!", &Options::gfm());
assert_eq!(result, "<p><del>Venus</del>Mars!</p>");
// Live dangerously / trust the author:
let result = to_html_with_options("<div>\n\n# Hi Jupiter!\n\n</div>", &Options {
compile: CompileOptions {
allow_dangerous_html: true,
allow_dangerous_protocol: true,
..CompileOptions::default()
},
..Options::default()
});
assert_eq!(result, "<div>\n<h1>Hi Jupiter!</h1>\n</div>");