vuepress-plugin-nuggets-style-copy

1.0.3 • Public • Published

Nuggets style code block replication

background

Although there are plug-ins for code replication block in the community, I don't like the style very much, so I implemented one by myself. The inspiration comes from the gold digging community and element

中文文档

How to use

npm i vuepress-plugin-nuggets-style-copy
# or 
yarn i vuepress-plugin-nuggets-style-copy
  • config.js
module.exports = {
  //. omitted
};
plugins: [
  //. omitted
  ["vuepress-plugin-nuggets-style-copy"]
];

api

selector

Selector, default to div[class*="language-"] pre

copyText

Copy the text displayed in the code block, the default is copy code

change

change: (text:string, e:HTMLelement) => void When copying changes, the callback function, text 'is the code block copy text or failure prompt, e is the attribute of the component element itself. You can implement some advanced customization functions on this basis (this is the current component)

visibleTip

Display the default prompt after code copying. The default is true

tip

  • time After copying successfully, the display time will be prompted by default, which is 3000 . If it is infinity, it is unlimited
  • content The prompt content after copying successfully. The default is copy success
  • title Title after copying successfully, default is tips

Agreement

MIT

Package Sidebar

Install

npm i vuepress-plugin-nuggets-style-copy

Weekly Downloads

33

Version

1.0.3

License

MIT

Unpacked Size

112 kB

Total Files

11

Last publish

Collaborators

  • cs-xy