Markdown messages are rendered through MessageResponse in
packages/ui/src/components/ai-elements/message.tsx.
The shared chat and file-preview type scale is compact and explicit: body text,
paragraphs, lists, links, tables, and H3-H6 use text-ui-base; H1 uses text-lg;
H2 uses text-ui-lg; inline code uses text-ui-sm. Fenced code blocks continue to
use the independent code font-size preference.
Strikethrough follows the GFM specification rather than GitHub's permissive
single-tilde extension: only ~~text~~ renders as strikethrough. A paired single
tilde such as ~text~ remains literal text in completed and streaming messages.
The markdown renderer now routes high-impact block elements through local UI components instead of relying only on Streamdown defaults:
CodeBlock and CodeViewer, with syntax highlighting delayed
while a message is streaming.markdown-table.tsx for the action toolbar, bordered container,
horizontal scroll, edge shadow hint, and wrapping cell content. Tables should
keep natural column sizing so many columns can still expand into horizontal
scroll, while each cell has a readable max width so one long prose/URL/token
wraps inside the cell instead of forcing the whole table wider. The bordered
table frame should stay fixed around the viewport, while the wide table content
scrolls inside that frame; edge shadows remain inside the frame to hint when
more columns are available. The action toolbar order is copy,
download, preview: copy writes a generated Markdown table, download saves CSV,
and preview opens an app-modal table view whose width and height follow the
table content until constrained by a 64px viewport margin on every side. When
the preview table scrolls vertically, its header cells stay pinned to the top
of the preview scroll viewport with an opaque semantic background. The virtual
horizontal scrollbar may stick above the composer for tall tables in the main
chat viewport, but tables in subagent prompt, thought, and output panels keep the
scrollbar at the table bottom.markdown-blockquote.tsx for the shared quote rail and text
treatment.markdown-list.tsx for consistent spacing,
markers, and nested list rhythm.markdown-image.tsx for Markdown grouping and the shared
image-preview-dialog.tsx for preview interaction. A run containing at least two adjacent,
image-only Markdown blocks is rendered as one gallery. Text, headings, lists,
code, or other block content ends the run. At desktop widths the gallery keeps
a fixed 176px thumbnail height and wraps onto additional rows when the available
width is exhausted; the gallery does not introduce horizontal scrolling. Below
the desktop breakpoint it wraps into two columns, and below the small breakpoint
it wraps into one column. A single image keeps its natural aspect ratio while
being constrained to at most half the message width and max-h-90. Clicking
any rendered Markdown image opens an app-modal preview; gallery images can be
traversed as one group with arrow-left/arrow-right controls placed on the left
and right sides of the viewport and vertically centered on screen, plus keyboard
arrows.
The image is centered in a viewport-sized canvas. Once zoomed beyond the canvas,
it supports bounded mouse or single-touch dragging; two-touch pinch adjusts zoom
without allowing the image to be dragged completely out of view. Changing images
resets zoom and position. The bottom toolbar is a compact pill containing only
circular zoom-out and zoom-in buttons with the current zoom percentage between
them. The preview supports bounded zoom and uses
circular, bordered download and close buttons in the top-right corner, with
download placed to the left of close.
Both buttons fade their background surface to 80% opacity on hover. Downloading
saves the currently visible preview image, including remote HTTP(S) and resolved
local images. Desktop streams HTTP(S) sources in main after rejecting
local/private/reserved initial and redirect destinations and pins the
validated address set into each actual connection, with a 30-second
timeout, five-redirect limit, and 50 MiB bound before writing the native Save
As destination. Web uses a bounded response reader when CORS permits and otherwise
delegates the HTTP(S) source to browser-native navigation. Cancellation is silent, while failures and
successful saves provide explicit feedback. Local images continue to load through the
injected fileService; HTTP(S) images continue to load directly in the browser.
Browser Use / node_repl result images use the same thumbnail gallery and
preview dialog while retaining tool-result grouping and result-derived filenames.Keep new markdown block styling in these renderer components when possible.
MessageResponse should stay focused on connecting Streamdown component names to
the local renderers.