29 lines
974 B
Rust
29 lines
974 B
Rust
pub fn to_html(src: &str) -> String {
|
|
let adapter = comrak::plugins::syntect::SyntectAdapter::new("InspiredGitHub");
|
|
let options = comrak::ComrakOptions {
|
|
extension: comrak::ComrakExtensionOptions {
|
|
strikethrough: true,
|
|
tagfilter: true,
|
|
table: true,
|
|
autolink: true,
|
|
tasklist: true,
|
|
superscript: true,
|
|
header_ids: Some("__blog-content_".to_string()),
|
|
footnotes: true,
|
|
description_lists: true,
|
|
front_matter_delimiter: None,
|
|
shortcodes: true,
|
|
},
|
|
parse: comrak::ComrakParseOptions {
|
|
smart: true,
|
|
..comrak::ComrakParseOptions::default()
|
|
},
|
|
..comrak::ComrakOptions::default()
|
|
};
|
|
let mut plugins = comrak::ComrakPlugins::default();
|
|
|
|
plugins.render.codefence_syntax_highlighter = Some(&adapter);
|
|
|
|
comrak::markdown_to_html_with_plugins(src, &options, &plugins)
|
|
}
|