2016-03-18 05:41:00 +08:00
|
|
|
pub mod fs;
|
2015-08-07 05:04:19 +08:00
|
|
|
|
2016-03-28 00:22:17 +08:00
|
|
|
use pulldown_cmark::{Parser, html, Options, OPTION_ENABLE_TABLES, OPTION_ENABLE_FOOTNOTES};
|
2015-09-17 05:35:16 +08:00
|
|
|
|
|
|
|
|
2015-12-30 07:46:55 +08:00
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Wrapper around the pulldown-cmark parser and renderer to render markdown
|
|
|
|
|
|
|
|
pub fn render_markdown(text: &str) -> String {
|
|
|
|
let mut s = String::with_capacity(text.len() * 3 / 2);
|
2016-01-03 19:02:39 +08:00
|
|
|
|
|
|
|
let mut opts = Options::empty();
|
|
|
|
opts.insert(OPTION_ENABLE_TABLES);
|
|
|
|
opts.insert(OPTION_ENABLE_FOOTNOTES);
|
|
|
|
|
|
|
|
let p = Parser::new_ext(&text, opts);
|
2015-12-30 07:46:55 +08:00
|
|
|
html::push_html(&mut s, p);
|
|
|
|
s
|
|
|
|
}
|