From 924eaf84869cd025538bf455c5e9794e69addf16 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 23 Dec 2025 11:33:14 +0500 Subject: [PATCH] core: fix check list text export --- .../__snapshots__/tiptap.test.js.snap | 63 +++++++++++++++++++ .../content-types/__tests__/tiptap.test.js | 4 +- packages/core/src/content-types/tiptap.ts | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/packages/core/src/content-types/__tests__/__snapshots__/tiptap.test.js.snap b/packages/core/src/content-types/__tests__/__snapshots__/tiptap.test.js.snap index 1868c856a..3b662ce9b 100644 --- a/packages/core/src/content-types/__tests__/__snapshots__/tiptap.test.js.snap +++ b/packages/core/src/content-types/__tests__/__snapshots__/tiptap.test.js.snap @@ -1,5 +1,39 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`convert HTML to markdown with callout > html-to-md-callout.md 1`] = ` +"

Hello world

kjsbva

vadvkjabsdv

dvjkasbdv

+ +adsvjkabsdv + +advjakbsdv + + + +" +`; + +exports[`convert HTML to markdown with checklist > html-to-md-checklist.md 1`] = ` +"oeee + +- [ ] 123 + +- [x] 123 + +- [ ] 13123 + +- [ ] 123123 + + - [ ] dskjvdskbv + + - [ ] sdvkjsdv + + - [ ] dsv + +- [ ] 123123 + +" +`; + exports[`convert HTML to markdown with codeblock2 > html-to-md-codeblock2.md 1`] = ` "\`\`\` hello @@ -250,6 +284,35 @@ Nene " `; +exports[`convert HTML to text with callout > html-to-txt-callout.txt 1`] = ` +"HELLO WORLD + +kjsbva + +vadvkjabsdv + +dvjkasbdv + +adsvjkabsdv + +advjakbsdv + + +" +`; + +exports[`convert HTML to text with checklist > html-to-txt-checklist.txt 1`] = ` +"oeee + ☐ 123 + ✅ 123 + ☐ 13123 + ☐ 123123 + ☐ dskjvdskbv + ☐ sdvkjsdv + ☐ dsv + ☐ 123123" +`; + exports[`convert HTML to text with codeblock2 > html-to-txt-codeblock2.txt 1`] = ` "hello " diff --git a/packages/core/src/content-types/__tests__/tiptap.test.js b/packages/core/src/content-types/__tests__/tiptap.test.js index dbad0d149..19ab83a0c 100644 --- a/packages/core/src/content-types/__tests__/tiptap.test.js +++ b/packages/core/src/content-types/__tests__/tiptap.test.js @@ -66,7 +66,9 @@ const HTMLS = { outlinelists: `

Testing outline list:

`, codeblock2: `
hello
`, singleSpacedParagraphs: `

hello world

hello world 2

`, - leadingWhitespaces: `

two spaces

four spaces

two spaces

four spaces

` + leadingWhitespaces: `

two spaces

four spaces

two spaces

four spaces

`, + checklist: `

oeee

`, + callout: `

Hello world

kjsbva

vadvkjabsdv

dvjkasbdv

adsvjkabsdv

advjakbsdv


` }; for (const html in HTMLS) { diff --git a/packages/core/src/content-types/tiptap.ts b/packages/core/src/content-types/tiptap.ts index 7660e7d0e..2aea7f3c0 100644 --- a/packages/core/src/content-types/tiptap.ts +++ b/packages/core/src/content-types/tiptap.ts @@ -388,7 +388,7 @@ function convertHtmlToTxt(html: string, wrap = true) { selectors: [ { selector: "table", format: "dataTable" }, { selector: "ul.checklist", format: "taskList" }, - { selector: "ul.simple-checklist", format: "checkList" }, + { selector: "ul.simple-checklist", format: "taskList" }, { selector: "p", format: "paragraph" }, { selector: `a[href^="nn://"]`, format: "internalLink" } ],