Skip to content

feat(zbugs-swift): show Markdown images, code blocks, lists, quotes, and tables - #170

Merged
tmm merged 1 commit into
mainfrom
zbugs-swift-markdown-images
Nov 11, 2026
Merged

tmm merged 1 commit into
mainfrom
zbugs-swift-markdown-images

Conversation

@tmm

@tmm tmm commented Nov 11, 2026

Copy link
Copy Markdown
Member

Issue descriptions and comments in zbugs-swift went through Text(AttributedString(markdown:, .inlineOnlyPreservingWhitespace)), which shows only inline Markdown: on rocicorp#3000 the screenshot showed as the word "image" and the stack trace ran together.

MarkdownView (new Sources/ZBugsUI/Markdown.swift) parses with Foundation's .full syntax and turns each block it finds (PresentationIntent) into a view of its own:

  • Images (imageURL runs) load over URLSession at their own size, narrower to fit, cached in memory; a placeholder while loading, a link to the image when it fails.
  • Code blocks are monospaced on a background. On iOS long lines scroll sideways as on the web; on macOS they wrap, since a horizontal ScrollView there takes the scroll wheel's vertical scrolling and the page stops scrolling over it.
  • Headings, ordered and nested lists (with their real numbers), block quotes, tables, and rules.

No new package. Like zbugs' web app (react-markdown without raw HTML), HTML <img> tags aren't rendered. An image inline in a sentence gets its own line. The page layout is unchanged.

Checked against server/server.ts on macOS 26 and the iPhone 17 simulator: rocicorp#3000 shows its screenshot and the code block. A test comment covered quotes, nested lists, a table, an inline image, a failed image, and a rule. swift test and swift format lint --strict pass.

…and tables

Issue descriptions and comments went through Text, which shows only
inline Markdown: an image showed as its alt text and a code block ran
together. Foundation's full parser now splits them into blocks, each a
view of its own, and images load from the web at their own size.

Amp-Thread-ID: https://ampcode.com/threads/T-7f9226a6-efbb-4638-918a-2912e07339b1
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm merged commit 02c6ab9 into main Nov 11, 2026
24 checks passed
@tmm
tmm deleted the zbugs-swift-markdown-images branch November 11, 2026 23:22
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.

2 participants