fix/markdown-task-list-rendering: Render markdown checklists as task lists on update_page #12

Merged
aleleba merged 1 commits from fix/markdown-task-list-rendering into main 2026-06-11 00:02:09 -06:00
Owner

Summary

  • Markdown checklist items (- [ ] / - [x]) were rendered as plain bullet points instead of checkboxes when updating a page.
  • The client-side markdown → ProseMirror conversion (markedgenerateJSON) dropped the checkbox, so task lists degraded to a bulletList.

Root cause

The conversion pipeline is marked.parse() → HTML → generateJSON(html, tiptapExtensions). Two combined issues:

  1. tiptapExtensions did not register TaskList / TaskItem.
  2. marked emits <ul><li><input type="checkbox"> text</li></ul>, but TipTap's parseHTML rules only match ul[data-type="taskList"] and li[data-type="taskItem"] (with the checked state in data-checked). The <input> was therefore discarded.

create_page uses the server-side /pages/import endpoint (Docmost parses the markdown itself), so it was unaffected.

Changes

File Change
src/lib/tiptap-extensions.ts Register TaskList and TaskItem (with nested: true) extensions
src/lib/markdown-to-json.ts Add normalizeTaskLists() to rewrite marked's checkbox markup into the data-type/data-checked format TipTap expects before generateJSON
src/lib/collaboration.ts Reuse markdownToTiptapJson() instead of duplicating the marked + generateJSON logic (DRY) so update_page and comments share one conversion path

Test Plan

  • npm run build passes (tsc, no errors)
  • markdownToTiptapJson("- [ ] uno\n- [x] dos") produces taskListtaskItem nodes with checked: false / checked: true
  • Plain bullets (- item) still produce bulletList; numbered lists still produce orderedList (no regression)
  • End-to-end: restart the MCP server, run update_page with - [ ] / - [x] content, confirm checkboxes render in the Docmost UI
## Summary - Markdown checklist items (`- [ ]` / `- [x]`) were rendered as plain bullet points instead of checkboxes when updating a page. - The client-side markdown → ProseMirror conversion (`marked` → `generateJSON`) dropped the checkbox, so task lists degraded to a `bulletList`. ## Root cause The conversion pipeline is `marked.parse()` → HTML → `generateJSON(html, tiptapExtensions)`. Two combined issues: 1. `tiptapExtensions` did not register `TaskList` / `TaskItem`. 2. `marked` emits `<ul><li><input type="checkbox"> text</li></ul>`, but TipTap's `parseHTML` rules only match `ul[data-type="taskList"]` and `li[data-type="taskItem"]` (with the checked state in `data-checked`). The `<input>` was therefore discarded. `create_page` uses the server-side `/pages/import` endpoint (Docmost parses the markdown itself), so it was unaffected. ## Changes | File | Change | |------|--------| | `src/lib/tiptap-extensions.ts` | Register `TaskList` and `TaskItem` (with `nested: true`) extensions | | `src/lib/markdown-to-json.ts` | Add `normalizeTaskLists()` to rewrite marked's checkbox markup into the `data-type`/`data-checked` format TipTap expects before `generateJSON` | | `src/lib/collaboration.ts` | Reuse `markdownToTiptapJson()` instead of duplicating the `marked` + `generateJSON` logic (DRY) so `update_page` and comments share one conversion path | ## Test Plan - [x] `npm run build` passes (tsc, no errors) - [x] `markdownToTiptapJson("- [ ] uno\n- [x] dos")` produces `taskList` › `taskItem` nodes with `checked: false` / `checked: true` - [x] Plain bullets (`- item`) still produce `bulletList`; numbered lists still produce `orderedList` (no regression) - [x] End-to-end: restart the MCP server, run `update_page` with `- [ ]` / `- [x]` content, confirm checkboxes render in the Docmost UI
aleleba added 1 commit 2026-06-11 00:01:07 -06:00
Markdown checklist items (`- [ ]` / `- [x]`) were rendered as plain
bullet points instead of checkboxes. The client-side conversion pipeline
(marked -> generateJSON) dropped the checkbox because:

- tiptapExtensions did not register TaskList/TaskItem.
- marked emits `<ul><li><input type="checkbox">`, but TipTap's parseHTML
  rules only match `ul[data-type="taskList"]` / `li[data-type="taskItem"]`
  with the checked state in `data-checked`.

Register TaskList/TaskItem and add normalizeTaskLists() to rewrite marked's
checkbox markup into the format TipTap expects before generateJSON runs.
collaboration.ts now reuses markdownToTiptapJson() so update_page and
comments share the same conversion.
aleleba merged commit e28c6abcad into main 2026-06-11 00:02:09 -06:00
aleleba deleted branch fix/markdown-task-list-rendering 2026-06-11 00:02:15 -06:00
Sign in to join this conversation.