Can anybody help me figure out how to enable the sweet copy to clipboard button on block quotes in a bookdown website?
It appears that this is fairly easily changed.
Add the following CSS
blockquote {
position: relative;
}
blockquote:hover > .copy-to-clipboard-button {
visibility: visible;
}
Then edit the /libs/gitbook-2.6.7/js/plugin-clipboard.js file and swap out this line:
$(copyButton).prependTo("div.sourceCode");
replacing it with this:
$(copyButton).prependTo("blockquote");
However, I cannot figure out how to change that javascript file permanently. It is always replaced when the book is built. Does anybody know how I could make the change permanent?
Thanks in advance.
Here is the complete solution, without needing to make manual changes after every build of the book.
(Note: this stops code blocks from having the copy to clipboard button, and adds it to the blockquote blocks.)
Add the following CSS to the style.css file:
blockquote {
position: relative;
}
blockquote:hover > .copy-to-clipboard-button {
visibility: visible;
}
Add the following lines to the end of the _build.sh file
sed -e "s/div.sourceCode/blockquote/" ./_book/libs/gitbook-2.6.7/js/plugin-clipboard.js > ./_book/libs/gitbook-2.6.7/js/plugin-clipboard_new.js
mv ./_book/libs/gitbook-2.6.7/js/plugin-clipboard_new.js ./_book/libs/gitbook-2.6.7/js/plugin-clipboard.js
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.