fix(export): prevent nested code fences from breaking markdown exports - #1358
soumojit-D48 wants to merge 1 commit into
Conversation
No changeset foundThis PR does not add a changeset, so it will not appear in the changelog or trigger a release. If the change is user-facing, add one: pnpm changesetPick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated If this PR is docs-only or a chore that needs no release note, you can ignore this — or run |
nc-review: comments — 2 important, 1 nit@soumojit-D48 — a few things worth a look, none blocking. The fix correctly addresses issue #1347: a new 🟠 important · This is a user-facing bug fix ( 🟠 important · The diff reformats dozens of unrelated lines in the spec file ( ⚪ nit · The new regression test only covers the case where the longest run is exactly three backticks (output fence is four). A second case with a longer inner run (e.g. content containing 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
Description
Fixes #1347 by making the Markdown fences around exported tool output dynamic.
Previously,
/exportalways wrapped tool output in a three-backtick code fence. If the tool output itself contained a Markdown code block, the inner three backticks prematurely closed the outer fence and corrupted the exported conversation. This commonly affectedread_file, search results, diffs, and other tools that return Markdown or source code.The export formatter now finds the longest consecutive run of backticks in the tool output and uses a fence that is one character longer, with a minimum length of three. Normal tool output keeps the existing format, while nested code blocks remain intact in the generated Markdown file.
This change is limited to Markdown export formatting and does not change tool execution, message contents, or provider behavior.
Type of Change
Changeset
pnpm changeset) describing this change for the changelogDocs-only or internal chores need no changeset.
Testing
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)source/commands/export.spec.tsxManual Testing
Checklist