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

如何为RMarkdown转PowerPoint指定目录层级?解决配置报错问题

解决PowerPoint目录层级自定义的YAML语法错误

报错信息翻译

错误于yaml::yaml.load(..., eval.expr = TRUE) : 
  扫描器错误:在此上下文不允许映射值,位于第9行第17列 
调用链:<Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous> 
执行终止

问题原因

你的YAML配置存在缩进错误,toc_depth是powerpoint_presentation下的同级配置项,需要和toc保持相同的缩进级别,不能额外缩进。

正确配置示例

title: "Test Site Report"
subtitle: "Supplement to the Provincial Report"

output: 
  powerpoint_presentation:
    reference_doc: template.pptx
    toc: true
    toc_depth: 1

调整后,toc_depth: 1会被正确识别,目录幻灯片只会显示顶级标题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 16:25:34