diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/blog.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/blog.rs b/src/blog.rs index 0fa9543..c877303 100644 --- a/src/blog.rs +++ b/src/blog.rs @@ -1,4 +1,5 @@ use chrono::NaiveDate; +use pulldown_cmark::{html, Options, Parser}; use regex::Regex; use rust_embed::RustEmbed; use sailfish::TemplateOnce; @@ -60,8 +61,11 @@ impl BlogEntry { fn get_file_content(path: &str) -> String { let buffer = PostAsset::get(path).unwrap().data.into_owned(); - - return String::from_utf8(buffer).unwrap(); + let md = String::from_utf8(buffer).unwrap(); + let parser = Parser::new_ext(&md, Options::empty()); + let mut html_output = &mut String::new(); + html::push_html(&mut html_output, parser); + return html_output.to_string(); } pub fn render_post_page(path: &String) -> String { |