Skip to content

Markdown line wraps parsing error. #2528

@BHznJNs

Description

@BHznJNs

What’s broken?

When using editor.blocksToMarkdownLossy(editor.document) to export the editing content into markdown, the all line wraps will be converted into \n\n (two line breaks), but when using editor.tryParseMarkdownToBlocks to convert the converted markdown text back to blocks, the \n\n will be treated as a extra empty line.

For example,
for such a content:

foo
bar

exported markdown content:

foo\n\nbar

and after reimported:

foo

bar

and re-exported:

foo\n\n\n\nbar

There is an extra line appeared after export and import, even there is no modification applied.

What did you expect to happen?

When using editor.tryParseMarkdownToBlocks, treat the line breaks correctly.
For example,
for markdown content:

foo\n\nbar

it should be rendered as:

foo
bar

Steps to reproduce

No response

BlockNote version

v0.47.0

Environment

React 19, MS WebView2 (Tauri), Windows 11 25h2

Additional context

It seems that this problem only appears with paragraph elements.

Contribution

  • I'd be interested in contributing a fix for this issue

Sponsor

  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue has not yet been reviewed or classified by maintainers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions