From 519236a561d34571882e970dce0ff425350346fc Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 15 Dec 2024 19:36:52 +0100 Subject: [PATCH] todos --- src/utils/markdown.rs | 19 +++++++++++++------ static/css/markdown.css | 5 +++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/utils/markdown.rs b/src/utils/markdown.rs index 1ffe1d5..1dbb26d 100644 --- a/src/utils/markdown.rs +++ b/src/utils/markdown.rs @@ -203,12 +203,19 @@ fn fix_headers_ids(html: &str) -> String { rewrite_str( html, RewriteStrSettings { - element_content_handlers: vec![element!("a[href^='#']", |el| { - if let Some(id) = el.get_attribute("id") { - el.set_attribute("href", &format!("#{id}")).unwrap(); - }; - Ok(()) - })], + // TODO: footnotes are broken + // This should be: a:not(.footnote-ref a, a.footnote-backref)[href^='#'] + element_content_handlers: vec![element!( + "a:not(.footnote-ref):not(.footnote-backref)[href^='#']", + |el| { + // TODO: Link without IDs are link manually created to a header + // Currently, this breaks them + if let Some(id) = el.get_attribute("id") { + el.set_attribute("href", &format!("#{id}")).unwrap(); + }; + Ok(()) + } + )], ..RewriteStrSettings::default() }, ) diff --git a/static/css/markdown.css b/static/css/markdown.css index 2e6f9d6..d6573b6 100644 --- a/static/css/markdown.css +++ b/static/css/markdown.css @@ -151,6 +151,11 @@ section.footnotes * { font-size: calc(var(--font-size) * 0.8); } +/* TODO: Hightlight targeted link, change by css theme */ +/* section.footnotes :target { + background-color: yellowgreen; +} */ + /* When multiple ref */ a.footnote-backref sup { font-size: calc(var(--font-size) * 0.6);