Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pbklink
Copy link
Contributor

@pbklink pbklink commented Dec 19, 2021

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.


if (navigator && navigator.clipboard) {
addCopyButtons(navigator.clipboard);
} else {
Copy link
Owner

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Owner

@bjacquemet bjacquemet left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants