Skip to content

fix(block-editor): render subscript and superscript marks as <sub>/<sup> in Story Block HTML output#35506

Open
dsolistorres wants to merge 3 commits intomainfrom
issue-35460-render-sub-sup-marks-in-story-block
Open

fix(block-editor): render subscript and superscript marks as <sub>/<sup> in Story Block HTML output#35506
dsolistorres wants to merge 3 commits intomainfrom
issue-35460-render-sub-sup-marks-in-story-block

Conversation

@dsolistorres
Copy link
Copy Markdown
Member

Summary

  • Adds subscript and superscript mark handling to the renderMarks macro in dotCMS/src/main/webapp/WEB-INF/velocity/VM_global_library.vm — previously these marks were silently dropped during Story Block HTML rendering even though the Block Editor (TipTap) registers both extensions.
  • Branches are added to both the opening loop and the closing reverse-range loop so nested combinations (e.g. bold + superscript) close in the correct order.
  • Adds integration coverage in StoryBlockMapTest (test_subscript_and_superscript_marks_render_to_html) covering each mark individually plus a combined nesting case (<strong><sup>bold-sup</sup></strong>).

Closes #35460

Before / After

Input JSON:

{ "type": "text", "marks": [{ "type": "superscript" }], "text": "2" }
Output
Before 2
After <sup>2</sup>

Test plan

  • ./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dit.test=StoryBlockMapTest passes (new test + existing tests).
  • Manual: create a contentlet with a Block Editor field, apply Subscript and Superscript via the toolbar, save/publish, render via $contentlet.myField.toHtml in a VTL/page, confirm <sub> / <sup> wrap the affected text.
  • Manual regression: confirm bold, italic, strike, underline, and link still render as before.

🤖 Generated with Claude Code

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 29, 2026

Claude finished @dsolistorres's task in 1m 32s —— View job


dotCMS Backend Review

  • Gather context and load conventions
  • Get Java diff
  • Run security, database, Java standards, and REST API sub-reviews in parallel
  • Consolidate and post findings

All four sub-reviews (security, database, Java standards, REST API) returned no issues.

dotCMS Backend Review: no issues found.

@github-actions github-actions Bot added the Area : Backend PR changes Java/Maven backend code label Apr 29, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 29, 2026

dotCMS Backend Review: no issues found.

@dsolistorres dsolistorres enabled auto-merge April 29, 2026 21:14
@dsolistorres dsolistorres force-pushed the issue-35460-render-sub-sup-marks-in-story-block branch from 934aa7a to 3720a9b Compare April 29, 2026 22:16
dsolistorres and others added 3 commits April 29, 2026 17:22
…up> in Story Block HTML output

The renderMarks macro in VM_global_library.vm handled bold, italic, strike,
underline, and link marks but silently dropped subscript and superscript marks
even though the Block Editor (TipTap) registers both extensions and authors can
produce them.

Adds the two missing branches in both the opening and closing reverse-range
loops so nested combinations (e.g. bold + superscript) close in the correct
order, plus an integration test in StoryBlockMapTest covering each mark
individually and a combined nesting case.

Closes #35460

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add subscript and superscript handling to the inline MACRO constant so the
test file reflects the real renderMarks macro in VM_global_library.vm.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The inline MACRO registered in @before pads tags with newlines and indent,
so contains-checks for contiguous wrappings like <sup>sup</sup> never match
even when the macro is correct. Strip whitespace before asserting so the
test still verifies the wrapping order and nesting.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@dsolistorres dsolistorres force-pushed the issue-35460-render-sub-sup-marks-in-story-block branch from 8f21330 to bc0ddc7 Compare April 29, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Block Editor: subscript and superscript marks are not rendered as <sub>/<sup> in Story Block HTML output

1 participant