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

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

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: &quot;slide example&quot;
    format:
      revealjs: 
        filters:
          - &quot;../../_extensions/quarto-ext/fontawesome&quot;
    ---
    
    ## 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: &quot;slide example&quot;
format: revealjs
---

## Hello World

{{&lt; fa thumbs-up &gt;}} 
{{&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:

确定