【发布时间】:2021-01-03 17:31:01
【问题描述】:
我有一个大型 Bookdown 文档,我想将它作为 HTML 文件托管在网站上。我使用bookdown::gitbook 构建网站,本地预览看起来不错。但是,当我在网站中托管 html 文件时,它们似乎失去了 HTML 样式并且看起来很糟糕。有什么解决方法吗?
已编辑:在我的 Index.Rmd 文件开头添加 yaml:
---
title: "Team Documentation"
author: "Maxx"
date: "Updated on `r Sys.Date()`"
knit: "bookdown::render_book"
site: bookdown::bookdown_site
bibliography: [book.bib]
biblio-style: apalike
link-citations: yes
colorlinks: yes
lot: yes
lof: yes
fontsize: 13pt
monofontoptions: "Scale=0.7"
description: "This is a collection of commonly used information and how-to documents"
output:
bookdown::gitbook:
self_contained: true
css: css/style.css
split_by: section+number
config:
toc:
collapse: section
before: |
<li><a href="./index.html">Documentation</a></li>
after: null
toolbar:
position: fixed
edit: null
download: null
search: yes
sharing: false
info: yes
bookdown::html_book:
css: css/toc.css
---
【问题讨论】:
-
服务器无法找到(自定义?)CSS 文件。你能提供一个MWE吗?
-
@M. A. 好点 - 我从上面的 .Rmd 文件中添加了 yaml。该问题可能与
self_contained: true有关 - 我试图创建一个独立的 HTML 文件输出可能存在问题。感谢您的回复,我将创建一个 MWE。