# vuepress-plugin-copyright
Handles copy behaviors in your VuePress site.
# Installation
npm install -D vuepress-plugin-copyright
# Usage
// .vuepress/config.js
module.exports = {
plugins: [
[
'vuepress-plugin-copyright',
{
noCopy: true, // the selected text will be uncopiable
minLength: 100, // if its length is greater than 100
},
],
],
}
# Use Frontmatter
You can enable or disable this plugin for the current page in frontmatter:
---
copyright: false # disable the plugin in this page
---
You can also do some local configuration:
---
# This is the frontmatter of the current page.
copyright:
minLength: 40 # It will override global configuration.
---
You can see the effect of the plugin in the textarea below:
# Custom Clipboard
You can customize your clipboard with clipboardComponent
. Here is a simple example:
<template>
<div>
<p>
Copyright © VuePress Community Link:
<a :href="location">{{ location }}</a>
</p>
<div v-html="html" />
</div>
</template>
<script>
export default {
props: ['html'],
created() {
this.location = window.location
},
}
</script>
# Configs
Options marked with frontmatterare also allowed in frontmatter. Options marked with defaultonly take effect when the default clipboard component is used.
# disabled
- type:
boolean
- default:
false
Whether to disable this plugin by default.
# noCopy frontmatter
- type:
boolean
- default:
false
Whether to prohibit copying.
# noSelect frontmatter
- type:
boolean
- default:
false
Whether to prohibit selecting.
# minLength frontmatter
- type:
number
- default:
0
The minimum text length that triggers the clipboard component or the noCopy
effect.
# authorName default
- type:
string | Record<string, string>
- default:
'Author'
Author name. You can provide a string or an i18n object, for example:
{
"en-US": "Author",
"zh-CN": "作者"
}
# clipboardComponent
- type:
string
- default:
undefined
The path to the custom clipboard component. If a relative path is specified, it will be resolved based on sourceDir
.