fix: backslash newlines when copying from a code block (#2709)
* fix: backslash newlines when copying from a code block When copying inline content from inside a code block, the text/plain clipboard payload had a backslash before every newline (markdown's hard-break syntax) and the text/html had `<br>` separators inside the code instead of literal newlines. Two changes fix this: - copyExtension routes selections inside a code block through the block-export path so the code block's own toExternalHTML produces the proper `<pre><code>` wrapper. - serializeInlineContentExternalHTML now plumbs blockType through to inlineContentToNodes (mirroring the internal HTML serializer) so `\n` in code-block content stays as literal text instead of being split into hardBreak nodes that render as `<br>`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: drop `as const` from PRETTIFY_OPTIONS to satisfy htmlfy types `as const` typed `ignore` as a readonly tuple, which doesn't match `UserConfig.ignore: string[]`, breaking CI typecheck. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: integrate code-block copy regression into existing copy test suite Address PR review: - Drop standalone codeBlockMarkdown.test.ts; add `codeBlockFullContent` and `codeBlockPartialSelection` cases to copyTestInstances.ts and snapshot text/plain markdown for all copy test instances via a new `Copy tests (Markdown)` describe block (mirrors the export test pattern). - Trim verbose comments in copyExtension and serializeBlocksExternalHTML. - copyPasteEquality executor now passes the actual markdown payload as the text/plain MIME instead of a literal "text" placeholder, so paste handlers that prefer text/plain (e.g. inside code blocks) round-trip correctly. - Update mixedInParagraph snapshots: prettify's `ignore: ["code"]` preserves trailing whitespace inside `<code>` spans, which is the actual HTML output. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
N
Nick Perez committed
c255558b2d4f2be6453c67df81bb702a1a586909
Parent: 8a03b69
Committed by GitHub <noreply@github.com>
on 5/15/2026, 8:06:22 AM