@anyfork/vuepress-plugin-code-copy
v0.1.0-beta.2
Published
vuepress plugin code copy for vuepress v1.x
Downloads
7
Maintainers
Readme
@anyfork/vuepress-plugin-code-copy
install
npm i @anyfork/vuepress-plugin-code-copy
# or
yarn add @anyfork/vuepress-plugin-code-copy
usage
- config.js
module.exports = {
plugins: [
[
'@anyfork/vuepress-plugin-code-copy',
{
copyText: '复制代码',
tip: {
content: '复制成功!'
}
}
]
];
}
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 isinfinity
, it is unlimited - content
The prompt content after copying successfully. The default is
copy success
- title
Title after copying successfully, default is
tips