Skip to content

Line breaks lost in code blocks after using tryParseHTMLToBlocks and replaceBlocks #2105

@hughes-hc

Description

@hughes-hc

Describe the bug
When I try to convert an HTML string containing <code> blocks into BlockNote blocks using tryParseHTMLToBlocks, and then replace the current blocks using replaceBlocks, all the line breaks inside the code blocks are lost and replaced with spaces. This causes multi-line code to appear as a single line, breaking formatting and readability.

Image

To Reproduce

github-vamzb28v (1).zip

Misc

  • Node version: 22.0
  • Package manager: pnpm
  • Browser: chrome
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Sub-issues

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions