Skip to content

fix(edit): apply ride-along clear/run-formatting to every block a markdown edit writes - #66

Open
kklimuk wants to merge 1 commit into
mainfrom
claude/triage-issue-60-multi-block-restyle
Open

kklimuk wants to merge 1 commit into
mainfrom
claude/triage-issue-60-multi-block-restyle

Conversation

@kklimuk

@kklimuk kklimuk commented Nov 12, 2026

Copy link
Copy Markdown
Owner

🤖 docx-cli triage

What was wrong

In a whole-paragraph markdown edit that splits one paragraph into several, every new block takes on the replaced paragraph's run formatting. The ride-along clear / --bold / … flags only reached the first block. In the repro, echo '{"at":"p0","markdown":"First\n\nSecond","clear":"color"}' | docx edit c.docx --batch - still read <span style="color:#FF0000">Second</span> <!-- p1 -->. Single-op --clear and --bold behaved the same way.

What changed

  • Edit.paragraph now returns nodes (every block the edit produced) instead of only the first node.
  • The new Edit.restyleBlocks clears first, then sets formatting, on each paragraph among those blocks. It skips non-paragraph blocks such as a markdown table and refuses with USAGE when the content has no paragraph at all, as before. Both single-op and --batch use it.
  • I removed clearFormattingNode / setFormattingNode. The span ride-alongs now call the locator-based clearFormatting / setFormatting.
  • Added a REFERENCE.md note and 4 CLI regression tests: batch clear, single-op clear, single-op --bold, and tracked clear. No new fixture, because this is a fix to an existing flag and not a new surface.

Verification

  • Before: First <!-- p0 --> / <span style="color:#FF0000">Second</span> <!-- p1 -->. After: First <!-- p0 --> / Second <!-- p1 -->. --bold now bolds both blocks.
  • bun run check ✅ bun run test:unit ✅ (2103 tests)
  • /simplify: no changes. /code-review xhigh: the forked run reviewed the wrong diff (the HEAD commit, in another checkout). Its edits were reverted, and I reviewed this diff by hand at that depth with no findings.

Decisions for you

  • When the markdown mixes paragraphs and a table ("Intro\n\n| a |…" + --bold), the flags format the paragraphs and skip the table cells. Before this change the result depended on which block came first. Should they also reach the table-cell paragraphs?

Fixes #60


Generated by Claude Code

…kdown edit writes

A whole-paragraph markdown edit that splits one paragraph into several
stamps the replaced paragraph's run formatting onto every new block, but
the ride-along --clear / --bold / … only reached the first one, so a
coloured template placeholder kept its colour on every line after the
first. Edit.paragraph now returns all the new blocks and the new
Edit.restyleBlocks clears then sets formatting on each paragraph among
them (single-op and --batch). The node-targeted clear/set helpers are
gone; span ride-alongs use the locator-based clearFormatting/setFormatting.

Fixes #60

Triage-Routine: true
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LkctEPJa5FWBzPoeq7imqE

This branch has not been deployed

No deployments
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.

edit: clear and other formatting flags apply only to the first block of a multi-block edit

2 participants