~/selfhut

selfhut/src/utils/markdown.rs -rw-r--r-- 419 B
ef55c0da — arthurmelton summary 2 years ago

            
ef55c0da arthurmelton
00c0a257 Arthur Melton
ef55c0da arthurmelton









1
2
3
4
5
6
7
8
9
10
11
12
use pulldown_cmark::{Parser, Options, html};
use emojicons::EmojiFormatter;

pub fn md_to_html(input: &str) -> String {
    let input = EmojiFormatter(input).to_string();
    let mut options = Options::empty();
    options.insert(Options::ENABLE_STRIKETHROUGH);
    let parser = Parser::new_ext(&input, options);
    let mut html_output = String::new();
    html::push_html(&mut html_output, parser);
    html_output
}