fix(import/markdown): TODO not properly handled after upgrade

This commit is contained in:
Elian Doran 2025-11-18 20:17:34 +02:00
parent 50859fd661
commit b246c638fd
No known key found for this signature in database

View File

@ -66,7 +66,7 @@ class CustomMarkdownRenderer extends Renderer {
// Handle todo-list in the CKEditor format. // Handle todo-list in the CKEditor format.
if (item.task) { if (item.task) {
let itemBody = ''; let itemBody = '';
const checkbox = this.checkbox({ checked: !!item.checked }); const checkbox = this.checkbox({ checked: !!item.checked, raw: "- [ ]", type: "checkbox" });
if (item.loose) { if (item.loose) {
if (item.tokens[0]?.type === 'paragraph') { if (item.tokens[0]?.type === 'paragraph') {
item.tokens[0].text = checkbox + item.tokens[0].text; item.tokens[0].text = checkbox + item.tokens[0].text;
@ -86,7 +86,7 @@ class CustomMarkdownRenderer extends Renderer {
itemBody += checkbox; itemBody += checkbox;
} }
itemBody += `<span class="todo-list__label__description">${this.parser.parse(item.tokens, !!item.loose)}</span>`; itemBody += `<span class="todo-list__label__description">${this.parser.parse(item.tokens.filter(t => t.type !== "checkbox"))}</span>`;
return `<li><label class="todo-list__label">${itemBody}</label></li>`; return `<li><label class="todo-list__label">${itemBody}</label></li>`;
} }