diff --git a/pages/index.md b/pages/index.md index b5767e6..da9753e 100644 --- a/pages/index.md +++ b/pages/index.md @@ -17,7 +17,7 @@ anyway here's a new todo list: - [x] page aliases (gotta keep all those old links working) - [x] rss/atom (tera is useful here too) - [x] code hilighting (syntact) -- [x] cache headers (pages uses etags, some others timestamps. it works) +- [x] cache headers (pages uses etags, feeds uses timestamps. it works) - [x] docker from-scratch image (it's small!) - [x] ~~opentelemetry (metrics, traces)~~ (ripped it our for now) - [ ] opentelemetry logs? (don't know if I'm gonna need it? can probably just make the collector grab them from the docker logs?) diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 35c239b..f4fbe27 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -57,10 +57,10 @@ impl IntoResponse for WebsiteError { WebsiteError::InternalError(e) => { match e.source() { Some(s) => { - error!("internal error: {}: {}", e, s); + error!("internal error: {e}: {s}"); } _ => { - error!("internal error: {}", e); + error!("internal error: {e}"); } } (StatusCode::INTERNAL_SERVER_ERROR, "internal error").into_response() diff --git a/src/main.rs b/src/main.rs index 13c1415..b62b99c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,7 @@ async fn main() -> Result<()> { let app = init_app(cfg).await?; let listener = TcpListener::bind(&addr).await.unwrap(); - info!("Bind address: {:?}, Base Url: {:?}", addr, url); + info!("Bind address: {addr:?}, Base Url: {url:?}"); axum::serve(listener, app.into_make_service()) .with_graceful_shutdown(shutdown_signal()) .await?; diff --git a/src/page.rs b/src/page.rs index 5cc0af0..ca6c235 100644 --- a/src/page.rs +++ b/src/page.rs @@ -4,6 +4,7 @@ use std::{ fs, hash::{Hash, Hasher}, path::Path, + time::Instant, }; use anyhow::Result; @@ -118,9 +119,15 @@ impl Page { #[instrument(skip(state))] pub fn load_all(state: &AppState, root: &Path, folder: &Path) -> Result<HashMap<String, Page>> { + let start = Instant::now(); let pages = load_recursive(state, root, folder, None)?; + let duration = start.elapsed(); - info!("{} pages loaded", pages.len()); + info!( + "{} pages loaded in {:.2}ms", + pages.len(), + duration.as_secs_f32() * 1000.0 + ); Ok(pages) } diff --git a/src/rendering/markdown.rs b/src/rendering/markdown.rs index c0abf03..e44ccbb 100644 --- a/src/rendering/markdown.rs +++ b/src/rendering/markdown.rs @@ -34,6 +34,8 @@ pub fn render_to_html(base_uri: Option<&Uri>, markdown: &str) -> RenderResult { opt.insert(Options::ENABLE_TASKLISTS); opt.insert(Options::ENABLE_SMART_PUNCTUATION); opt.insert(Options::ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS); + opt.insert(Options::ENABLE_SUPERSCRIPT); + opt.insert(Options::ENABLE_SUBSCRIPT); let mut content_html = String::with_capacity(markdown.len()); let parser = Parser::new_ext(markdown, opt);