Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/TextBlockComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ const sanitiserOptions: IOptions = {
},
};
},
div: 'p',
h1: 'h2',
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, what error did you find in the logs that could be fixed by this change? And what is the reason for making div to be p and h1 to become h2? Why couldn't we keep them as div and h1

Copy link
Contributor Author

@DanielCliftonGuardian DanielCliftonGuardian Jan 29, 2026

Choose a reason for hiding this comment

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

  1. This generates around 2000 warns a day see logs . Because we return null on unknown tags, we discard all nested children. In old sports blogs, DIV wrappers cause entire team lineups to be deleted from the page.
  2. We transform H1 to H2 so that we maintain the best practice of only one H1 per page.
  3. Transforming DIV to P allows us to inherit standard styling. This is much cleaner than adding redundant switch cases and CSS to handle legacy elements.

},
};

Expand Down
Loading