functora-core 0.4.0

Pure Rust core logic: crypto, archives, encoding, i18n, and utilities.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use ammonia::Builder;
use pulldown_cmark::{Options, Parser, html};
use tap::Pipe;

#[must_use]
pub fn render_markdown(content: &str) -> String {
    Parser::new_ext(
        content,
        Options::ENABLE_TABLES | Options::ENABLE_STRIKETHROUGH,
    )
    .pipe(|parser| {
        let mut html_out = String::new();
        html::push_html(&mut html_out, parser);
        html_out
    })
    .as_str()
    .pipe(|html_out| Builder::default().clean(html_out).to_string())
}