Skip to content

feat: normalizer preserves text alignment styles#702

Merged
hejsztynx merged 1 commit into
mainfrom
@ksienkiewicz/feat-normalizer-text-align
Jul 16, 2026
Merged

feat: normalizer preserves text alignment styles#702
hejsztynx merged 1 commit into
mainfrom
@ksienkiewicz/feat-normalizer-text-align

Conversation

@hejsztynx

Copy link
Copy Markdown
Collaborator

Summary

HTML normalizer did not preserve textAlignment styling attributes, so textAlignment was lost on re-normalization.

  • implemented the fix
  • added relevant normalizer tests

Test Plan

  • run added tests

When you used this html in the Set input's value in the example app before the fix, the text alignment was lost

<ul style="text-align: right"><li>Something</li></ul>

Videos

Before:

Screen.Recording.2026-07-15.at.16.32.11.mov

After:

The text alignment is preserved

Screen.Recording.2026-07-15.at.16.26.16.mov

Compatibility

OS Implemented
iOS
Android
Web

Checklist

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

Copilot AI review requested due to automatic review settings July 15, 2026 14:32

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

This PR fixes HTML normalization so that text-align styling is preserved across normalization passes (preventing textAlignment loss in downstream rendering), and adds regression tests to ensure consistent behavior across the web and Gumbo-based normalizers.

Changes:

  • Add canonical emission of style="text-align: ..." for specific block tags (p, ul/ol, h1h6) when the input contains a valid text-align value.
  • Preserve alignment when blockquote content is flattened into <p> nodes.
  • Add matching test coverage in both the web Jest suite and the C++ Gumbo parser tests.

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 Emits canonical text-align style for alignable tags and carries alignment through blockquote flattening.
src/web/tests/htmlNormalizer.test.ts Adds Jest test matrix covering valid/invalid alignment values, tag eligibility, and blockquote flattening behavior.
cpp/parser/GumboNormalizer.c Adds alignment parsing/canonicalization and propagates alignment during blockquote flattening in the native normalizer.
cpp/tests/GumboParserTest.cpp Adds native regression tests mirroring the web normalizer alignment expectations.

💡 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.

Alignment Looks and works properly.
But I found out some issue with spacing between paragraphs when using normalizer on iOS:
Edit: created fix for that issue: #704

Screen.Recording.2026-07-16.at.11.27.28.mov

@hejsztynx
hejsztynx merged commit 4bc6307 into main Jul 16, 2026
10 checks passed
@hejsztynx
hejsztynx deleted the @ksienkiewicz/feat-normalizer-text-align branch July 16, 2026 13:54
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.

3 participants