问题
There is a simple procedure to put buttons for copying code of gitbooks. What would be the way to do that in a bookdown?
# install npm
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
# install gitbook builder
sudo npm install -g gitbook
sudo npm install -g gitbook-cli
# git clone gitbook "example" repository
git clone ...
cd gitbook/
npm init
# Install plugin to add clipboard button for code
# https://www.npmjs.com/package/gitbook-plugin-copy-code-button
npm install gitbook-plugin-copy-code-button
Create index.md
- in this case, in Rstudio, New file>R Markdown>From Template>github
and make book.json
:
{
"structure": {
"readme": "index.md"
},
"plugins": ["copy-code-button"]
}
Finally, gitbook build .
回答1:
We just added the Copy button in the development version of bookdown. You may test it via
remotes::install_github('rstudio/bookdown')
To answer your original question: currently there is no way to use gitbook plugins in bookdown.
来源:https://stackoverflow.com/questions/58017029/how-to-use-gitbook-plugin-in-gitbook-style-bookdown