简体   繁体   English

使用gitbook格式和样式创建单个独立的html bookdown文件

[英]create single, standalone html bookdown file w/gitbook format & style

How do I create a single, standalone bookdown html file that retains the gitbook format/style? 如何创建保留gitbook格式/样式的单个独立bookdown html文件? Using the bookdown demo, my goal is to create a single .html file that I can share or publish to my website. 使用bookdown演示,我的目标是创建一个可以共享或发布到我的网站的.html文件。 I want to retain the gitbook style (table of contents, layout, color, etc) but I don't want the format as gitbook or epub; 我想保留gitbook的样式(目录,布局,颜色等),但不希望格式为gitbook或epub; I want the format as a single .html file. 我希望该格式为单个.html文件。

This post is related but does not answer my question. 这篇文章是相关的,但没有回答我的问题。 When I add 'split_by:none' to my _output.yml file it does create a single html file. 当我在_output.yml文件中添加“ split_by:none”时,它确实创建了一个html文件。 But that .html file is still not a standalone document; 但是那个.html文件仍然不是一个独立的文档。 if I copy and paste it elsewhere it does not retain the layout, style, and functionality. 如果我将其复制并粘贴到其他位置,则它不会保留布局,样式和功能。 How can I achieve a single, standalone html file with the gitbook format/style using bookdown? 如何使用Bookdown获得gitbook格式/样式的单个独立html文件?

bookdown::gitbook: split_by: none css: ...

You can produce a self contained file using 您可以使用以下方法生成自包含文件

bookdown::gitbook:
  split_by: none
  self_contained: true
  css: ...

However, while this does work in principle, you might get into trouble along the way, cf https://github.com/rstudio/bookdown/issues/61#issuecomment-200996786 . 但是,尽管这在原则上确实可行,但是您可能会遇到麻烦,请参阅https://github.com/rstudio/bookdown/issues/61#issuecomment-200996786

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM