fix/markdown-task-list-rendering: Render markdown checklists as task lists on update_page #12
Reference in New Issue
Block a user
Delete Branch "fix/markdown-task-list-rendering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
- [ ]/- [x]) were rendered as plain bullet points instead of checkboxes when updating a page.marked→generateJSON) dropped the checkbox, so task lists degraded to abulletList.Root cause
The conversion pipeline is
marked.parse()→ HTML →generateJSON(html, tiptapExtensions). Two combined issues:tiptapExtensionsdid not registerTaskList/TaskItem.markedemits<ul><li><input type="checkbox"> text</li></ul>, but TipTap'sparseHTMLrules only matchul[data-type="taskList"]andli[data-type="taskItem"](with the checked state indata-checked). The<input>was therefore discarded.create_pageuses the server-side/pages/importendpoint (Docmost parses the markdown itself), so it was unaffected.Changes
src/lib/tiptap-extensions.tsTaskListandTaskItem(withnested: true) extensionssrc/lib/markdown-to-json.tsnormalizeTaskLists()to rewrite marked's checkbox markup into thedata-type/data-checkedformat TipTap expects beforegenerateJSONsrc/lib/collaboration.tsmarkdownToTiptapJson()instead of duplicating themarked+generateJSONlogic (DRY) soupdate_pageand comments share one conversion pathTest Plan
npm run buildpasses (tsc, no errors)markdownToTiptapJson("- [ ] uno\n- [x] dos")producestaskList›taskItemnodes withchecked: false/checked: true- item) still producebulletList; numbered lists still produceorderedList(no regression)update_pagewith- [ ]/- [x]content, confirm checkboxes render in the Docmost UI