我从 YAML header 中得到了一个奇怪的输出,这是我不希望看到的。 相反,我期望正常的输出,包括标题、作者和目录。
以下代码产生以下输出:
---
title: General Stuff
author: Me
output:
html_document:
toc: true # table of content true
toc_depth: 3 # upto three depths of headings (specified by #, ## and ###)
number_sections: true ## if you want number sections at each table header
theme: united
---
生成此输出:
我从显示文件的 GitHub 获得了此输出。也许问题是 GitHub 使用了一些有趣的 Markdown 版本...?
最佳答案
Maybe the issue is that GitHub uses some interesting markdown version...?
YAML frontmatter 不是 Markdown itself 的一部分。普通的 Markdown 处理器不会用它做任何特别的事情。它可能会呈现 <hr>
和一些文本,可能以标题结尾。
但是,是的,GitHub treats YAML front matter specially :
Many blogging websites, like Jekyll with GitHub Pages, depend on some YAML-formatted metadata at the beginning of your post. You know, the stuff that goes between dashes like this:
--- title: Blogging Like a Boss ---
Starting [September 27, 2013], we’ll render this metadata within GitHub as an horizontal table, for easier reading
关于github - Markdown 文件的 YAML header 在文档顶部生成奇怪的表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56315934/