Repository navigation
feat(zbugs-swift): show Markdown images, code blocks, lists, quotes, and tables - #170
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(newSources/ZBugsUI/Markdown.swift) parses with Foundation's.fullsyntax and turns each block it finds (PresentationIntent) into a view of its own:imageURLruns) 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.ScrollViewthere takes the scroll wheel's vertical scrolling and the page stops scrolling over it.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.tson 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 testandswift format lint --strictpass.