0

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 .

enter image description here

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.