Skip to content

About

Preview authenticated GitHub attachments in VS Code’s built-in Markdown preview

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

GitHub Attachment Preview

GitHub Attachment Preview

Displays authenticated GitHub user-attachments images and videos in VS Code's built-in Markdown preview.

Install from Visual Studio Marketplace

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.

Usage

  1. Sign in to GitHub from VS Code's Accounts menu.
  2. Open a Markdown file containing a GitHub attachment in a trusted workspace.
  3. Run Markdown: Open Preview.
  4. 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.

Supported markup

Markdown images:

![alt](https://github.com/user-attachments/assets/11111111-2222-4333-8444-555555555555)

Standalone attachment URLs are detected as images or videos from their MIME type:

https://github.com/user-attachments/assets/11111111-2222-4333-8444-555555555555

HTML 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>

Media formats

  • 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.

Scope and limits

  • 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.

Build and install

npm install
npm run package
code --install-extension github-attachment-preview-*.vsix

Settings

  • githubAttachmentPreview.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.

About

Preview authenticated GitHub attachments in VS Code’s built-in Markdown preview

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages