pandoc “无法解析 yaml 标头"将 md 转换为 pdf 时 [英] pandoc "cannot parse yaml header" when converting md to pdf

查看:33
本文介绍了pandoc “无法解析 yaml 标头"将 md 转换为 pdf 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 pandoc 将 markdown 文档转换为 pdf,它工作正常,直到它开始显示错误:

I am trying to convert a markdown document to pdf using pandoc, and it was working fine until it just started to show an error:

pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 32, column 85
pandoc: YAML header is not an object "source" (line 17, column 1)
pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 8, column 91)

第 32 行和第 8 行是段落之间的空行,第 17 行是---".

Lines 32 and 8 are blank lines between paragraphs, and all that's on line 17 is "---".

我什至不知道 YAML 是什么,但我不想使用它,只是 MD->LaTeX->PDF.

I don't even know what YAML is, but I don't want to use it, just MD->LaTeX->PDF.

搜索了这些错误,但只能找到提及 YAML 的内容,而不是错误.

Searched for these errors but could only find stuff mentioning YAML, not the errors.

任何帮助将不胜感激.

推荐答案

参见 http://johnmacfarlane.net/pandoc/README.html#yaml-metadata-block

您的文档中必须有一些看起来像 YAML 元数据块的东西,但实际上不是.这样的块将以 --- 单独一行开始,并以 ---... 单独一行结束.错误消息中的行号是指元数据块内的行,而不是文档的行.

There must be something in your document that looks like a YAML metadata block, but isn't. Such a block would start with --- on a line by itself and end with --- or ... on a line by itself. The line numbers in the error message refer to lines inside the metadata block, not to lines of the document.

顺便说一句,你可以通过把YAML元数据块解析完全关闭

By the way, you can turn off YAML metadata block parsing entirely by putting

--from markdown-yaml_metadata_block

在你的 pandoc 命令行中.

in your pandoc command line.

这篇关于pandoc “无法解析 yaml 标头"将 md 转换为 pdf 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆