Skip to content

Commit

Permalink
Changed markdown library.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnyLlama committed Apr 11, 2024
1 parent 5d99ba4 commit 175f5b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ edition = "2021"
ammonia = "4"
argon2 = "0.5"
chrono = { version = "0.4", features = ["serde"] }
comrak = "0"
dotenvy = "0.15"
jsonwebtoken = "9.3"
markdown = "0.3.0"
rocket = { version = "0.5", features = ["json"] }
rocket_dyn_templates = { version = "0.1", features = ["tera"] }
serde = "1"
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod database;
pub mod error;
pub mod token;

use comrak::{markdown_to_html, Options};
use database::DatabaseHandler;
use rocket::{fs::FileServer, http::Status, Request};
use rocket_dyn_templates::{context, tera, Engines, Template};
Expand All @@ -24,7 +25,7 @@ fn custom_tera(engines: &mut Engines) {
"markdown",
|value: &tera::Value, _: &_| -> tera::Result<tera::Value> {
let markdown = tera::from_value::<String>(value.clone())?;
let raw_html = markdown::to_html(&markdown);
let raw_html = markdown_to_html(&markdown, &Options::default());
let sanitized_html = ammonia::clean(&raw_html);
Ok(tera::to_value(sanitized_html)?)
},
Expand Down

0 comments on commit 175f5b3

Please sign in to comment.