Skip to content

Commit 1283bc4

Browse files
committed
docs: Add instructions to README 📕
1 parent b90e534 commit 1283bc4

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
# docsify-copy-code
22

3-
A docsify plugin that copies a markdown code block to your clipboard
3+
A docsify plugin that adds a button to easily copy code blocks to your clipboard.
44

5-
> CURRENTLY UNDER DEVELOPMENT
5+
## Usage
6+
7+
Assuming you have a working [docsify](https://docsify.js.org) app set up, it is easy to use this plugin.
8+
9+
### Add stylesheet
10+
11+
Simply add the following style tag to the `<head>` of `index.html` file below your theme css:
12+
13+
```html
14+
<link rel="stylesheet" href="//unpkg.com/docsify-copy-code/styles.css">
15+
```
16+
17+
This will always load the latest version of this plugin's stylesheet. If you want to load a specific version, you can also insert the stylesheet like this, specifying the version number (0.1.0 in the example):
18+
19+
```html
20+
<link rel="stylesheet" href="//unpkg.com/[email protected]/styles.css">
21+
```
22+
23+
### Add script
24+
25+
Add the following `script` tag above your `window.$docsify = {}` configuration:
26+
27+
```html
28+
<script src="//unpkg.com/docsify-copy-code/index.js"></script>
29+
```
30+
31+
Again, you can also specify a specific version if you want to.
32+
33+
### Initialize plugin
34+
35+
Finally, after you've added the stylesheet and script file, you can initialize this plugin like this:
36+
37+
```javascript
38+
window.$docsify = {
39+
// Other docsify config options go here
40+
plugins: [
41+
// Other plugins might go here
42+
window.DocsifyCopyCodePlugin.init()
43+
]
44+
}
45+
```
46+
47+
That is it! If all went well, any preformatted code should now have a `Click to copy!` link on hover.

0 commit comments

Comments
 (0)