You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: Make normalizers switch codeblock newlines to <p> tags - #891
When working on other parser-related PRs, CodeRabbit found out that we can have content newlines inside codeblocks even after normalization step. The fix is relatively simple - if they exist, we instead map them to separate <p> tags. It's applied on both mobile Gumbo normalizer as well as the dedicated Web one.
Test Plan
Use setValue on an external html like:
<pre>if (x) {
y();
}</pre>
on any of the three platforms. It should be properly shown as three separate lines;
Reviewing files that changed from the base of the PR and between 0a65652 and d068a49.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Inline code-block content now becomes one paragraph per line break in both the C++ and TypeScript normalizers. Empty interior lines emit <br>, inline tags are reopened across lines, and content with block-producing children keeps its existing direct-walk path.
Changes: Code block line normalization
Layer / File(s)
Summary
Inline code-block line emission cpp/parser/GumboNormalizer.c, cpp/tests/GumboParserTest.cpp, src/web/normalization/htmlNormalizer.ts, src/web/__tests__/htmlNormalizer.test.ts
Both normalizers split inline code-block content at newlines and <br> tags, preserve indentation, and reopen inline tags across paragraphs. Empty interior lines emit <br>, trailing empty lines are omitted, and block-producing children still use the direct-walk path. Tests cover these cases.
This change makes multi-line code blocks keep their line breaks as separate paragraphs in the native and Web normalizers. The change is contained to code-block normalization and has unit tests for the main line-splitting cases. No concrete merge-blocking problem was established. The remaining uncertainty is how the iOS parser handles empty code lines, which is worth checking in the manual test pass.
Pre-merge checks: 4
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title names the main change: normalizers now convert codeblock newlines into separate
tags. The raw summary confirms this change in the Gumbo normalizer (C), its tests, and the Web normalizer.…
Description check
The description states that content newlines inside codeblocks remain after normalization and are now mapped to separate
tags in both the mobile Gumbo normalizer and the Web normalizer. It also gi…
Full details: Title check
Explanation
The title names the main change: normalizers now convert codeblock newlines into separate <p> tags. The raw summary confirms this change in the Gumbo normalizer (C), its tests, and the Web normalizer. The title does not name the tests or the br handling, which is acceptable.
Full details: Description check
Explanation
The description states that content newlines inside codeblocks remain after normalization and are now mapped to separate <p> tags in both the mobile Gumbo normalizer and the Web normalizer. It also gives a test plan with a sample <pre> input and the expected output. This matches the changeset.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 8fadac6 and 0a65652.
Files selected for processing: 4
cpp/parser/GumboNormalizer.c
cpp/tests/GumboParserTest.cpp
src/web/__tests__/htmlNormalizer.test.ts
src/web/normalization/htmlNormalizer.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
szydlovsky
changed the title
fix: Nake normalizers switch codeblock newlines to <p> tags
fix: Make normalizers switch codeblock newlines to <p> tags
Nov 30, 2026
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
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.
Summary
When working on other parser-related PRs, CodeRabbit found out that we can have content newlines inside codeblocks even after normalization step. The fix is relatively simple - if they exist, we instead map them to separate
<p>tags. It's applied on both mobileGumbonormalizer as well as the dedicated Web one.Test Plan
Use
setValueon an external html like:on any of the three platforms. It should be properly shown as three separate lines;
Screenshots / Videos
--
Compatibility
Checklist