Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Markdown Preview Selection SyncNew to Visual Studio Code? Get it now.
Markdown Preview Selection Sync

Markdown Preview Selection Sync

Alex Zanfir

|
13 installs
| (0) | Free
Synchronizes text selection from Markdown preview to source editor - perfect for AI assistants
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Markdown Preview Selection Sync

Automatically sync text selection from Markdown preview to your source editor.

Why Use This?

When working with AI assistants like Claude Code, Copilot, or other tools that read your editor selection, you often want to reference specific content from your markdown preview. This extension bridges that gap by automatically selecting the corresponding source lines when you select text in the preview.

Features

  • ✨ Automatic Selection Sync: Select text in the preview, see it selected in the source
  • 🎯 Block-Level Precision: Selects the corresponding lines in your markdown source
  • 🚀 Zero Configuration: Works out of the box with VS Code's markdown preview
  • 🔄 Multi-File Support: Handles multiple markdown files and preview tabs
  • ⚡ Lightweight: Minimal performance impact, no external dependencies

How It Works

  1. Open a markdown file and its preview:
    • Side-by-side: Ctrl+K V or Cmd+K V (preview opens in split editor)
    • Separate tab: Alt+Click on preview icon (preview opens in new tab)
  2. Select any text in the preview by clicking and dragging
  3. Release the mouse button
  4. The extension automatically selects the corresponding lines in your source editor
  5. Your cursor moves to the source editor with the selection highlighted

Works with both preview modes:

  • ✅ Side-by-side preview (split editor group)
  • ✅ Separate tab preview (dedicated preview tab)

Use Cases

  • AI Assistants: Quickly reference preview content when chatting with Claude, Copilot, or other AI tools
  • Content Review: Easily jump to source lines while reviewing rendered content
  • Documentation: Navigate between preview and source while editing docs
  • Collaboration: Point team members to specific content during reviews

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
  3. Search for "Markdown Preview Selection Sync"
  4. Click Install

Extension Settings

This extension contributes the following settings:

  • markdownPreviewSelectionSync.requireModifierKey: Require holding a modifier key (Ctrl/Cmd/Alt) while selecting text to trigger sync. When enabled, normal text selection works without syncing. (Default: false)
  • markdownPreviewSelectionSync.modifierKey: Which modifier key to use when requireModifierKey is enabled. Options: ctrl, alt, meta (Cmd on Mac, Windows key on Windows/Linux). (Default: ctrl)
  • markdownPreviewSelectionSync.maxSearchLines: Maximum number of lines to search when finding multi-line selections. (Default: 50)

Example: Enable Ctrl+Click activation

To prevent accidental selection syncing and only trigger when holding Ctrl:

  1. Open VS Code Settings (Ctrl+, or Cmd+,)
  2. Search for "Markdown Preview Selection Sync"
  3. Enable "Require Modifier Key"
  4. Select your preferred modifier key (Ctrl, Alt, or Meta)

Now selections will only sync when you hold the modifier key while selecting text in the preview.

Contributing

Contributions are welcome! Please see the Development Instructions for setup and development workflow.

License

MIT - See LICENSE file for details

Author

Alexander Zanfir

  • GitHub: @AlexZan

Enjoy using Markdown Preview Selection Sync! If you find it useful, please leave a rating on the VS Code Marketplace.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft