fix(import): task ticks and remark text inside quotes and callouts #25
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
daniel/obsidian-remarkable-round-trip!25
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/quote-import-roundtrip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #22
Problem
!23 makes task boxes and tables inside quotes and callouts render as real checkboxes and grids on the tablet. The import side still assumes these constructs start at column 0, so pen input in them is lost or breaks the note. This MR closes those gaps. The changes here are source-text logic only and don't depend on !23's code, so they can land in either order.
TASK_LINE_RE = /^\s*[-*+]\s+\[( |x|X)\]/(src/incoming/sourceprojection.ts:443) is checked against the source line at:307(strike → cancel) and:384(checkbox / checkbox-cancel). A tick on> - [ ] task, or> > - [ ] task, fails the test and is silently skipped.applyTaskStates(:451) uses the same column-0 regex to rewrite the marker.insertRemarkText(src/incoming/remarkinsert.ts:184),TABLE_ROW = /^\s*\|.*\|\s*$/doesn't match> | a | b |. The code falls into the>branch (:226), which inserts> remark textas a new line after the row. That ends the table, and the rest of the rows render as text.>branch inserts> textafter> - item. A top-level list item already gets a new item via theLIST_ITEMbranch (:230).What to change
sourceprojection.ts: allow an optional quote prefix inTASK_LINE_REand in theapplyTaskStatesreplace regex, e.g./^((?:\s*>\s?)*\s*[-*+]\s+)\[( |x|X)\]/. The replacement must stay the same length so no offsets shift (see theapplyTaskStatesdoc comment).remarkinsert.tsinsertRemarkText: when the anchor line starts with a quote prefix (/^(\s*(?:>\s?)+)/), strip the prefix and run the existing table-cell and list-item logic on the remainder. Re-add the prefix to every line written. Continuation lines of a quoted list item also carry the prefix, so the list-continuation scan (:234) must compare the stripped lines. If the stripped line is neither a table row nor a list item, keep today's behaviour: insert${prefix}${line}after the anchor.Constraints and decisions
taskmarks,remarkinsertandsourceprojectiontests stay green.blockEnd(sourceprojection.ts:764) alone. For a line inside a callout it returns the end of the callout, so a remark callout goes after the whole callout. That is the right place, because a callout cannot sit inside a callout line.Validation contract
maintoday):src/__tests__/taskmarks.test.ts: copy an existing "tick marks the task done" case, but with source> [!todo]\n> - [ ] buy milk(and a> > - [ ] xvariant). Acheckboxmark over the task's words → the output contains> - [x] buy milk. Acheckbox-cancel→> - [-] buy milk. A strike over most of the quoted task line → cancelled.src/__tests__/remarkinsert.test.ts: note> [!note]\n> | A | B |\n> | --- | --- |\n> | 1 | |with a remark anchored to the> | 1 | |row andcolumn: 1→ the row becomes> | 1 | text |, and no line is inserted into the table. A remark against> - item→ a new> - textitem.npm ci && npm test→ green.npm run lint→ exit 0.🤖 Generated with Claude Code
🤖 Agent is working on this — turn 52
Last activity: assistant message — updated 16:54:46 UTC
Last message:
claude referenced this pull request2026-10-20 18:48:55 +02:00
What changed
sourceprojection.ts:TASK_LINE_REnow allows a quote prefix (/^((?:\s*>\s?)*\s*[-*+]\s+)\[( |x|X)\]/), andapplyTaskStatesuses the same regex. Ticks, stripes and strikes on> - [ ] …and> > - [ ] …now become[x]or[-]. The rewrite keeps the line length, so no offsets shift.remarkinsert.tsinsertRemarkText: the quote prefix is taken off before the table-cell and list-item logic runs, and put back on every line written. The list-continuation scan compares the lines without the prefix. Any other quoted line works as before. A top-level line has an empty prefix, so its behaviour is unchanged.src/__tests__/migrate.test.ts: they were already onmainand madenpm run lintfail, so I added a one-line type cast in a separate commit.Verify
New red-gate tests failed before the change and pass now: 4 in
taskmarks.test.ts(tick, stripe-cancel and strike in a callout, plus a nested quote) and 3 inremarkinsert.test.ts(callout table cell, quoted list item with a continuation line, numbered list in a nested quote).npm testpasses 691/691 andnpm run lintexits 0. No CI pipeline has run on this branch.Follow-ups
None
@claude resolve mr conflicts
Since my last update: I merged
main(which now includes !24) into this branch and resolved the one conflict, inCHANGELOG-INK.md, by keeping both Unreleased bullets.mainalso has the same lint fix formigrate.test.ts; it merged cleanly with no duplicate change. After the merge,npm testpasses 694/694 andnpm run lintexits 0. Pushed asbf99789.claude referenced this pull request2026-10-20 18:57:06 +02:00
claude referenced this pull request2026-10-20 18:57:07 +02:00
claude referenced this pull request2026-10-20 19:03:23 +02:00
claude referenced this pull request2026-10-20 19:03:23 +02:00
claude referenced this pull request2026-10-20 19:07:23 +02:00