markdown: Render soft breaks as line breaks in agent markdown - #57376
Merged
smitbarmase merged 2 commits intoJun 16, 2026
Conversation
tredondo
force-pushed
the
fix-markdown-emoji-newlines
branch
2 times, most recently
from
May 21, 2026 10:54
04ec4f9 to
314706e
Compare
Adds a `soft_break_as_hard_break` field on `MarkdownStyle` and enables it for `MarkdownFont::Agent`, so a single newline within a paragraph in agent output renders as a line break instead of a space. Matches GitHub comments and Obsidian default behavior, and prevents emoji + trailing newline content from being collapsed onto a single line in agent responses.
tredondo
force-pushed
the
fix-markdown-emoji-newlines
branch
from
May 28, 2026 20:51
314706e to
ac4d7f9
Compare
smitbarmase
enabled auto-merge
June 16, 2026 16:11
This was referenced Jun 18, 2026
Closed
liusuren123
pushed a commit
to liusuren123/zed
that referenced
this pull request
Jun 30, 2026
…dustries#57376) Agents sometimes output status lists with bullets represented by emojis - see zed-industries#57372. These currently get rendered on one line, as opposed to bullet items like `-` or `*`, because single newlines within a paragraph are collapsed into spaces - standard CommonMark soft-break behavior *in prose* contexts (e.g. `README.md`). But in *comment/PR* contexts, GitHub preserves these newlines: ✅ Did A ✅ Did B ✅ Did C Users reasonably expect agent output to be rendered following the comment-style convention. ## What this PR does This PR adds a `soft_break_as_hard_break: bool` field on `MarkdownStyle` and enables it for `MarkdownFont::Agent`, so a single newline within a paragraph *in agent output* renders as a line break instead of a space. The field defaults to `false` to preserves CommonMark behavior everywhere else. In `themed_with_overrides`, sets it to `true` for `MarkdownFont::Agent`. The rendering switch in `MarkdownElement::request_layout` then emits `"\n"` instead of `" "` for `MarkdownEvent::SoftBreak` when the flag is set. This matches GitHub comments and Obsidian default behavior, and prevents emoji + trailing newline content from being collapsed onto a single line in agent responses. Scoped strictly to `MarkdownFont::Agent`. Hover popovers, diagnostics, markdown preview, README rendering, etc. are all untouched. 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) - [ ] Tests cover the new/changed behavior - visual tests completed: <img width="892" height="632" alt="image" src="https://github.com/user-attachments/assets/1aacb5da-edc8-49fd-bfe9-d37a22ae2d3f" /> - [x] Performance impact has been considered and is acceptable Closes zed-industries#57372 Release Notes: - Improved agent panel markdown rendering: single newlines within agent responses now render as line breaks, matching the convention used by GitHub comments and Obsidian. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
…dustries#57376) Agents sometimes output status lists with bullets represented by emojis - see zed-industries#57372. These currently get rendered on one line, as opposed to bullet items like `-` or `*`, because single newlines within a paragraph are collapsed into spaces - standard CommonMark soft-break behavior *in prose* contexts (e.g. `README.md`). But in *comment/PR* contexts, GitHub preserves these newlines: ✅ Did A ✅ Did B ✅ Did C Users reasonably expect agent output to be rendered following the comment-style convention. ## What this PR does This PR adds a `soft_break_as_hard_break: bool` field on `MarkdownStyle` and enables it for `MarkdownFont::Agent`, so a single newline within a paragraph *in agent output* renders as a line break instead of a space. The field defaults to `false` to preserves CommonMark behavior everywhere else. In `themed_with_overrides`, sets it to `true` for `MarkdownFont::Agent`. The rendering switch in `MarkdownElement::request_layout` then emits `"\n"` instead of `" "` for `MarkdownEvent::SoftBreak` when the flag is set. This matches GitHub comments and Obsidian default behavior, and prevents emoji + trailing newline content from being collapsed onto a single line in agent responses. Scoped strictly to `MarkdownFont::Agent`. Hover popovers, diagnostics, markdown preview, README rendering, etc. are all untouched. 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) - [ ] Tests cover the new/changed behavior - visual tests completed: <img width="892" height="632" alt="image" src="https://github.com/user-attachments/assets/1aacb5da-edc8-49fd-bfe9-d37a22ae2d3f" /> - [x] Performance impact has been considered and is acceptable Closes zed-industries#57372 Release Notes: - Improved agent panel markdown rendering: single newlines within agent responses now render as line breaks, matching the convention used by GitHub comments and Obsidian. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
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.
Agents sometimes output status lists with bullets represented by emojis - see #57372. These currently get rendered on one line, as opposed to bullet items like
-or*, because single newlines within a paragraph are collapsed into spaces - standard CommonMark soft-break behavior in prose contexts (e.g.README.md). But in comment/PR contexts, GitHub preserves these newlines:✅ Did A
✅ Did B
✅ Did C
Users reasonably expect agent output to be rendered following the comment-style convention.
What this PR does
This PR adds a
soft_break_as_hard_break: boolfield onMarkdownStyleand enables it forMarkdownFont::Agent, so a single newline within a paragraph in agent output renders as a line break instead of a space. The field defaults tofalseto preserves CommonMark behavior everywhere else. Inthemed_with_overrides, sets it totrueforMarkdownFont::Agent. The rendering switch inMarkdownElement::request_layoutthen emits"\n"instead of" "forMarkdownEvent::SoftBreakwhen the flag is set. This matches GitHub comments and Obsidian default behavior, and prevents emoji + trailing newline content from being collapsed onto a single line in agent responses.Scoped strictly to
MarkdownFont::Agent. Hover popovers, diagnostics, markdown preview, README rendering, etc. are all untouched.Self-Review Checklist:
Closes #57372
Release Notes: