Monorepo for Tangled tangled.org

web/markup: HTML height attribute on <img> is ignored in rendered markdown #4865

Open sntx.space
Open opened by sntx.space

In rendered Markdown (e.g. repository READMEs), <img> tags with an HTML height attribute (and no width attribute) don't respect their specified height:

<img src="./.rsc/logo.svg" alt="Logo" height="128">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="./.rsc/AI-R-dark.svg">
  <img src="./.rsc/AI-R-light.svg" alt="AI:R" height="22">
</picture>

Instead of rendering at 128px / 22px tall, images render at their full intrinsic size. And SVGs with only a viewBox expand to fill the entire container width.

sanitize.ts preserves the height attribute, so this appears to be caused by Tailwind Preflight's img, video { height: auto; } overriding the HTML presentational hint.

Sign up or Sign in to add to the discussion.