Miracles sometimes occur,

but one has to work terribly for them.

人生除了眼前的苟且,还有未知的 bug 和看不懂的 code

Scroll

# vuepress-plugin-copy-code

A vuepress plugin for clipboard-copy

# Install

# install dependencies
npm i vuepress-plugin-copy-code -D

# or use yarn
yarn add vuepress-plugin-copy-code -D
1
2
3
4
5

# Usage

Write vuepress config

module.exports = {
  plugins: ['copy-code']
}
1
2
3

# Options

This plugin supports the following configurations.

module.exports = {
  plugins: ['copy-code', {
    copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
    copyMessage: 'Copy successfully and then paste it for use.', // default is 'Copy successfully and then paste it for use.'
    duration: 300, // prompt message display time.
    showInMobile: false // whether to display on the mobile side, default: false.
  }]
}
1
2
3
4
5
6
7
8

# demo

https://psrheartache.gitee.io (opens new window)