Skip to content

feat(store): accept CommonMark-valid task line variants#5

Merged
Sanjays2402 merged 2 commits into
mainfrom
feat/parser-leniency
May 17, 2026
Merged

feat(store): accept CommonMark-valid task line variants#5
Sanjays2402 merged 2 commits into
mainfrom
feat/parser-leniency

Conversation

@Sanjays2402

Copy link
Copy Markdown
Owner

The parser previously rejected hand-edited markdown that any other tool would accept: indented bullets, alternate markers (* or +), and tabs.

Fix

  • Accept 0-3 leading spaces (CommonMark §5.2)
  • Accept a single leading tab
  • Accept * and + as bullet markers
  • Document the canonical-write contract in a doc comment

Still rejected (correctly, per spec)

  • 4+ leading spaces (code block, not list)
  • [] empty checkbox
  • -[ ] missing separator
  • mid-line task syntax

Verification

Input Before After
- [ ] hello
- [ ] indented
\t- [ ] tabbed
* [ ] starred
+ [ ] plussed
- [ ] code block indent
- [] no space inside

tsk's own writes still emit the canonical - [ ] form — no round-trip changes.

Tests: TestParseLenient (7 cases) + TestParseRejectsNonTasks (4 cases). All green with -race.

Part 1/10 of the v0.3.0 improvement series.

The parser previously rejected hand-edited markdown that any other tool
would accept: indented bullets, alternate markers (* or +), and tabs.

Fixes:
  - Allow 0-3 leading spaces (CommonMark §5.2 indentation rule)
  - Allow a single leading tab (same rule, tab variant)
  - Accept `*` and `+` as bullet markers in addition to `-`

Rejected (correctly, by spec):
  - 4+ leading spaces (code block, not list item)
  - `[]` empty checkbox brackets
  - `-[ ]` no space between marker and bracket
  - mid-line task syntax

tsk's own writes still emit the canonical `- [ ]` form, so round-trips
are unchanged. This only affects what we accept from humans.

Tests: 7 new lenient inputs + 4 reject cases in TestParseLenient and
TestParseRejectsNonTasks.
@Sanjays2402 Sanjays2402 merged commit fb3ab46 into main May 17, 2026
4 checks passed
@Sanjays2402 Sanjays2402 deleted the feat/parser-leniency branch May 17, 2026 03: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