Skip to content

fix(markdown_parser): render <br> tags as real line breaks - #16972

Open
sanketpatel32 wants to merge 1 commit into
warpdotdev:masterfrom
sanketpatel32:sanketpatel32/fix-br-line-break
Open

sanketpatel32 wants to merge 1 commit into
warpdotdev:masterfrom
sanketpatel32:sanketpatel32/fix-br-line-break

Conversation

@sanketpatel32

Copy link
Copy Markdown

Description

Renders inline <br> tags as real line breaks in markdown text.

<br> was not tokenized by the inline parser, so agent messages (and other markdown surfaces) showing HTML-style line breaks rendered the tag literally instead of breaking the line.

The inline tokenizer now recognizes <br> / <br/> / <br /> (case-insensitive) and emits a \n inside the fragment text. After inline styles are resolved, paragraph lines are split on \n into separate FormattedTextLines — so emphasis spanning a break (**bold<br>text**) keeps its styling on both resulting lines. Consecutive <br> tags produce blank lines, and a trailing <br> ends the line without inventing an extra blank one. Inside table cells (which are single-line by design) a <br> degrades to a separating space; inside code spans it stays literal text.

Linked Issue

Resolves #13732

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

Added unit tests in crates/markdown_parser/src/markdown_parser_tests.rs covering:

  • mid-paragraph <br>, <br/>, and <br /> variants
  • consecutive <br> producing a blank line
  • emphasis preserved across a break
  • <br> inside a table cell degrading to a space
  • <br> inside a code span staying literal

cargo test -p markdown_parser — all 160 tests pass. cargo clippy -p markdown_parser clean.

Manual verification via a temporary example binary driving parse_markdown through the same FormattedText output the renderers consume:

=== input: "first<br>second"
  "first\n"
  "second\n"
=== input: "a<br><br>b"
  "a\n"
  "\n"
  "b\n"
=== input: "**bold<br>still bold**"
  "bold\n"
  "still bold\n"
  • I have manually tested my changes locally with ./script/run

./script/run requires a GPU-backed display and a signed-in session, which is not available in my headless Linux environment, so GUI-level manual testing wasn't possible; verification is via the automated tests and the render-path demo above.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Render <br> tags as line breaks in agent markdown output

Raw <br> tags in markdown previously rendered as literal text. Parse
<br>, <br/>, and <br /> (case-insensitive) as inline line-break tokens:
paragraphs split into separate lines at each break, and table cells
degrade to a separating space since cells are single-line.

Resolves warpdotdev#13732
@cla-bot

cla-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @sanketpatel32 on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Nov 24, 2026
@sanketpatel32

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Nov 24, 2026
@cla-bot

cla-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown viewer: support <br> for explicit line breaks

1 participant