aboutsummaryrefslogtreecommitdiff
path: root/code/src/html.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-26 14:14:58 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-26 14:14:58 +0200
commit15d78464ba9a717a71e1dc47a4101c8b13ec6581 (patch)
tree43def89ffd6e9c2ff80e7f7eeecec6fcf18c4e92 /code/src/html.rs
parent0a18eae178a23e7f7bfd88c37502e5e8c1fdf64a (diff)
downloadmetamuffin-blog-15d78464ba9a717a71e1dc47a4101c8b13ec6581.tar
metamuffin-blog-15d78464ba9a717a71e1dc47a4101c8b13ec6581.tar.bz2
metamuffin-blog-15d78464ba9a717a71e1dc47a4101c8b13ec6581.tar.zst
syntax highlighting with syntect
Diffstat (limited to 'code/src/html.rs')
-rw-r--r--code/src/html.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/code/src/html.rs b/code/src/html.rs
index d310ad3..23ac6c8 100644
--- a/code/src/html.rs
+++ b/code/src/html.rs
@@ -1,7 +1,10 @@
use crate::{
- article_metadata, file_history, get_articles, markdown::{render::blocks_to_html, self}, ArticleMeta,
+ article_metadata, file_history, get_articles,
+ markdown::{self, render::blocks_to_html},
+ 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 {
@@ -25,6 +28,14 @@ pub fn scaffold(title: String, body: impl Render) -> impl Render {
}
pub fn article(path: String) -> impl Render {
+ // match parsers::markdown::Grammar::parse(
+ // parsers::markdown::Rule::file,
+ // &read_to_string(&path).unwrap(),
+ // ) {
+ // Ok(ast) => eprintln!("{ast:#?}"),
+ // Err(e) => panic!("{e}"),
+ // }
+
scaffold(
article_metadata(path.clone().into()).title,
frag!(