vuepress-plugin-one-click-copy

A vuepress plugin for clipboard-copy

Usage no npm install needed!

<script type="module">
  import vuepressPluginOneClickCopy from 'https://cdn.skypack.dev/vuepress-plugin-one-click-copy';
</script>

README

vuepress-plugin-one-click-copy

A vuepress plugin for clipboard-copy

npm GitHub stars GitHub license

Install

# install dependencies
npm i vuepress-plugin-one-click-copy -D

# or use yarn
yarn add vuepress-plugin-one-click-copy -D

Usage

Write vuepress config

module.exports = {
  plugins: ['one-click-copy']
}

Options

This plugin supports the following configurations.

module.exports = {
  plugins: ['one-click-copy', {
    copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
    copyMessage: 'Copied successfully!', // default is 'Copied successfully!'
    toolTipMessage: 'Copy to clipboard', // default is ''Copy to clipboard'
    duration: 300, // prompt message display time
  }]
}

License

MIT.