This commit is contained in:
Mylloon 2024-12-15 19:36:52 +01:00
parent 67926e312b
commit 519236a561
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 18 additions and 6 deletions

View file

@ -203,12 +203,19 @@ fn fix_headers_ids(html: &str) -> String {
rewrite_str( rewrite_str(
html, html,
RewriteStrSettings { RewriteStrSettings {
element_content_handlers: vec![element!("a[href^='#']", |el| { // 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") { if let Some(id) = el.get_attribute("id") {
el.set_attribute("href", &format!("#{id}")).unwrap(); el.set_attribute("href", &format!("#{id}")).unwrap();
}; };
Ok(()) Ok(())
})], }
)],
..RewriteStrSettings::default() ..RewriteStrSettings::default()
}, },
) )

View file

@ -151,6 +151,11 @@ section.footnotes * {
font-size: calc(var(--font-size) * 0.8); 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 */ /* When multiple ref */
a.footnote-backref sup { a.footnote-backref sup {
font-size: calc(var(--font-size) * 0.6); font-size: calc(var(--font-size) * 0.6);