You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Quarto文档中加载外部YAML文件以统一配置参数?

Quarto 标准化YAML参数配置方案

有三种实用方法可以实现标准化YAML参数复用,让终端用户仅需修改文档标题:

方法一:使用项目全局配置文件 _quarto.yml

  • 在项目根目录创建_quarto.yml文件,将标准化参数按格式嵌套配置:
format:
  revealjs:
    subtitle: Organization Template
    footer: Organization Footer
    logo: logo.png
    filters: filters.lua
  • 终端用户的单个文档只需设置标题即可,无需重复其他参数:
---
title: "自定义文档标题"
---

Quarto会自动加载全局配置,并与文档内的参数合并生效。

方法二:使用外部YAML文件直接引入

  • 将标准化参数保存为独立文件(比如standard_config.yml),内容如下:
subtitle: Organization Template
footer: Organization Footer
logo: logo.png
filters: filters.lua
format: revealjs
  • 终端用户在文档的YAML头部通过!include指令引入该文件,仅需自定义标题:
---
title: "自定义文档标题"
!include: standard_config.yml
---

方法三:使用Quarto模板文件

  • 创建模板文件(比如org_template.qmd),内置标准化参数并预留标题占位:
---
title: "{{< meta title >}}"
subtitle: Organization Template
footer: Organization Footer
logo: logo.png
filters: filters.lua
format: revealjs
---
  • 终端用户基于该模板新建文档时,只需替换title字段内容即可,无需复制其他配置项。

内容的提问来源于stack exchange,提问作者kputschko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 18:23:22