From 6b725c3b856f6310646234aac9849870b4459a10 Mon Sep 17 00:00:00 2001 From: Eric Schneider <37347760+eric-schneider@users.noreply.github.com> Date: Wed, 18 Nov 2026 21:22:04 -0600 Subject: [PATCH] Show SVG images that have no width of their own An SVG image whose file sets no width, such as one with only a viewBox or with width="100%", rendered at 0x0 and disappeared from the page. That holds for a block image, for an SVG embedded with an tag for interactivity, and for inline SVG. Stretch a block image's content box to the full width of the block and align the image inside it with text-align, as upstream's fcb2110 does. An SVG without a width then fills the column in Chromium, WebKit and Firefox, and the text-left and text-right roles still align narrower images. Upstream also sizes an SVG that has no width attribute with width: fit-content (f96f0fb), a rule docs-ui dropped in #61. It stays out: with the stretched content box it changes nothing in Chromium, and it shrinks such an SVG to the default object size in WebKit and to nothing in Firefox. --- src/css/asciidoc/doc.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/css/asciidoc/doc.css b/src/css/asciidoc/doc.css index eeeb31e..b10b823 100644 --- a/src/css/asciidoc/doc.css +++ b/src/css/asciidoc/doc.css @@ -453,16 +453,29 @@ align-items: center; } + .doc .imageblock .content { + align-self: stretch; + text-align: center; + } + .doc .imageblock.text-left, .doc .videoblock.text-left { align-items: flex-start; } + .doc .imageblock.text-left .content { + text-align: left; + } + .doc .imageblock.text-right, .doc .videoblock.text-right { align-items: flex-end; } + .doc .imageblock.text-right .content { + text-align: right; + } + .doc .imageblock img, .doc .imageblock object, .doc .imageblock svg,