Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vitepress-plugin-image-viewer

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vitepress-plugin-image-viewer

image viewer for vitepress

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
117
decreased by-32.37%
Maintainers
1
Weekly downloads
 
Created
Source

vitepress-plugin-image-viewer

npm

EN | 中文文档

A vitepress image viewer plugin based on viewerjs

Install

// npm 
npm i vitepress-plugin-image-viewer
// yarn
yarn add vitepress-plugin-image-viewer

Usage

// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme';
import 'viewerjs/dist/viewer.min.css';
import imageViewer from 'vitepress-plugin-image-viewer';
import vImageViewer from 'vitepress-plugin-image-viewer/lib/vImageViewer.vue';
import { useRoute } from 'vitepress';

export default {
    ...DefaultTheme,
    enhanceApp(ctx) {
        DefaultTheme.enhanceApp(ctx);
        // Register global components, if you don't want to use it, you don't need to add it
        ctx.app.component('vImageViewer', vImageViewer);
        // ...
    },
    setup() {
        // Get route
        const route = useRoute();
        // Using
        imageViewer(route);
    }
};

imageViewer() takes three parameters:

  • route

    route (this is required)

  • el

    CSS selector (Default .vp-doc img, can be empty, this is not required)

  • option

    Configuration options (For detailed configuration, please refer to viewerjs option, there is already a default configuration, which is not required)

Component

vImageViewer component can be compiled into a button, click this button to pop up the picture, use as follows:

<vImageViewer src="/image/demo.png" alt="this is a demo image" :inline="false"/> 

inline is set to true, it will become an inline element, it is not required, default false

more vitepress plugins

You may be interested in these plugins: Click me to view more vitepress plugins

Keywords

FAQs

Package last updated on 15 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc