-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Option to display copy buttons. #1050
Conversation
- Added field to playpen data structure - Communicate through window.playpen_copyable - Javascript updated to check before displaying copy buttons.
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.
Awesome! Just need a little changes.
src/config.rs
Outdated
@@ -476,6 +476,8 @@ impl HtmlConfig { | |||
pub struct Playpen { | |||
/// Should playpen snippets be editable? Default: `false`. | |||
pub editable: bool, | |||
/// display the copy button |
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.
Uppercase the first letter might be better and more consistent across comments. Also, we love to document default values especially when it is not the default of that type.
/// display the copy button | |
/// Display the copy button. Default: `true`. |
@@ -445,6 +445,9 @@ fn make_data( | |||
data.insert("playpen_line_numbers".to_owned(), json!(true)); | |||
} | |||
} | |||
if html.playpen.copyable { |
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.
It should be html_config
.
if html.playpen.copyable { | |
if html_config.playpen.copyable { |
Also: - update description of copyable in source code. - update description of line_numbers (my last PR to this repository)
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.
Nice work! @Dylan-DPC this seems can be merged.
Thank you! |
* Option to display copy buttons. - Added field to playpen data structure - Communicate through window.playpen_copyable - Javascript updated to check before displaying copy buttons. * html -> html_config Also: - update description of copyable in source code. - update description of line_numbers (my last PR to this repository)
Fixes #1043