How to use gitbook plugin in gitbook style bookdown

痴心易碎 提交于 2021-01-29 14:48:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!