Make code blocks copyable in default theme
See original GitHub issueFeature request
What problem does this feature solve?
This is interesting phrasing, since many features don’t solve a problem as much as provide an enhancement 😉 . That said, execCommand
is a common feature of code blocks in technical documentation. If you’re writing large amounts of code, it’s often easier to have the user click a copy button (icon or text or whatever) and have a confirmation of some kind saying the text has been copied to the clipboard.
What does the proposed API look like?
Go here and hover the first code block: https://angular.io/guide/displaying-data
How should this be implemented in your opinion?
Plenty of options for implementation, including the popular clipboard.js. I think turning this feature on/off should be as simple as a boolean in the config.
Are you willing to work on this yourself?**
I wish I could, but I’m more of a technical writer than a frontend developer, so this feels a bit brazen.
Cheers all around to VuePress (just discovered this project a couple days ago and it’s AWESOME!) and to the Vue community in general. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:18 (4 by maintainers)
Fixed. I missed the
-plugin
due to text breaking.https://github.com/dovy/vuepress-plugin-clipboard-copy/
['@dovyp/vuepress-plugin-clipboard-copy', true]
😃
I’ve created a implementation, that behaves like this: https://www.youtube.com/watch?v=YJ3lnB9AxcM&feature=youtu.be Will create a PR soon