我试图将输出主题设置为一个位置,而不是将其放置在每个rmarkdown文件的yaml标头中。所以我尝试了:
name: "casualties"
output_dir: "injuries"
navbar:
left:
- text: "Casualties"
href: index.html
- text: "Casualty map"
href: casualtymap.html
- text: "Frequently asked questions"
href: faqs.html
output:
prettydoc::html_pretty:
theme: cayman
highlight: github
然后每个页面都有
---
title: "page title"
---
,但导航栏不出现。如果我删除了输出信息,那就可以了。有办法做到这一点吗?
编辑: 根据Anthon的评论,我从bookdown guide中的示例中提取了缩进,发现:
使用prettydoc不会显示导航栏:
name: "Casualties"
navbar:
left:
- text: "Casualties"
href: index.html
- text: "Casualty map"
href: casualtymap.html
- text: "Frequently asked questions"
href: faqs.html
output_dir: "injuries"
output:
prettydoc::html_pretty:
theme: cayman
highlight: github
但是如果我不使用prettydoc,则会显示导航栏:
name: "Casualties"
navbar:
left:
- text: "Casualties"
href: index.html
- text: "Casualty map"
href: casualtymap.html
- text: "Frequently asked questions"
href: faqs.html
output_dir: "injuries"
output:
html_document:
theme: cosmo
highlight: textmate