Adds a GitHub-like copy button to every fenced code block inside the VS Code Markdown preview.
- Hover any
codeblock in the Markdown preview to reveal a copy button in the top-right corner. - Copies the rendered code exactly as it appears, including multi-line selections and highlighted lines.
- Provides instant visual feedback (icon swap + accessible label) so you always know when the copy completed.
- Works with light and dark themes, following VS Code color tokens for seamless integration.
- Open a Markdown file.
- Launch the built-in Markdown preview (
Markdown: Open Previewcommand orCtrl+K VorCtrl+Shift+V). - Hover a code block and press the copy button to send its contents to your clipboard.
That's it—no extra configuration required.
- When clipboard permissions are denied by the OS, the button falls back to the legacy
document.execCommand('copy'). If the environment blocks both APIs the operation will fail silently.
npm installnpm run watchto keep the TypeScript entry point compiled (even though the feature currently lives in the preview script).- Press
F5in VS Code to launch an Extension Development Host and test the Markdown preview.
- Marketplace metadata (homepage, bugs URL, keywords and gallery banner) added.
- README now includes a screenshot of the copy button experience.
- Added an activation smoke test that runs with
npm test.
- Added automatic copy buttons for Markdown preview code blocks with GitHub-inspired styling and clipboard handling.
