访问父文件夹中的扩展功能

huangapple go评论97阅读模式
英文:

Access extensions from parent folder

问题

我有一个四开的网站,具有以下的文件结构,其中 slides.qmd 被单独渲染。我想知道是否可以在 slides.qmd 的 revealjs-yml 中引用父文件夹的 _extensions 文件夹?虽然这样可以运行,但我想避免手动将扩展文件夹复制到 01-content 文件夹中。

  1. ├── _extensions
  2. ├── quarto-ext
  3. └── fontawesome
  4. ├── content
  5. └── index.qmd
  6. ├── 01-content
  7. ├── slides.qmd
  8. ├── _quarto.yml

我认为这样的方式可能会起作用:

  1. ---
  2. title: "slide example"
  3. format:
  4. revealjs:
  5. filters:
  6. - "../../_extensions/quarto-ext/fontawesome"
  7. ---
  8. ## Hello World
  9. ```{r}
  10. #| echo: true
  11. print(123)
  1. <details>
  2. <summary>英文:</summary>
  3. 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.
  4. ├── _extensions
  5. │ ├── quarto-ext
  6. │ │ └── fontawesome
  7. ├── content
  8. │ └── index.qmd
  9. │ ├── 01-content
  10. │ │ ├── slides.qmd
  11. ├── _quarto.yml
  12. I thought about something like this might work:
  13. ---
  14. title: &quot;slide example&quot;
  15. format:
  16. revealjs:
  17. filters:
  18. - &quot;../../_extensions/quarto-ext/fontawesome&quot;
  19. ---
  20. ## Hello World
  21. ```{r}
  22. #| echo: true
  23. print(123)
  24. ```
  25. </details>
  26. # 答案1
  27. **得分**: 1
  28. 根据我了解,无法在`filter`中使用相对路径包含扩展。而是应该在项目特定的 `_quarto.yml` 文件中使用该扩展,这将影响子目录中的 qmd 文件。
  29. 所以对于以下目录结构,
  30. **_quarto.yml**
  31. ``` yaml
  32. filters:
  33. - fontawesome

渲染以下内容如期工作。

  1. ---
  2. title: "slide example"
  3. format: revealjs
  4. ---
  5. ## Hello World
  6. {{< fa thumbs-up >}}
  7. {{< fa folder >}}
  8. ---
  9. [![fa icons on revealjs slide][1]][1]
  10. [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,

  1. .
  2. |----- _quarto.yml
  3. |----- _extensions
  4. | |--- quarto-ext
  5. | | |____fontawesome
  6. | | | |---- _extension.yml
  7. | | | |---- fontawesome.lua
  8. |---- contents
  9. | |---- slides
  10. | | |---- test.qmd

_quarto.yml

  1. filters:
  2. - fontawesome

rendering the following works as intended.

  1. ---
  2. title: &quot;slide example&quot;
  3. format: revealjs
  4. ---
  5. ## Hello World
  6. {{&lt; fa thumbs-up &gt;}}
  7. {{&lt; fa folder &gt;}}

<hr>

访问父文件夹中的扩展功能

huangapple
  • 本文由 发表于 2023年7月6日 21:48:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76629552.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定