Skip to content

Math block encodes content incorrectly for users without unfiltered_html #77787

@dsas

Description

@dsas

Description

The Math block accepts latex input, which can include ampersands (they are a separator character). After saving the post as a user without unfiltered_html capability and then reloading the editor or viewing the front-end, the ampersands are displayed as & rather than as a separator character.

Step-by-step reproduction instructions

  1. Open the editor as a user without unfiltered_html cap, e.g. a Contributor
  2. Add math block
  3. Paste in this latex: \begin{pmatrix} a & b \\ c & d \end{pmatrix}
  4. Look at the block preview
  5. Save the post
  6. Reload the editor
  7. You can now see that the preview is incorrect the ampersands are showing up as literally & rather than as a separator.

Screenshots, screen recording, code snippet

Screen.Recording.2026-04-29.at.09.24.58.mov

Environment info

Gutenberg trunk (8dd0b92 - what will be 23.1), also reproduced on 23.0 and with GB plugin deactivated.

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Block] Math[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions