Displays authenticated GitHub user-attachments images and videos in VS
Code's built-in Markdown preview.
Tip
Install from the Marketplace to receive extension updates automatically.
GitHub may require authentication for attachment URLs even when the repository
is public. Browsers use the signed-in GitHub session, while VS Code's Markdown
preview normally requests the attachment anonymously and receives a 404.
- Sign in to GitHub from VS Code's Accounts menu.
- Open a Markdown file containing a GitHub attachment in a trusted workspace.
- Run Markdown: Open Preview.
- Approve repository access when VS Code prompts.
The first render starts an authenticated download. The preview refreshes automatically when the attachment is ready.
In a Remote-SSH window, install the extension on the SSH host when prompted. Markdown preview plugins must run in the same remote extension host as VS Code's built-in Markdown extension.
Markdown images:
Standalone attachment URLs are detected as images or videos from their MIME type:
https://github.com/user-attachments/assets/11111111-2222-4333-8444-555555555555HTML image, video, and source elements:
<img src="https://github.com/user-attachments/assets/11111111-2222-4333-8444-555555555555">
<video controls src="https://github.com/user-attachments/assets/11111111-2222-4333-8444-555555555555"></video>
<video controls>
<source src="https://github.com/user-attachments/assets/11111111-2222-4333-8444-555555555555">
</video>- Images: PNG, JPEG, GIF, WebP, BMP, and TIFF signatures, plus formats such as
SVG and AVIF when GitHub returns a valid
image/*MIME type. - Videos: MP4, WebM, and MOV.
Rendering ultimately depends on the image decoder and video codecs available in VS Code's embedded browser. In particular, MOV playback varies by codec.
- Only exact HTTPS
github.com/user-attachments/assets/<id>URLs are handled. - The extension stays disabled in Restricted Mode and never downloads media from an untrusted workspace.
- Ordinary remote images and repository file links are unchanged.
- PDFs, archives, logs, audio, and other unsupported attachments remain links.
- Images default to a 20 MB limit and videos to 100 MB. Both are configurable.
- Images are held in extension memory. Videos are streamed to VS Code's extension storage directory to avoid Base64 memory amplification.
- Cached media is released when the cache is cleared, the active GitHub session changes, or VS Code closes.
- GitHub credentials never enter Markdown, generated HTML, files, logs, or the preview webview.
npm install
npm run package
code --install-extension github-attachment-preview-*.vsixgithubAttachmentPreview.maxImageSizeMB: maximum image size loaded into the preview. Defaults to 20 MB.githubAttachmentPreview.maxVideoSizeMB: maximum video size loaded into the preview. Defaults to 100 MB.
Use GitHub Attachment Preview: Clear Attachment Cache to clear downloaded attachments and retry failed requests.