From d18b9639d7d31f9f9554aaba3fe8a4f749eac09b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 15 Dec 2024 19:53:32 +0100 Subject: [PATCH] correctly exclude footnotes from header id rewrite --- src/utils/markdown.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/markdown.rs b/src/utils/markdown.rs index 2a7d01f..d9cc594 100644 --- a/src/utils/markdown.rs +++ b/src/utils/markdown.rs @@ -209,11 +209,11 @@ fn fix_headers_ids(html: &str, path: Option<&FilePath>) -> String { rewrite_str( html, RewriteStrSettings { - // 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^='#']", + "a:not([data-footnote-ref]):not(.footnote-backref)[href^='#']", |el| { + println!("{el:?}"); + let id = el.get_attribute("id").unwrap_or( path_to_hid(path) + remove_first_letter(&el.get_attribute("href").unwrap()), );