Skip to content

Render mj-raw children of mj-section and mj-group - #103

Merged
jcputney merged 2 commits into
mainfrom
fix/raw-in-section-and-group
Nov 2, 2026
Merged

jcputney merged 2 commits into
mainfrom
fix/raw-in-section-and-group

Conversation

@jcputney

@jcputney jcputney commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

MJML allows mj-raw inside mj-section and mj-group. Both components rendered only their column children, so raw content in those places was dropped from the output.

Raw children now render verbatim, in document order, outside the Outlook column cells. This matches the reference renderer, where renderWrappedChildren returns isRawElement() children as they are. Raw children do not count towards column widths. MjColumn and MjWrapper already keep raw children, so they are unchanged.

Tests

  • New golden fixtures raw-in-section and raw-in-group, generated with mjml@4.18.0. All 42 golden comparisons pass.
  • Component tests for order, column widths with a raw child present, raw-only sections and consecutive raw children.
  • mvn verify passes on all modules (1,151 tests, Spotless, SpotBugs, JaCoCo, Javadoc).

Summary by CodeRabbit

  • Bug Fixes
    • Raw HTML in sections and groups now renders in its original order before, between, and after columns, including when there are no columns.
    • Raw content stays outside column cells and does not affect column widths or layout.
    • Consecutive raw HTML elements are retained in order, and column positioning remains consistent around raw content.

MJML allows mj-raw inside mj-section and mj-group, but both components
rendered only their column children, so raw content was dropped from the
output. Raw children now render verbatim in document order, outside the
Outlook column cells, as the reference renderer does. They do not count
towards column widths.

Adds golden fixtures generated with mjml 4.18.0 and component tests for
order, widths, raw-only and consecutive raw children.

Signed-off-by: Jonathan Putney <jputney@noverant.com>
@github-actions github-actions Bot added the core label Nov 2, 2026
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 14dc143d-9c57-4d8a-a2b9-876a84319a91
Commits

Reviewing files that changed from the base of the PR and between 03da84a and e469ffb.

Files selected for processing: 4
  • mjml-java-core/src/main/java/dev/jcputney/mjml/component/body/MjGroup.java
  • mjml-java-core/src/main/java/dev/jcputney/mjml/component/body/MjSection.java
  • mjml-java-core/src/test/java/dev/jcputney/mjml/component/body/MjGroupTest.java
  • mjml-java-core/src/test/java/dev/jcputney/mjml/component/body/MjSectionRenderTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The section and group renderers now process raw children alongside columns. Raw content stays in source order and outside column cells. Column sizing and positional context continue to use column children. Tests and golden fixtures cover raw content around columns and raw-only children.

Changes: Raw children in body components

Layer / File(s) Summary
Render raw children alongside columns
mjml-java-core/src/main/java/.../body/MjGroup.java, mjml-java-core/src/main/java/.../body/MjSection.java, mjml-java-core/src/test/java/.../body/MjGroupTest.java, mjml-java-core/src/test/java/.../body/MjSectionRenderTest.java, mjml-java-core/src/test/resources/golden/raw-in-group.*, mjml-java-core/src/test/resources/golden/raw-in-section.*
Both renderers emit mj-raw children outside column cells and preserve column sizing and MSO table markup. Tests and golden fixtures cover raw content before, between, and after columns, as well as raw-only children.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: Minimal · up to e469f

No actionable merge-blocking issue remains; the change is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rendering mj-raw children in mj-section and mj-group.
Description check Passed The description explains the problem, the behavior change, affected components, and validation results. It does not use every template heading and omits the explicit compatibility, security, and relat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, the behavior change, affected components, and validation results. It does not use every template heading and omits the explicit compatibility, security, and related-issue sections, but it is mostly complete and directly relevant.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
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.

Share

@jcputney
jcputney merged commit 2ee310e into main Nov 2, 2026
10 checks passed
@jcputney
jcputney deleted the fix/raw-in-section-and-group branch November 2, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant