David AlecrimandSmit Barmase 5a5242ffeb markdown: Render inline <br> tags as line breaks (#54165)
## 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>
2026-06-24 10:22:36 +00:00
2026-04-30 11:10:14 +00:00
2026-06-23 23:54:28 +00:00
2026-06-05 23:12:31 +00:00
2026-05-27 18:17:59 +00:00
2026-01-22 23:57:26 +05:30
WIP
2023-12-14 09:25:14 -07:00
2026-04-29 10:27:47 +00:00
2025-02-04 09:02:59 -05:00
2026-01-06 12:49:51 -08:00
2025-10-27 13:27:59 -04:00
2025-10-17 18:58:14 +00:00
2026-03-17 16:34:35 +00:00
2026-04-29 10:27:47 +00:00
2026-05-27 16:27:18 +00:00

Zed

Zed CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).

Other platforms are not yet available:

Developing Zed

Contributing

See CONTRIBUTING.md for ways you can contribute to Zed.

Also... we're hiring! Check out our jobs page for open roles.

Licensing

Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.

License information for third party dependencies must be correctly provided for CI to pass.

We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:

  • Is it showing a no license specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.

Sponsorship

Zed is developed by Zed Industries, Inc., a for-profit company.

If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.

  • me: do a nixos integration test (using KVM)
  • agent: i need to turn off the sandbox
  • me: "allow for this thread"
  • agent: runs the tests unsandboxed
  • me: use the terminal to ls this directory
  • agent: runs ls sandboxed
S
Description
No description provided
Readme
411 MiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 94.9%
JSON-with-Comments 2.7%
Python 0.8%
Inno Setup 0.3%
Tree-sitter Query 0.3%
Other 0.5%