-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add copy code button option #27
base: master
Are you sure you want to change the base?
Conversation
|
||
if (navigator && navigator.clipboard) { | ||
addCopyButtons(navigator.clipboard); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the else
and comments?
No button should be added if feature is unavailable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for these PR @pbklink ! Very sorry for the delay.
I just added a comment about the behavior if clipboard feature is unavailable. Otherwise, all good to me. Thanks
Includes a feature where a copy button can be added to all code blocks in a website.
This feature can be enabled by setting the following parameter in
config.toml
copyCodeButtonEnabled = true
Note that this feature requires a JavaScript script. This script is included under the new
static/js
directory.