simbo / gulp-gray-matter

A gulp plugin for extracting data header from file contents using gray-matter.
MIT License
3 stars 3 forks source link

Throw on invalid YAML #1

Open strugee opened 7 years ago

strugee commented 7 years ago

I have the following YAML frontmatter in a file:

title: "Hello, World!"
time:
    - epoch: 1487490654
    - utcoffset: "UTC-0"
author: "Alex Jordan"
categories:
    - example

Putting this YAML into a YAML validator returns "Error : A YAML file cannot contain tabs as indentation." It feels like gulp-gray-matter should probably throw in this situation instead of silently not adding the data in the frontmatter to the Vinyl file.

strugee commented 7 years ago

Nope, I was being dumb and forgot the ---s, so it wasn't being parsed at all. Sorry for the noise.

strugee commented 7 years ago

So that particular case was my fault, but this seems to be an issue that really does exist:

---
title: "Gender representation at RC"
time:
  epoch: 1487109679
  utcoffset: "UTC-5"
edited:
  epoch: 1487783122
  utcoffset "UTC-5"
edited:
  epoch: 1487783122
  utcoffset "UTC-5"
author: "Alex Jordan"
categories:
  - personal
  - blaggregator
---

is invalid YAML (notice utcoffset "UTC-5" is missing a :), but I don't get an error.