在 R Markdown YAML 中包含 css 文件的文件路径

Bri*_*iro 5 r r-markdown xaringan

我需要将我的 R Markdown 链接到一个 css 文件。如果 css 文件与 .Rmd 文件位于同一目录中,则它可以正常工作。如果 css 位于不同的目录中,则它不起作用。

如何在 YAML 的 css 字段中包含文件路径?

这确实工作

---
title: "MY TITLE"
author: "MY NAME"
output:
  xaringan::moon_reader:
    lib_dir: libs
    css: path/to/xaringan_themer.css
    nature:
      highlightStyle: tomorrow-night-bright
      highlightLines: true
      countIncrementalSlides: false
      titleSlideClass: ["center","top"]
---
Run Code Online (Sandbox Code Playgroud)

pol*_*kas 3

于是我就探讨了这个多年来“热门”的话题。
最后一条消息是一个新问题,它指出了之前的所有问题并提供了解决方案https://github.com/rstudio/rmarkdown/issues/1859。作者指出他的分支https://github.com/jonathan-g/rmarkdown/tree/jg-develhttps://github.com/jonathan-g/rmarkdown/tree/minimal-tree-fix(最后一个将我的更改修剪到最小补丁以保持 PR 小)为这个问题提供了一个解决方案。此时 PR 仍然不存在,最后一次更新是在几个月前。

其他解决方案(我喜欢)可能是使用符号链接,此处介绍: https: //github.com/jdblischak/workflowr/issues/95#issuecomment-360138007 重要的是,符号链接受 git 支持。示例位于https://github.com/stephenslab/wflow-divvy/tree/dev下的组织目录下。