从使用 R 的 Jupyter notebook 到可能通过 (R)MarkDown 使用可折叠代码单元的 html

From Jupyter notebook using R to html with collapsible code cells possibly via (R)MarkDown

我使用 jupyter notebooks 和 R 没有问题。不幸的是,我还没有找到默认折叠代码单元的方法(最终目的是向利益相关者 html 发送折叠的代码单元)。因此,我想我使用 (R)Markdown。这里像开头这样的代码允许默认折叠代码:

---
title: "1984"
author: "George Orwell"
date: "1948"
output:
 html_document:
    code_folding: hide
    theme: lumen
    toc: yes
    toc_depth: 4
    toc_float: yes
---

我试过的步骤是这样的:

(1) 下载 notebook 为 markdown(文件扩展名为 .md) (2) 重命名文件扩展名为.rmd (3) 在 Visual Studio 中打开(在我的例子中是 Markdown Editor plugin

我遇到的问题是,当我下载 .md 文件时,它会创建如下条目:

![png](output_15_0.png)

生成 html 时似乎不起作用。

我可以用折叠的代码单元从我的笔记本中生成 html 吗?很高兴使用 knitr 等

PS:

除此之外,我得到:

File output_15_0.png not found in resource path
Error: pandoc document conversion failed with error 99

也许我可以添加资源路径?

好的,我找到了解决方案。我所要做的就是使用绝对路径。所以我更换了:

![png](output_15_0.png)

与:

![png](C:/Repos/SomeGreatSolution/SomeGreatProject/output_15_0.png)