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);