Skip to content

Feat/003 markdown view checkboxes - #7

Merged
hendrikebbers merged 7 commits into
mainfrom
feat/003-markdown-view-checkboxes
Aug 16, 2026
Merged

Feat/003 markdown view checkboxes#7
hendrikebbers merged 7 commits into
mainfrom
feat/003-markdown-view-checkboxes

Conversation

@hendrikebbers

Copy link
Copy Markdown
Contributor

This pull request introduces interactive checkboxes to the MarkdownView component, allowing users to tick task list items directly in the read-only Markdown renderer. The change is fully backward-compatible and includes comprehensive documentation, test coverage, and spec updates. No behavior changes occur unless the new onChange prop is provided.

Interactive MarkdownView checkboxes

  • MarkdownView now accepts an optional onChange prop. When provided, task list checkboxes become interactive: ticking a box applies the change immediately and calls onChange with the updated Markdown. If onChange returns a Promise, all checkboxes are disabled until it settles, and the view rolls back on rejection. Omitting onChange leaves checkboxes read-only, preserving previous behavior. [1] [2]

Documentation and upgrade guidance

  • Added docs/upgrade-to-0.12.md with upgrade instructions, usage patterns, and best practices for wiring onChange in consumer apps.
  • Updated README.md to document the new interactive checkbox feature in MarkdownView.

Specification and test coverage

  • Marked spec 003 ("Markdown view checkboxes") as completed in specs/INDEX.md.
  • Added detailed implementation steps and behavior coverage for interactive checkboxes in specs/003-markdown-view-checkboxes/steps.md.
  • Extended markdown-view.test.tsx with thorough tests for all interaction scenarios, including optimistic updates, busy state, rollback, and edge cases.

Known issues and TODOs

  • Documented a schema bug where a bullet list adjacent to a task list can create a phantom empty task item, with context and investigation notes.

Add an optional onChange to MarkdownView. When provided, toggling a task
checkbox applies the change to the document in a component-owned
transaction (resolving the node position by identity) and reports the full
serialized Markdown. A returned Promise drives a component-wide busy state:
every checkbox is disabled and muted while the save is in flight, further
clicks are swallowed, and a rejection rolls back to the last confirmed
Markdown. A void return applies without a busy state.

The factory gains an onReadOnlyChecked option forwarded to TaskItem; the
sync effect is now guarded so an echoed content prop does not rebuild the
document, and a genuinely new content becomes the confirmed baseline.
MarkdownView stays editable: false — text is not editable.

Refs spec 003-markdown-view-checkboxes
…OM order

Add MarkdownView tests for read-only revert, optimistic toggle reporting,
component-wide busy/disable, rollback on rejection (incl. only-the-failed-
change), the content-prop guard and echo/win cases, and edge cases.

Fix position resolution: the extension-list task-item node view is reused
across updates, so the node handed to onReadOnlyChecked goes stale and
identity lookup fails on any re-toggle. Resolve the toggled item by DOM
order instead (the one <li> whose live checkbox disagrees with its
data-checked), which maps to the nth taskItem in document order.

Refs spec 003-markdown-view-checkboxes
Document the additive MarkdownView onChange (three engagement levels and
the consumer-owns-authorization note) as an agent-executable upgrade
prompt, and mark all implementation steps complete.

Refs spec 003-markdown-view-checkboxes
@hendrikebbers
hendrikebbers merged commit 847ba7b into main Aug 16, 2026
1 check passed
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