简体   繁体   English

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

[英]Include filepath for css file in R Markdown YAML

I need to link my R Markdown to a css file.我需要将我的 R Markdown 链接到 css 文件。 If the css file is in the same directory as the.Rmd file, it works without problems.如果 css 文件与 .Rmd 文件位于同一目录中,则可以正常工作。 If the css is in a different directory, it does not work.如果 css 位于不同的目录中,则不起作用。

How do I include a file path in the css field of my YAML?如何在我的 YAML 的 css 字段中包含文件路径?

This does not work不起作用

---
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"]
---

So I explore this topic which is a "hot" one for years.所以我探索了这个多年来一直很“热门”的话题。
The last news is a new issue which pointing out all previous one and offers a solution https://github.com/rstudio/rmarkdown/issues/1859 .最后一条新闻是一个新问题,它指出了所有以前的问题并提供了解决方案https://github.com/rstudio/rmarkdown/issues/1859 Author stating that his branches https://github.com/jonathan-g/rmarkdown/tree/jg-devel and https://github.com/jonathan-g/rmarkdown/tree/minimal-tree-fix (this last one is pruning my changes down to a minimal patch to keep the PR small) offers a solution for this problem.作者声明他的分支https://github.com/jonathan-g/rmarkdown/tree/jg-develhttps://github.com/jonathan-g/rmarkdown/tree/minimal-tree-fix (最后一个正在将我的更改修剪到最小的补丁以保持 PR 小)为这个问题提供了一个解决方案。 The PR is still not exists at this point, with the last update a few months ago. PR 在这一点上仍然不存在,最后一次更新是在几个月前。

Other solution (which i like) might be usage of symlinks, presented here: https://github.com/jdblischak/workflowr/issues/95#issuecomment-360138007 What is important, symlinks are supported by git.其他解决方案(我喜欢)可能是使用符号链接,此处介绍: https://github.com/jdblischak/workflowr/issues/95#issuecomment-360138007重要的是,符号链接受 ZBA9F11ECC3497D9993B933FDC2BD61E5 支持。 Example at https://github.com/stephenslab/wflow-divvy/tree/dev under organized dir. https://github.com/stephenslab/wflow-divvy/tree/dev的示例在有组织的目录下。

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

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