diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/posts/fs_post.rs | 4 | ||||
-rw-r--r-- | src/tutors/fs_tutor.rs | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 13e6229..1a495f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,7 +42,7 @@ async fn main() { let app = Router::new() .route("/", get(handlers::index_handler)) .route("/posts", get(handlers::posts_handler)) - .route("/posts/:post_id", get(handlers::post_handler)) + .route("/posts/{post_id}", get(handlers::post_handler)) .with_state(posts) .route("/policies", get(handlers::policies_handler)) .route("/brochure", get(handlers::brochure_handler)) diff --git a/src/posts/fs_post.rs b/src/posts/fs_post.rs index 4fc03b2..12ce538 100644 --- a/src/posts/fs_post.rs +++ b/src/posts/fs_post.rs @@ -1,3 +1,5 @@ +use comrak::Options; + use crate::posts::abstractions::post::Post; use std::{borrow::Cow, fs, path::PathBuf}; @@ -19,7 +21,7 @@ impl Post for FsPost { fn get_article(&self) -> Cow<str> { let article = fs::read_to_string(&self.file).unwrap(); - Cow::Owned(article) + Cow::Owned(comrak::markdown_to_html(&article, &Options::default())) } fn get_description(&self) -> Cow<str> { diff --git a/src/tutors/fs_tutor.rs b/src/tutors/fs_tutor.rs index dc8a635..6b05fd8 100644 --- a/src/tutors/fs_tutor.rs +++ b/src/tutors/fs_tutor.rs @@ -1,3 +1,5 @@ +use comrak::Options; + use crate::tutors::abstractions::tutor::Tutor; use std::{borrow::Cow, cmp::Ordering, fs, path::PathBuf}; @@ -25,7 +27,7 @@ impl Tutor for FsTutor { let mut path = self.dir.to_owned(); path.push(format!("{}.md", self.get_id())); let blurb = fs::read_to_string(path).unwrap(); - Cow::Owned(blurb) + Cow::Owned(comrak::markdown_to_html(&blurb, &Options::default())) } } |