Uh oh!
There was an error while loading. Please reload this page.
Add copy buttons to code blocks - #629
Conversation
amad-person
commented
Jan 24, 2019
Some questions:
|
9af7aa3 to
ba162d1Compare
It won't be easy to implement a way for users to select whether they want a copy button or not. Since it is using Markdown syntax to specify the code block. A more thorough implementation would require you to implement a code block component in vue, which can greatly extend customisation easily via props (E.G For now, I think this implementation is ok. Some initial feedback:
Is there a specific reason for using the library instead of just using Compatibility with old browsers (IE8 or earlier) is not important as we rely heavily on modern browser APIs in our components (especially responsive design). |
| } | ||
| pre .clipboard-btn { | ||
| right: 10px; |
There was a problem hiding this comment.
Seems too much, it's noticeably further from the right than the top.
| clipboard.on('success', (e) => { | ||
| const clipboardBtn = jQuery(e.trigger); | ||
| clipboardBtn.removeClass('fa fa-clipboard'); |
An alternative to this is to use the syntax from ```python {.copy}nums = [x for x in range(10)]```However, due to the way |
damithc
commented
Jan 25, 2019
Note there are some more pending issues related to code blocks. You can consider them when making a decision. As we target project documentation, our code blocks feature needs to be pretty much the best in town. |
marvinchin
left a comment
There was a problem hiding this comment.
Is this PR still in active development 😅 Looks like a useful feature!
| background-color: transparent; | ||
| height: 30px; | ||
| transition: all .25s ease-out; | ||
| } |
There was a problem hiding this comment.
I think the attributes should be ordered alphabetically for CSS 🙂
Xenonym
commented
Mar 17, 2019
Now that we have support for plugins, perhaps this should be re-implemented as a plugin. |
amad-person
commented
Mar 19, 2019
Apologies, I haven't been able to work on this PR since I'm working on the conversion feature 😢 |
damithc
commented
May 20, 2019
@amad-person do you plan to continue this PR? If not, go ahead and close it. |
amad-person
commented
May 21, 2019
I don't think I can work on this before the next sem starts 😅 |
yash-chowdhary
commented
Jan 26, 2020
@amad-person Could I have a shot at this if you're not working on it? |
amad-person
commented
Jan 26, 2020
Sure, thanks for taking it up |
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [X] Enhancement to an existing feature
Fixes#562.
What is the rationale for this request?
Adding copy buttons to code blocks will allow users to copy code snippets with a single click.
What changes did you make? (Give an overview)
Page.js,markbind.css).setup.js) using the minified version of clipboard.js as an imported asset.Testing instructions:
Build the docs website and check the copy buttons for code blocks are working correctly.