Skip to content

Commit

Permalink
[docs] Add the ability to copy code (#1083)
Browse files Browse the repository at this point in the history
This adds the "copy" button for all code snippets in the docs example so
that users can easily copy the example code to their clipboard.

Fix #1080.

Example after change:

<img width="730" alt="Screen Shot 2023-05-07 at 10 37 26 PM"
src="https://user-images.githubusercontent.com/30421794/236742738-79285d4c-c723-41cc-8e22-0a6a06d461a1.png">
  • Loading branch information
sywhang authored May 8, 2023
1 parent ec9b096 commit 57e421a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,6 @@ module.exports = {
'@vuepress/plugin-medium-zoom',
'fulltext-search',
'vuepress-plugin-mermaidjs',
'vuepress-plugin-code-copy',
]
}
3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"dependencies": {
"cacheable-request": "10.2.7",
"got": "^10.3.0"
"got": "^10.3.0",
"vuepress-plugin-code-copy": "^1.0.6"
}
}
5 changes: 5 additions & 0 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8990,6 +8990,11 @@ vuepress-html-webpack-plugin@^3.2.0:
toposort "^1.0.0"
util.promisify "1.0.0"

vuepress-plugin-code-copy@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/vuepress-plugin-code-copy/-/vuepress-plugin-code-copy-1.0.6.tgz#6431dab764b48b5b203e4936d98b1943651ce4ad"
integrity sha512-FiqwMtlb4rEsOI56O6sSkekcd3SlESxbkR2IaTIQxsMOMoalKfW5R9WlR1Pjm10v6jmU661Ex8MR11k9IzrNUg==

vuepress-plugin-container@^2.0.2:
version "2.1.5"
resolved "https://registry.yarnpkg.com/vuepress-plugin-container/-/vuepress-plugin-container-2.1.5.tgz#37fff05662fedbd63ffd3a5463b2592c7a7f3133"
Expand Down

0 comments on commit 57e421a

Please sign in to comment.