feat(md-copy): per-message + whole-conversation markdown copy/export#6
Conversation
…t/open) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
block() dispatches on each child's tag, so passing a bare <pre>/<ul>/<table> as root flattened it (its own tag never handled). Wrap root in a one-off container so its own tag is dispatched too; behavior is unchanged when root is the bubble container (the production path). Found while reaching GREEN on the converter tests, which pass single block elements as root. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ansform --revert)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Inline code used single backticks and fenced blocks always used three, so copied/exported content that itself contained a backtick run closed the fence early and produced structurally-broken Markdown. Both the webview converter (htmlToMarkdown) and the CLI exporter (_fence) now choose a delimiter one longer than the longest backtick run in the content (>=3 for fences), and inline code gets CommonMark space-padding when an edge is a backtick. Regenerated the three embeds from the updated source. Adds converter + exporter tests for backtick content (Codex audit, Medium). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both launchers still said they combine "TWO" fixes and the toggle guidance omitted CC_PATCH_MD_COPY, so "thinking only" guidance would still leave the md-copy webview patch enabled. Document the third fix and CC_PATCH_MD_COPY in the headers and toggle lists. Comments only; the embed region is untouched (Codex audit, Low). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e71e702c03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * Additive and read-only w.r.t. app state; keyed on stable CSS-module class | ||
| * prefixes, so it fails safe (controls simply do not appear) if a prefix moves. | ||
| * Exposes its pure functions for node unit tests; boot()s only in a real webview. */ | ||
| (function () { |
There was a problem hiding this comment.
Prefix the appended IIFE with a semicolon
When this payload is appended to webview/index.js, it starts with an IIFE token ( after only comments/newlines. If the upstream bundle happens to end with an expression statement without a trailing semicolon (for example console.log(1) or a minified call expression), JavaScript parses the appended IIFE as a continuation call like previousExpression(function(){...})(), which can throw before the webview app initializes. Add a leading semicolon to the injected payload (or append one before the sentinel) so the patch is safe regardless of the bundle's final token.
Useful? React with 👍 / 👎.
Summary
Adds a markdown copy/export feature as three deliverables in
fixes/markdown-copy-export/:cc-export.py- standalone CLI: reads a session.jsonland renders Markdown (--format,--include-thinking/--include-tools,--open,-o).webview-inject.{js,css}- per-message and whole-conversation "Copy" controls (Markdown / plain text) in the VS Code chat, with an embedded DOM->Markdown converter; keyed on[data-testid="assistant-message"]and a sanitizer that strips the rating widget + tool/thinking blocks; fails safe (controls simply do not appear if the markup moves).add-md-copy.py- standalone patcher (sentinel-block append, marker-scoped--revert, composes with context-icon).Plus
tools/gen-embeds(single-source payload -> bash heredoc / node JSON / python base64 embeds, with a--check/--strictdrift gate) and launcher integration:CC_PATCH_MD_COPY(default on) reconciles bothindex.jsandindex.css.The copy UI ships on by default (
CC_PATCH_MD_COPY=0to opt out). Stacked onlauncher-refactor(PR 1); the base retargets tomainonce PR 1 merges. Incorporates two rounds of Codex audit (6 pre-implementation findings + 2 post-implementation: delimiter-safe code fences, launcher header comments).Test plan
python3 -m unittest discover -s tests(85 cases)python3 tools/gen-embeds --check --strict(all three consumers in sync)bash -n/ ShellCheck /node --check/py_compile🤖 Generated with Claude Code