Skip to content

[codex] Fix markdown list roundtrips#135

Merged
samuelstroschein merged 1 commit into
mainfrom
codex/fix-markdown-list-roundtrip
Jun 17, 2026
Merged

[codex] Fix markdown list roundtrips#135
samuelstroschein merged 1 commit into
mainfrom
codex/fix-markdown-list-roundtrip

Conversation

@samuelstroschein

@samuelstroschein samuelstroschein commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Fixes Markdown list roundtripping in the editor:

  • Prevents collapsed toolbar clicks inside active bullet/numbered lists from unwrapping the current list item and dropping bullet syntax on save.
  • Preserves manually typed checklist markers such as - [], - [ ], and - [x] when serializing Markdown.
  • Keeps checklist toolbar state distinct from plain bullet-list state.
  • Adds a long-document persistence regression for the issue Editor deletes content below edit point in long Markdown document #129 shape so mid-document edits do not truncate content below the edit point.
  • Adds a patch changenote for the user-facing fix.

Root Cause

TipTap represents checklists on top of bullet-list/list-item nodes, while the Markdown serializer did not emit task markers from listItem.checked. The toolbar also treated collapsed clicks inside active lists as unwrap commands, which could convert an existing one-item bullet list back into a paragraph before persistence.

Validation


Note

Medium Risk
Touches the Markdown save path and list editing UX; wrong behavior could corrupt saved file content, though changes are scoped and heavily tested.

Overview
Fixes Markdown save roundtrips for bullet lists, checklists, and toolbar behavior so list syntax is not dropped accidentally.

Serialization: serializeAst now injects [ ] / [x] markers from listItem.checked before the Rust serializer runs, so checked tasks roundtrip through the editor.

Formatting toolbar: Collapsed clicks on bullet/numbered list buttons no longer unwrap the current item; unwrap only happens with an explicit text selection. Bullet vs checklist aria-pressed state is split so task items are not shown as plain bullets.

Typing shortcuts: Checklist triggers inside an existing list only flip checked on the first paragraph of the item, avoiding false task conversion when [ ] is typed in a continuation line.

Adds regression coverage (toolbar, shortcuts, editor persistence including a long-document mid-edit case) and a patch changenote.

Reviewed by Cursor Bugbot for commit 3f57125. Bugbot is set up for automated code reviews on this repo. Configure here.

@samuelstroschein samuelstroschein marked this pull request as ready for review June 17, 2026 19:15
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
flashtype-website 3f57125 Commit Preview URL

Branch Preview URL
Jun 17 2026, 09:18 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea368371c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

isItalic: editor.isActive("italic"),
isCode: editor.isActive("code"),
isBulletList: editor.isActive("bulletList"),
isBulletList: editor.isActive("bulletList") && !isTaskList,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat mixed-list plain items as bullets

When the cursor is on the plain bullet item in a mixed list like - plain followed by - [ ] todo, astToTiptapDoc marks the whole bulletList as isTaskList if any sibling has checked, so computeTaskListActive returns true even though the current listItem.checked is null. With this new && !isTaskList gate, the Bullet button is no longer pressed and the Checklist button is shown as active for that plain item, so the toolbar state no longer matches the selected item in mixed lists.

Useful? React with 👍 / 👎.

@samuelstroschein samuelstroschein force-pushed the codex/fix-markdown-list-roundtrip branch from ea36837 to 3f57125 Compare June 17, 2026 21:17
@samuelstroschein samuelstroschein merged commit 1d31375 into main Jun 17, 2026
5 checks passed
@samuelstroschein samuelstroschein deleted the codex/fix-markdown-list-roundtrip branch June 17, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant