英文:
Access extensions from parent folder
问题
我有一个四开的网站,具有以下的文件结构,其中 slides.qmd
被单独渲染。我想知道是否可以在 slides.qmd
的 revealjs-yml 中引用父文件夹的 _extensions
文件夹?虽然这样可以运行,但我想避免手动将扩展文件夹复制到 01-content
文件夹中。
├── _extensions
│ ├── quarto-ext
│ │ └── fontawesome
├── content
│ └── index.qmd
├── 01-content
│ ├── slides.qmd
├── _quarto.yml
我认为这样的方式可能会起作用:
---
title: "slide example"
format:
revealjs:
filters:
- "../../_extensions/quarto-ext/fontawesome"
---
## Hello World
```{r}
#| echo: true
print(123)
<details>
<summary>英文:</summary>
I have a quarto website with the following file structure where the `slides.qmd` are rendered individually. I was wondering if I can reference in the revealjs-yml of `slides.qmd` the `_extensions` folder of the parent folder? What works, but I try to avoid, is to copy the extensions folder manually to the `01-content` folder.
├── _extensions
│ ├── quarto-ext
│ │ └── fontawesome
├── content
│ └── index.qmd
│ ├── 01-content
│ │ ├── slides.qmd
├── _quarto.yml
I thought about something like this might work:
---
title: "slide example"
format:
revealjs:
filters:
- "../../_extensions/quarto-ext/fontawesome"
---
## Hello World
```{r}
#| echo: true
print(123)
```
</details>
# 答案1
**得分**: 1
根据我了解,无法在`filter`中使用相对路径包含扩展。而是应该在项目特定的 `_quarto.yml` 文件中使用该扩展,这将影响子目录中的 qmd 文件。
所以对于以下目录结构,
**_quarto.yml**
``` yaml
filters:
- fontawesome
渲染以下内容如期工作。
---
title: "slide example"
format: revealjs
---
## Hello World
{{< fa thumbs-up >}}
{{< fa folder >}}
---
[![fa icons on revealjs slide][1]][1]
[1]: https://i.stack.imgur.com/xkJR4.png
请注意,我已经将 Markdown 内容和代码示例保留在原样,只翻译了文本部分。
英文:
AFAIK, its not possible to include such relative path for extensions in filter
. Instead, use that extension in the project specific _quarto.yml
file which will affect the qmd files in the children directories.
So for the following directory structure,
.
|----- _quarto.yml
|----- _extensions
| |--- quarto-ext
| | |____fontawesome
| | | |---- _extension.yml
| | | |---- fontawesome.lua
|---- contents
| |---- slides
| | |---- test.qmd
_quarto.yml
filters:
- fontawesome
rendering the following works as intended.
---
title: "slide example"
format: revealjs
---
## Hello World
{{< fa thumbs-up >}}
{{< fa folder >}}
<hr>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论