Closed pavloo closed 6 years ago
I just did some checking. GitHub actually doesn't strip front-matter but renders it as a nested table. But only if YAML syntax is used. If the front-matter is TOML or JSON style it just renders it like regular text.
vmd should behave the same, if possible. We can strip it (i.e. not render it) and also add support for TOML and JSON but those behaviors should be turned off by default and can be enabled through config parameters / command-line arguments.
I tried some front-matter that I copied from the hugo docs.
YAML:
---
title: "spf13-vim 3.0 release and new website"
description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ]
lastmod: 2015-12-23
date: "2012-04-06"
categories:
- "Development"
- "VIM"
slug: "spf13-vim-3-0-release-and-new-website"
---
sdasdasd
Is rendered like this:
TOML-syntax front-matter is just rendered as text:
+++
title = "spf13-vim 3.0 release and new website"
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
date = "2012-04-06"
categories = [
"Development",
"VIM"
]
slug = "spf13-vim-3-0-release-and-new-website"
+++
sdasdasd
Looks like this:
Same with JSON-syntax front-matter:
{
"title": "spf13-vim 3.0 release and new website",
"description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.",
"tags": [ ".vimrc", "plugins", "spf13-vim", "vim" ],
"date": "2012-04-06",
"categories": [
"Development",
"VIM"
],
"slug": "spf13-vim-3-0-release-and-new-website"
}
sdasdasd
Looks like this:
Invalid YAML front-matter is rendered like this:
I've created a new issue based on my comment.
@pavloo : I'm not sure if you got the notification emails as it happened in a different issue. But I made a couple changes to the Front Matter behavior in PR #112:
ignorefrontmatter = [yaml]
can be achieved like this: frontmatter.renderer=none
and the rendering for all enabled formats is the same.frontmatter.formats=yaml,toml
. By default only YAML is enabled.@maxkueng Sorry was on vacation. Looks nice. Thanks!
Currently
vmd
tries to parse front-matter as it's a valid markdown. This PR adds a feature of ignoring front-matter. By default it's configured to ignore yaml front-matter, but there is an option to set the list of ignored formats.