correctly exclude footnotes from header id rewrite

This commit is contained in:
Mylloon 2024-12-15 19:53:32 +01:00
parent 8de0c4ca04
commit d18b9639d7
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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()),
);