Skip to content

fix: normalizer does not strip br nodes inside blockquote - #720

Merged
hejsztynx merged 1 commit into
mainfrom
@ksienkiewicz/fix-normalizer-br-in-blockquote
Jul 22, 2026
Merged

fix: normalizer does not strip br nodes inside blockquote#720
hejsztynx merged 1 commit into
mainfrom
@ksienkiewicz/fix-normalizer-br-in-blockquote

Conversation

@hejsztynx

@hejsztynx hejsztynx commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

The <br> was getting stripped when inside of a <blockquote>

The example HTML that was reproducing the issue:

<html><blockquote><p>this is a pretty short blockquote.</p><br><p>This is a line after an empty line.</p></blockquote></html>

Screenshots

When setting the input's value with that HTML I mentioned in the summary.

Before:

image

After:

image

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes HTML normalization so <br> elements inside <blockquote> are preserved (instead of being dropped), keeping empty-line spacing within blockquotes consistent across web and native normalization paths.

Changes:

  • Update blockquote-flattening logic to emit a canonical <br> when a <br> is encountered with no pending inline paragraph content.
  • Adjust existing normalization expectations to include <br> inside blockquotes where appropriate.
  • Add targeted regression tests for <br> between blockquote paragraphs (TypeScript + C++/Gumbo).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/web/normalization/htmlNormalizer.ts Preserve <br> nodes during blockquote flattening by emitting <br> when no paragraph was flushed.
src/web/tests/htmlNormalizer.test.ts Update expected output and add a regression test covering <br> between blockquote paragraphs.
cpp/parser/GumboNormalizer.c Mirror the web normalizer behavior in the Gumbo-based native normalizer.
cpp/tests/GumboParserTest.cpp Update expected output and add a regression test for the Gumbo normalizer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kacperzolkiewski kacperzolkiewski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hejsztynx
hejsztynx merged commit 27659ec into main Jul 22, 2026
10 checks passed
@hejsztynx
hejsztynx deleted the @ksienkiewicz/fix-normalizer-br-in-blockquote branch July 22, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants