diff options
Diffstat (limited to 'code/src/html.rs')
-rw-r--r-- | code/src/html.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/code/src/html.rs b/code/src/html.rs index 23ac6c8..e133528 100644 --- a/code/src/html.rs +++ b/code/src/html.rs @@ -1,10 +1,9 @@ use crate::{ article_metadata, file_history, get_articles, - markdown::{self, render::blocks_to_html}, + markdown::{self}, ArticleMeta, }; use laby::{frag, html, iter, li, ul, Render}; -use pest::Parser; use std::fs::read_to_string; pub fn scaffold(title: String, body: impl Render) -> impl Render { @@ -39,9 +38,9 @@ pub fn article(path: String) -> impl Render { scaffold( article_metadata(path.clone().into()).title, frag!( - laby::raw!(blocks_to_html(markdown::parser::parse( + laby::raw!(markdown::render( &read_to_string(&path).unwrap() - ))), + )), hr!(), p!("changes to this article (as recorded with git; visible on the git repo, that i will create soon)"), pre!(file_history(&path)) @@ -70,3 +69,11 @@ pub fn index(root: &str) -> impl Render { })), ) } + +pub fn escape(text: &str) -> String { + text.replace("&", "&") + .replace("<", "<") + .replace(">", ">") + .replace("'", "’") + .replace("\"", """) +} |