From 64cca1399b78024bda0128d6ffc0fd0520648e85 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Thu, 16 Jan 2025 00:44:03 +0100 Subject: [PATCH] nicer style rules for margin around footnote defs previous implementation used `:not(.fd) + .fd` and `.fd + :not(.fd)`. the latter selector caused many problems: - it doesn't select footnote defs which are last children (this can be easily triggered in a blockquote) - it changes the margin of the next sibling, rather than the footnote def itself, which can also *shrink* margin for elements with big margins (this happens to headings) - because it applies to the next sibling it is also quite hard to override in user styles, since it may apply to any element this commit replaces the latter selector with `:not(:has(+ .fd))`, which fixes all of the mentioned problems. --- src/theme/css/general.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/theme/css/general.css b/src/theme/css/general.css index 0862b51673..49e726732b 100644 --- a/src/theme/css/general.css +++ b/src/theme/css/general.css @@ -200,10 +200,12 @@ sup { line-height: 0; } -:not(.footnote-definition) + .footnote-definition, -.footnote-definition + :not(.footnote-definition) { +:not(.footnote-definition) + .footnote-definition { margin-block-start: 2em; } +.footnote-definition:not(:has(+ .footnote-definition)) { + margin-block-end: 2em; +} .footnote-definition { font-size: 0.9em; margin: 0.5em 0;