0.0.3 • Published 5 months ago

vitepress-copy-helper v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

vitepress-copy-helper

This plugin lets you add a copy button to your single-backtick-code-blocks and general purpose copy buttons.

Installation

npm install --save-dev vitepress-copy-helper

Usage

In .vitepress/theme/index.js:

import CopyButton from 'vitepress-copy-helper';
import 'vitepress-copy-helper/style.css'

then, in the enhanceApp function, add:

app.component('C', CopyButton),

C is the name of the component you will use in your markdown files, you can change it to whatever you want.

Default Settings

To override the default settings, change the import to:

import {default as CopyButton, defaultSettings} from 'vitepress-copy-helper'
import 'vitepress-copy-helper/style.css'

Just change the properties of defaultSettings to your liking:

PropertyTypeDefaultDescription
positionstring'auto'The position of the button, relative to the target code-element. auto, start, end
messagestring'copied'The message that will be displayed when the button is clicked
labelstringnullThe label of the button, if null, no label is rendered
classesstring'copy-btn'The classes that will be added to the button
targetstring'auto'Controls which code-element the button attaches to when wedged between code-elements
preferSiblingstring'previous'Controls which code-element is picked when button is wedged and target is auto. previous, next

Examples

Look here for usage examples

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago