Repository navigation
fix(muya): split the list when outdenting a task item into a plain list (#5341) - #5348
Merged
Merged
Conversation
The parser splits one markdown list into a bullet list and a task list where its items switch between plain and task. The serializer wrote a blank line between those adjacent lists, which is still one list in markdown, so a tight `- a\n- [ ] b` came back loose (`- a\n\n- [ ] b`) after one save and reopen. Skip the blank line when the previous block is a tight list with the same marker or delimiter and this list is tight too. Loose lists and lists with a different marker are serialized as before. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn
…5341) Shift+Tab on a task item nested in a bullet or ordered list moved it into the outer list as a `task-list-item`, which only a `task-list` may hold (and the reverse for a plain item nested in a task list). The editor showed a plain bullet next to checkbox items, and reopening the saved markdown split the list differently. Split the outer list after the parent item instead: the outdented item goes into a new list of its own kind, keeping its checked state, and the items that followed the parent item go into a list of the outer kind after it, continuing an ordered list's numbering. When a list of the item's kind with the same marker already follows, the item joins it. This is the structure the parser builds for the saved markdown, so the document is unchanged across a reopen. Items of the same kind are inserted into the outer list as before. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn
This was referenced Sep 14, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5341
Summary
Shift+Tab on a task item nested in a bullet or ordered list moved it into the outer list as a
task-list-item, which only atask-listmay hold (and the reverse for a plain item nested in a task list). The editor showed a plain bullet next to checkbox items, and reopening the saved markdown produced a different document — for an ordered outer list the checkbox was lost entirely.Two commits:
1.
fix(muya): keep adjacent tight lists with the same marker tightThe parser splits one markdown list into a bullet list and a task list where its items switch between plain and task (
utils/marked/compatibleTaskList.ts). The serializer wrote a blank line between those adjacent lists, which are still one list in markdown, so a tight- a\n- [ ] bcame back loose (- a\n\n- [ ] b) after one save and reopen — even without any outdent. The blank line is now skipped when the previous block is a tight list with the same marker/delimiter and this list is tight too. Loose lists and lists with a different marker are serialized as before.This is what lets the outdent result below round-trip unchanged.
2.
fix(muya): split the list when outdenting an item of the other kind (#5341)_unindentListItem()now inserts the outdented item through_insertOutdentedListItem():start. With the same marker, the new list shares the outer list's looseness, since it is still part of that markdown list.- a\n- [ ] b\n- [ ] xreopens asbullet(a)+task(b, x)), so creating a separate list would change on reopen. Ordered lists are not merged, since joining would need the following list'sstartrewritten.The result is the structure the parser builds for the saved markdown.
Real Chrome (muya e2e host, real keys: click at the end of
b, Shift+Tab; then reopen the saved markdown and undo):- a/- [ ] bbullet-list{a, task b}✗- a\n\n- [ ] b…(changed)bullet-list{a}task-list{b}- a/- [x] b/- cbullet-list{a, task b, c}✗bullet{a}task{[x] b}bullet{c}1. a/- [ ] b/2. corder-list{a, task b, c}✗, saved as2. [ ] b2. b)order(1){a}task{b}order(2){c}- [ ] a/- btask-list{a, item b}✗task{a}bullet{b}- a/- [ ] b/- [ ] xbullet{a, task b}task{x}✗bullet{a}task{b, x}- a/- [ ] b/- [ ] d/c(+ ↓ Home Backspace)bullet{a, task b{…}}✗bullet{a}task{b{task-list{d}, c}}✗ = a list holding an item kind it doesn't allow. Undo returned to the original document and no renderer errors were thrown in every case, on both develop and this PR.
Type of change
Test plan
state/__tests__/listSerialization.spec.ts: tight bullet→task, task→bullet→task, and nested tight split lists round-trip unchanged (3 cases fail on develop); loose split lists and different markers unchanged.paragraphContent/__tests__/unindentListKindSplit.spec.ts: basic split, checked state and caret, tail items, ordered numbering, reverse case, joining a following task list, different marker, siblings + trailing content, same-kind control, undo. Every structural case asserts that each list holds only its own item kind and that the state equals the reparsed state of its markdown (8 cases fail on develop; the same-kind and undo controls pass on both).vitest run226 files / 1587 tests pass;test:spec1347 pass;lint(no new warnings),lint:types,check-circularpass.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn