BlockNote
BlockNote copied to clipboard
Empty paragraphs are being removed
Describe the bug Empty paragraphs are being removed, Which is sometimes crucial for the formatting of the text.
To Reproduce
Load the following content
<p class="bn-inline-content">asdfasdf</p><p class="bn-inline-content">asd</p><p class="bn-inline-content">f</p><p class="bn-inline-content">asdf</p><p class="bn-inline-content"></p><p class="bn-inline-content"></p><p class="bn-inline-content"></p><p class="bn-inline-content"></p><p class="bn-inline-content"></p><p class="bn-inline-content"></p><p class="bn-inline-content"></p><p class="bn-inline-content"></p>
Will result in not preserving the empty lines
Is there a hidden option or something? Thanks!
Did you try by adding like a blank space? I know it is not the optimal solution but it might be a workaround
that doesn't sound a look a good idea. The formatting will be inconsistent when loading new docs, or if the user just inserts a new line 2 times.
Found a workaround using turndown lib :
const turndownService = new TurndownService({
blankReplacement: () => {
return ' ';
},
});
const html = await editor.blocksToFullHTML(editor.document);
const markdown = turndownService.turndown(html);
@meteorSD do you have a more complete example. I'm not sure I understand how to use the lib for this use case.
Ideally i want BlockNote to take markdown as input, and mardown as output (in the onChange handler).
Would be great if you could help out here 🙏
problem still persists