## Summary Inline `<br>` tags in markdown (e.g. `<br>`, `<br/>`, `<br />`) were rendered as literal text instead of line breaks when images are around. VS Code and GitHub both treat them as hard line breaks. The fix has two layers: **Parser (`parser.rs`):** The text-merge loop was consuming `InlineHtml` events as empty text. `<br>` variants are now excluded from that loop and converted to `HardBreak` events instead, matching the semantics of a trailing two-space or backslash line break in CommonMark. **Renderer (`markdown.rs`):** Image paragraphs use a flex row layout, so text `\n` has no effect. `HardBreak` inside an image paragraph now inserts a `div().w_full().h_0()` child, which forces a flex-wrap row break. Images also get `mr_2()`/`mb_2()` margins for spacing, replacing the previous `SoftBreak`-as-space hack. `SoftBreak` is suppressed inside image paragraphs to avoid phantom whitespace elements disrupting the flex layout. ## Screenshots ### Before How Zed WAS rendering this: <img width="629" height="601" alt="Screenshot 2026-04-17 at 07 53 26" src="https://github.com/user-attachments/assets/cbfa6c81-83ea-467a-b73f-a2efef953bb4" /> ### Comparison This is how Github renders this: <img width="1006" height="911" alt="Screenshot 2026-04-17 at 07 06 49" src="https://github.com/user-attachments/assets/6ee286c6-026b-4a85-a931-c61cf24370ba" /> This is how VS Code renders this: <img width="1511" height="947" alt="Screenshot 2026-04-17 at 07 03 36" src="https://github.com/user-attachments/assets/1bc41c85-bb3d-48c6-9e21-cd96327c43c6" /> ### After This is the end result after the changes: <img width="821" height="807" alt="Screenshot 2026-04-17 at 07 45 32" src="https://github.com/user-attachments/assets/8882abaa-dc07-45fb-9aaa-a908712dce65" /> [Created this Github repo for testing ](https://github.com/davidalecrim1/zed-md-test) Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed inline `<br>` tags in markdown previews rendering as literal text instead of line breaks --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2 files changedLine totals unavailable