Skip to content

Commit cdeb3eb

Browse files
Restyle figures and captions (#4276)
* Change 11ty/liquid script to wrap the auto-generated "Figure X" in a `` * Add CSS overrides * Add vertical line at margin that spans the indent of the image and caption [preview](https://deploy-preview-4276--wcag2.netlify.app/understanding/non-text-contrast) Closes #4241 --------- Co-authored-by: Mike Gower
1 parent b67cb7d commit cdeb3eb

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

11ty/CustomLiquid.ts

Lines changed: 1 addition & 1 deletion
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("

"
);
246-
$el.prepend(`Figure ${i + 1}`);
246+
$el.find("p").first().prepend(`Figure ${i + 1}. `);
247247
});
248248

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

css/base.css

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,26 @@ margin-right:.8em;
430430
margin-left: 2em;
431431
}
432432

433+
/* overrides for restyled figures and captions */
434+
435+
figure {
436+
margin: 2em 0;
437+
padding-left: 1em;
438+
border-left: 2px solid var(--cloudy);
439+
}
440+
441+
figure img,
442+
figure video,
443+
figure svg {
444+
border: 1px solid var(--line-grey);
445+
}
446+
447+
figcaption {
448+
font-weight: initial;
449+
border-bottom: initial;
450+
font-size: 0.9rem;
451+
}
452+
433453
@media (max-width: 35em) {
434454
.nav-container {
435455
padding: 0;
@@ -438,7 +458,7 @@ margin-right:.8em;
438458
display: inline-block;
439459
width: calc(100% - 2em);
440460
}
441-
@supports (display:gred) {
461+
@supports (display:grid) {
442462
#site-header {
443463
padding-left: 0;
444464
}

0 commit comments

Comments
 (0)