diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-26 15:16:05 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-26 15:16:05 +0200 |
commit | a5ee9b1edd25f698813ebdc52404ec19fa479718 (patch) | |
tree | 7d428ca9b2b0059e39f78bc096bf57b94f1d8a3d /code/src/html.rs | |
parent | 15d78464ba9a717a71e1dc47a4101c8b13ec6581 (diff) | |
download | metamuffin-blog-a5ee9b1edd25f698813ebdc52404ec19fa479718.tar metamuffin-blog-a5ee9b1edd25f698813ebdc52404ec19fa479718.tar.bz2 metamuffin-blog-a5ee9b1edd25f698813ebdc52404ec19fa479718.tar.zst |
new renderer
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("\"", """) +} |