Skip to content

Images

Render markdown images from remote URLs or data URLs.

Syntax

markdown
![Alt text](https://example.com/image.png)
![Photo](https://example.com/photo.png){width=200 align=center}
![Logo](data:image/png;base64,...){h=120 align=right}

Attribute Controls

Use {...} after image markdown:

AttributeAliasTypeDescription
widthwnumberWidth in px
heighthnumberHeight in px
align-stringleft | center | right

Sizing Rules

  • No attributes: intrinsic image size (scaled down to page bounds when needed).
  • Width only: height auto-calculated to preserve aspect ratio.
  • Height only: width auto-calculated to preserve aspect ratio.
  • Width + height: exact dimensions (can distort aspect ratio).
  • Final image is constrained by page.maxContentWidth and page height bounds.

Block vs Inline

  • Block image: image-only paragraph supports alignment.
  • Inline image: image in text flow ignores block alignment and follows line layout.

Security-Aware Behavior

When security.enabled is true, image handling can enforce:

  • protocol allowlist (allowedImageProtocols)
  • domain allowlist (allowedImageDomains)
  • remote image toggle (allowRemoteImages)
  • data URL toggle (allowDataUrls)
  • SVG toggle (allowSvgImages)
  • SSRF host/IP checks
  • size limits (maxImageSizeBytes) using decoded bytes for data URLs
  • image count and nesting limits at parsed-tree stage

Blocked images follow violationMode:

  • skip: dropped
  • throw: render aborts with SecurityViolationError
  • placeholder: replaced with placeholderImageText

Browser SSRF Note

In browser runtimes, DNS resolution APIs are not available, so IP-level SSRF checks are best-effort only. For strict SSRF policy, route remote image fetching through a trusted server-side proxy.

Relevant Options

OptionEffect
image.defaultAlignDefault alignment for block images
spacing.afterImageSpacing after images
security.allowRemoteImagesAllow or deny http/https image fetches
security.allowedImageDomainsOptional host allowlist (undefined allow-all, [] deny-all)
security.maxImageSizeBytesMax image payload bytes
security.placeholderImageTextPlaceholder text in placeholder mode

Try It

Interactive

Try this element in the Playground.

Released under the MIT License.