Skip to content

vitepress-image-viewer

VitePress image viewer with zoom, drag, fullscreen overlay, captions and download button. Automatically enhances all images on the page. Built with Vue 3.

npm
npm
license

Installation

npm
sh
npm i @miletorix/vitepress-image-viewer

Usage

Configuration

docs/.vitepress/theme/index.ts
typescript
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'

import ImageViewerP from '@miletorix/vitepress-image-viewer'
import '@miletorix/vitepress-image-viewer/style.css'

export default {
  extends: DefaultTheme,
  enhanceApp(ctx) {
    ImageViewerP(ctx.app) 
  }
}

Examples

Markdown Image

Input:

example.md
md
![Rolling hills, Moravia, Czech Republic.](/demo-2.jpg)

Output:

Rolling hills, Moravia, Czech Republic.

HTML Image

Input:

example.md
html
<img src="/demo-3.jpg" alt="Nature, Landscape, Portrait display." />

Output:

Nature, Landscape, Portrait display.

Image using the Image Group plugin


Input:

vue
<ImageGroup
  :sources="[
    'demo-4.jpg'
  ]"
  type="manual"
  width="400px"
  alt="Japanese Waterfall"
  caption="Japanese Waterfall"
/>

Output:

Japanese Waterfall - manual

Japanese Waterfall