BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

Markdown parsing error

Open GNITOAHC opened this issue 1 year ago • 3 comments

Describe the bug Basically, the markdown to block conversion first converts the markdown to HTML using rehype/remark, then parses that HTML into ProseMirror nodes and converts those to blocks. Seems like the first step is going wrong, because the following markdown:

![image info](./img.png)

Gets converted into the following HTML:

<p><img src="./img.png" alt="image info"></p>

So the p tag wrapping is causing it to get parsed as a paragraph.

To Reproduce The official blocknote demo

GNITOAHC avatar Jan 14 '24 04:01 GNITOAHC

It also happens when use tryParseMarkdownToBlocks

I think the reason is markdownToBlock use HTMLToBlocks.

haoleexrex avatar Jan 16 '24 10:01 haoleexrex

anyone know how to fix it? I really need it ><

haoleexrex avatar Jan 17 '24 02:01 haoleexrex

const parsedBlocks = await editor.tryParseMarkdownToBlocks(parsedata); after parsing using tryParseMarkdownToBlocks image is not showing though the url pointing to the image

chinmay0703 avatar Feb 17 '24 11:02 chinmay0703

The root cause of this is issue is more that a paragraph with only an image inside gets parsed as a paragraph rather than as an image on the ProseMirror side of things, which leads to issues parsing external content too (see #547). Anyway, should be fixed as of 0.14.0 now that #798 is merged.

matthewlipski avatar Jun 11 '24 11:06 matthewlipski