summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2025-05-27 19:00:15 -0400
committerAdam T. Carpenter <atc@53hor.net>2025-05-27 19:00:15 -0400
commita88257e90beaaebbf7ebaca57cc871fceb93fda9 (patch)
tree6259d02103a7264b10a5e7c87c568071eb9c1d9e
parent130bceda109ce9c000779373ea1fc8b27079c8e5 (diff)
downloadcarpentertutoring-a88257e90beaaebbf7ebaca57cc871fceb93fda9.tar.xz
carpentertutoring-a88257e90beaaebbf7ebaca57cc871fceb93fda9.zip
chore: bump axum and askama
Fix breaking changes in markdown and templating
-rw-r--r--Cargo.lock166
-rw-r--r--Cargo.toml9
-rw-r--r--src/main.rs2
-rw-r--r--src/posts/fs_post.rs4
-rw-r--r--src/tutors/fs_tutor.rs4
-rw-r--r--templates/about/blurb.html.j24
-rw-r--r--templates/post.html.j22
7 files changed, 91 insertions, 100 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2c8ccf2..b7f3de8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -28,69 +28,44 @@ dependencies = [
[[package]]
name = "askama"
-version = "0.12.1"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28"
+checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4"
dependencies = [
"askama_derive",
- "askama_escape",
- "comrak",
- "humansize",
- "num-traits",
+ "itoa",
"percent-encoding",
-]
-
-[[package]]
-name = "askama_axum"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a41603f7cdbf5ac4af60760f17253eb6adf6ec5b6f14a7ed830cf687d375f163"
-dependencies = [
- "askama",
- "axum-core",
- "http",
+ "serde",
+ "serde_json",
]
[[package]]
name = "askama_derive"
-version = "0.12.5"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83"
+checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f"
dependencies = [
"askama_parser",
"basic-toml",
- "mime",
- "mime_guess",
+ "memchr",
"proc-macro2",
"quote",
+ "rustc-hash",
"serde",
+ "serde_derive",
"syn",
]
[[package]]
-name = "askama_escape"
-version = "0.10.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
-
-[[package]]
name = "askama_parser"
-version = "0.2.1"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0"
+checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358"
dependencies = [
- "nom",
-]
-
-[[package]]
-name = "async-trait"
-version = "0.1.88"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "memchr",
+ "serde",
+ "serde_derive",
+ "winnow",
]
[[package]]
@@ -101,13 +76,13 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "axum"
-version = "0.7.9"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
+checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
dependencies = [
- "async-trait",
"axum-core",
"bytes",
+ "form_urlencoded",
"futures-util",
"http",
"http-body",
@@ -135,13 +110,12 @@ dependencies = [
[[package]]
name = "axum-core"
-version = "0.4.5"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
+checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
dependencies = [
- "async-trait",
"bytes",
- "futures-util",
+ "futures-core",
"http",
"http-body",
"http-body-util",
@@ -201,9 +175,9 @@ name = "carpentertutoring"
version = "0.2.0"
dependencies = [
"askama",
- "askama_axum",
"axum",
"chrono",
+ "comrak",
"tokio",
"tower",
"tower-http",
@@ -212,6 +186,15 @@ dependencies = [
]
[[package]]
+name = "caseless"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b6fd507454086c8edfd769ca6ada439193cdb209c7681712ef6275cccbfe5d8"
+dependencies = [
+ "unicode-normalization",
+]
+
+[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -228,14 +211,13 @@ dependencies = [
[[package]]
name = "comrak"
-version = "0.18.0"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894"
+checksum = "d5c834ca54c5a20588b358f34d1533b4b498ddb5fd979cec6b22d0e8867a2449"
dependencies = [
+ "caseless",
"entities",
"memchr",
- "once_cell",
- "regex",
"slug",
"typed-arena",
"unicode_categories",
@@ -243,9 +225,9 @@ dependencies = [
[[package]]
name = "deunicode"
-version = "1.6.1"
+version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc55fe0d1f6c107595572ec8b107c0999bb1a2e0b75e37429a4fb0d6474a0e7d"
+checksum = "abd57806937c9cc163efc8ea3910e00a62e2aeb0b8119f1793a978088f8f6b04"
[[package]]
name = "entities"
@@ -366,15 +348,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
-name = "humansize"
-version = "2.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
-dependencies = [
- "libm",
-]
-
-[[package]]
name = "hyper"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -428,12 +401,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
[[package]]
-name = "libm"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
-
-[[package]]
name = "log"
version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -450,9 +417,9 @@ dependencies = [
[[package]]
name = "matchit"
-version = "0.7.3"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
+checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
[[package]]
name = "memchr"
@@ -477,12 +444,6 @@ dependencies = [
]
[[package]]
-name = "minimal-lexical"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
-
-[[package]]
name = "miniz_oxide"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -503,16 +464,6 @@ dependencies = [
]
[[package]]
-name = "nom"
-version = "7.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
-dependencies = [
- "memchr",
- "minimal-lexical",
-]
-
-[[package]]
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -639,6 +590,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
+name = "rustc-hash"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+
+[[package]]
name = "rustversion"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -767,6 +724,21 @@ dependencies = [
]
[[package]]
+name = "tinyvec"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
name = "tokio"
version = "1.45.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -940,6 +912,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
+name = "unicode-normalization"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
name = "unicode_categories"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1109,3 +1090,12 @@ name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "winnow"
+version = "0.7.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
+dependencies = [
+ "memchr",
+]
diff --git a/Cargo.toml b/Cargo.toml
index d10edd3..30bd9f9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,13 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-askama = { version = "0.12", features = [
- "markdown",
- "with-axum",
-], default-features = false }
-askama_axum = "0.4"
-axum = "0.7"
+askama = { version = "0.14" }
+axum = "0.8"
chrono = { version = "0.4", default-features = false, features = ["now"] }
+comrak = { version = "0.39.0", default-features = false }
tokio = { version = "1.45", default-features = false, features = [
"rt-multi-thread",
"macros",
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()))
}
}
diff --git a/templates/about/blurb.html.j2 b/templates/about/blurb.html.j2
index 4389d47..a5e91d3 100644
--- a/templates/about/blurb.html.j2
+++ b/templates/about/blurb.html.j2
@@ -1,3 +1,3 @@
<div id="{{ tutor.get_id() }}">
- {{ tutor.get_blurb()|markdown }}
-</div>
+ {{ tutor.get_blurb() | safe }}
+</div> \ No newline at end of file
diff --git a/templates/post.html.j2 b/templates/post.html.j2
index e1c447a..2d70ebc 100644
--- a/templates/post.html.j2
+++ b/templates/post.html.j2
@@ -18,7 +18,7 @@
<section>
<article>
- {{ post.get_article()|markdown }}
+ {{ post.get_article() | safe }}
</article>
</section>
{% endblock %} \ No newline at end of file