github - Markdown 文件的 YAML header 在文档顶部生成奇怪的表格

标签 github markdown github-flavored-markdown

我从 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/

相关文章:

github - Markdown 表未显示在 github .md 页面上

bash - 如何在 Markdown 中突出显示 bash/shell 命令?

git - 为 GitHub pull 请求更改 "base repo"

git - 在 Github repo 的子目录中安装 golang 库

git从远程分支的本地分支 rebase

html - 仅使用 CSS 在 `pre` 或 `code` block 内设置注释样式

gitlab - 更改gitlab markdown美人鱼图大小

git - 对多个 github 项目使用相同的部署 key

maven - 如何将 github markdown 文件包含到 maven 站点中

markdown - pandoc 对 protected 代码块的处理是否存在问题?