Skip to content

fix(site): don't caption badges, center image captions - #331

Merged
petermuessig merged 1 commit into
mainfrom
fix/image-caption-alignment
Aug 13, 2026
Merged

fix(site): don't caption badges, center image captions#331
petermuessig merged 1 commit into
mainfrom
fix/image-caption-alignment

Conversation

@petermuessig

Copy link
Copy Markdown
Contributor

Two follow-up fixes to the alt-text image caption feature added in #329 (renderImageCaptions in assets/js/custom.js).

1. Badges no longer get a caption

The REUSE status badge on the root README ([![REUSE status](…)](…)) was rendering its alt text ("REUSE status") as a stray caption. Linked images in the tutorials are always badges/icons, never preview screenshots (content images are plain ![alt](assets/…)), so the runtime now skips any image wrapped in an <a>.

2. Image and caption are centered together

Before, the <figure> was full-width and only the caption text was centered — so on a left-aligned image the caption floated to the middle of the page, disconnected from the image. Now the figure shrink-wraps to the image (display: table; margin: 16px auto) and is centered on the page, with the caption centered directly beneath the image.

Verification

Checked in the browser via the local dev server:

  • Root README: REUSE badge is no longer wrapped in a figure and shows no caption.
  • Tutorial step pages: figure is centered on the page (equal margins) and the caption is centered under the image (image + caption centers aligned).

Two fixes to the alt-text image caption feature (renderImageCaptions):

- Skip link-wrapped images. Linked images in the tutorials are badges
  (e.g. the REUSE status badge `[![…](…)](…)`), not preview screenshots,
  so they must not get a caption. Previously the badge's alt ("REUSE
  status") rendered as a stray caption on the root README.
- Center the image and its caption together. The figure now shrink-wraps
  to the image (`display: table; margin: 16px auto`) and is centered on
  the page, with the caption centered beneath it. Before, the figure was
  full-width and only the caption was centered, so it floated to page
  center while a left-aligned image did not.

@margopolo margopolo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM

@petermuessig
petermuessig merged commit ebf73f1 into main Aug 13, 2026
3 checks passed
@petermuessig
petermuessig deleted the fix/image-caption-alignment branch August 13, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants