Search code examples
githubmarkdowngithub-flavored-markdown

YAML header of markdown file generates odd table on top of document


I get a weird output from my YAML header which I do not intend. Instead I expect the normal output with title, author and the table of contents of course.

The following code produces the following output:

---
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
---

generates this output:

I got this output from GitHub where the file is displayed. Maybe the issue is that GitHub uses some interesting markdown version...?


Solution

  • Maybe the issue is that GitHub uses some interesting markdown version...?

    YAML frontmatter isn't part of Markdown itself. A regular Markdown processor wouldn't do anything special with it. It would probably render a <hr> and some text, maybe ending with a header.

    But yes, 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