[英]How to use gitbook plugin in gitbook style bookdown
There is a simple procedure to put buttons for copying code of gitbooks.有一个简单的过程来放置用于复制 gitbooks 代码的按钮。 What would be the way to do that in a bookdown?在 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创建 index.md
and make book.json
:并制作book.json
:
{
"structure": {
"readme": "index.md"
},
"plugins": ["copy-code-button"]
}
Finally, gitbook build.
最后, gitbook build.
We just added the Copy
button in the development version of bookdown .我们刚刚在bookdown的开发版本中添加了Copy
按钮。 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 .回答您最初的问题:目前无法在bookdown中使用 gitbook 插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.