diff --git a/packages/core/src/api/exporters/markdown/markdownExporter.ts b/packages/core/src/api/exporters/markdown/markdownExporter.ts index 488886c76d..812f20ffb0 100644 --- a/packages/core/src/api/exporters/markdown/markdownExporter.ts +++ b/packages/core/src/api/exporters/markdown/markdownExporter.ts @@ -37,7 +37,12 @@ export function cleanHTMLToMarkdown(cleanHTMLString: string) { }) .processSync(cleanHTMLString); - return markdownString.value as string; + let result = markdownString.value as string; + + // Remove extra blank lines between list items + result = result.replace(/\n\n(?=\d+\.|-|\*)/g, "\n"); + + return result; } export async function blocksToMarkdown< diff --git a/packages/server-util/src/context/__snapshots__/ServerBlockNoteEditor.test.ts.snap b/packages/server-util/src/context/__snapshots__/ServerBlockNoteEditor.test.ts.snap index f2522c662a..32db59a38b 100644 --- a/packages/server-util/src/context/__snapshots__/ServerBlockNoteEditor.test.ts.snap +++ b/packages/server-util/src/context/__snapshots__/ServerBlockNoteEditor.test.ts.snap @@ -132,7 +132,6 @@ exports[`Test ServerBlockNoteEditor > converts to and from markdown (blocksToMar "## **Heading ***~~2~~* Paragraph - * list item ![Example](exampleURL) diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/complex/misc.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/complex/misc.md index 4a2de0a7fc..977c0e10eb 100644 --- a/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/complex/misc.md +++ b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/complex/misc.md @@ -1,5 +1,4 @@ ## **Heading ***~~2~~* Paragraph - * diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/basic.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/basic.md index ae6392a26d..62a1aca5f1 100644 --- a/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/basic.md +++ b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/basic.md @@ -1,10 +1,6 @@ * Bullet List Item 1 - * Bullet List Item 2 - 1. Numbered List Item 1 - 2. Numbered List Item 2 - * [ ] Check List Item 1 * [x] Check List Item 2 diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/nested.md b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/nested.md index bb6af59913..327b709a69 100644 --- a/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/nested.md +++ b/tests/src/unit/core/formatConversion/export/__snapshots__/markdown/lists/nested.md @@ -1,5 +1,4 @@ * Bullet List Item 1 - * Bullet List Item 2 1. Numbered List Item 1