TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.
https://www.blocknotejs.org/
Mozilla Public License 2.0
6.34k stars 433 forks source link

Parsing markdown table is wrong #739

Open littlefrontender opened 4 months ago

littlefrontender commented 4 months ago

Describe the bug Parsing the markdown table adds an extra row. Thus, if you store the date in markdown, it will add an empty row every time you save.

To Reproduce I use https://www.blocknotejs.org/examples/interoperability/converting-blocks-to-md or https://www.blocknotejs.org/examples/interoperability/converting-blocks-from-md

Снимок экрана 2024-05-13 в 17 11 32 Снимок экрана 2024-05-13 в 17 12 43

Misc

YousefED commented 3 months ago

Is there a md spec that specifies that the empty header should not be parsed? To me it seems correct that it gets parsed to an empty row tbh

ursnj commented 2 weeks ago

Even im facing same issue every time i parse to md an additional row is getting added at the beginning of the table. am i missing something ?

    const markdown: string | undefined = await editor.blocksToMarkdownLossy(editor.document);
matthewlipski commented 2 weeks ago

I'm not sure there's a good way around this tbh - Markdown tables are fundamentally different from BlockNote/HTML tables as they require defining a header. Since these are all data cells there is no 1:1 mapping of the BlockNote representation vs the Markdown one, there is always going to be some misinterpretation.