Skip to content

Commit c2077e9

Browse files
committedMar 13, 2025
Restyle figure captions
* Change 11ty/liquid script to wrap the auto-generated "Figure X" in a `<span>` * Add CSS overrides Closes #4241
1 parent 3231652 commit c2077e9

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
 

‎11ty/CustomLiquid.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export class CustomLiquid extends Liquid {
243243
$("figcaption").each((i, el) => {
244244
const $el = $(el);
245245
if (!$el.find("p").length) $el.wrapInner("<p></p>");
246-
$el.prepend(`Figure ${i + 1}`);
246+
$el.prepend(`<span>Figure ${i + 1}</span>`);
247247
});
248248

249249
// Remove spurious copy-pasted content in 2.5.3 that doesn't belong there

‎css/base.css

+20-1
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,25 @@ margin-right:.8em;
430430
margin-left: 2em;
431431
}
432432

433+
/* overrides for restyled figure captions */
434+
435+
figure {
436+
margin: 2em 0;
437+
}
438+
439+
figcaption {
440+
font-weight: initial;
441+
border-bottom: initial;
442+
font-size: 0.9rem;
443+
padding-left: 1em;
444+
border-left: 2px solid #005a9c;
445+
border-left: 2px solid var(--w3c-classic);
446+
}
447+
448+
figcaption > span {
449+
font-weight: bold;
450+
}
451+
433452
@media (max-width: 35em) {
434453
.nav-container {
435454
padding: 0;
@@ -438,7 +457,7 @@ margin-right:.8em;
438457
display: inline-block;
439458
width: calc(100% - 2em);
440459
}
441-
@supports (display:gred) {
460+
@supports (display:grid) {
442461
#site-header {
443462
padding-left: 0;
444463
}

0 commit comments

Comments
 (0)