Skip to content

feat(docs): render Markdown images inline - #4607

Draft
tellaho wants to merge 1 commit into
mainfrom
tho/doc-markdown-images
Draft

tellaho wants to merge 1 commit into
mainfrom
tho/doc-markdown-images

Conversation

@tellaho

@tellaho tellaho commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Category: improvement
User Impact: People can see images alongside the text they’re reading or editing in Buzz Docs.

Problem

Markdown images in Docs appear as alt text in the reader and as Markdown syntax in formatted Editing. People have to open the image separately to see it in context.

Solution

Render HTTPS Markdown images inline in Viewing, formatted Editing, and revision previews. Keep the image syntax available in Markdown source and use the session’s existing media handling for relay-hosted images.

File changes

docs/buzz-help.md
Explains where Docs displays images and where to edit their Markdown.

src/bundled/docs/DocDialogs.tsx
Enables images in revision previews.

src/bundled/docs/DocDocument.tsx
Passes the connected relay session to the editor for saved Docs.

src/bundled/docs/DocDocument.test.tsx
Covers linked images, reference images, relay media resolution, and URL filtering in Docs.

src/bundled/docs/DocEditor.tsx
Enables image previews in the formatted Docs editor.

src/bundled/docs/DocMarkdown.tsx
Enables images when viewing a Doc.

src/bundled/docs/NewDocDocument.tsx
Passes the connected relay session to the editor for new Docs.

src/features/markdown/Markdown.module.css
Scales inline images to fit the available width and preserves their aspect ratios.

src/features/markdown/MarkdownDocument.tsx
Adds opt-in HTTPS image rendering and an alt-text fallback. External image requests omit the referrer.

src/features/messages/DocumentEditor.tsx
Carries the image option through the editor’s formatted and source modes.

src/features/messages/DocumentEditor.test.tsx
Covers typing, copying, and pasting images while preserving their source.

src/features/messages/EditableInput.tsx
Shows document image previews and integrates them with typing and paste.

src/features/messages/PluginMarkdown.tsx
Exposes opt-in image rendering to document surfaces using the plugin UI API.

src/features/messages/composer-clipboard.ts
Preserves the image Markdown when copying and restores inline previews when pasting into an enabled document.

src/features/messages/composer-document.ts
Adds an inline image node that retains its original Markdown as the editor’s source.

src/features/messages/document-editor-markdown.ts
Recognizes Markdown images and resolves references for formatted previews.

src/features/messages/label-text.ts
Uses the image’s alt text when it provides a link label.

Try it

  1. Open a Doc in Editing and paste ![Diagram](https://example.com/diagram.png) with the URL of a reachable HTTPS image.
  2. Check that the image previews inline, then switch to Viewing and check that it also appears there.
  3. Return to Editing and open Doc actions → Markdown source. The image syntax is available for editing.

Validation

  • 398 focused tests passed across Docs, document editing, clipboard handling, and Markdown trust rules.
  • Headless Chromium and WebKit passed the bundled Docs suite and an image-loading smoke test.
  • Captured the final commit in Chromium and WebKit at standard and enlarged text sizes using a fictional Doc.

Screenshots and walkthrough

Viewing

Docs in Viewing mode with a shoreline map rendered inline

Formatted Editing

Docs in formatted Editing mode with the same map rendered inline

docs-markdown-images.mp4

Preview HTTPS Markdown images in the Docs reader, editor and revision history. Keep their source available for editing and use the existing media transport for relay-hosted images.

Co-authored-by: Rizz <302abe414ca6e3134763d2539bfcf145aea2a63fe5f8455204ed602fd40cf381@buzz.block.builderlab.xyz>
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant