Hacker News new | ask | show | jobs
by jake-low 2450 days ago
Huh, thanks for that, I never thought of the --- as being part of the YAML (as a document divider); I always thought of it as being part of the Markdown (as a horizontal rule).

I agree with you that it's cute to be able to parse YAML frontmatter by streaming the file to a YAML parser that's been instructed to stop after the first document... but it makes me all the more uneasy about frontmatter as a concept. Call me old fashioned, but I want my files to contain just one kind of syntax.

1 comments

Needing multiple parts for a document is one of the older needs on the net (MIME's first RFC was 1992, for instance; though MIME would presumably be a terrible format for static site generators). Frontmatter seems related to HTTP headers, its just interesting to have needs for similar metadata for a file "at rest" as opposed to in transit.

Though HTTP does have an "at rest" relative, the META tag in HTML. Similarly, reStructuredText has always had "Field Lists" and even a history of using the first field list in a file as "frontmatter" and the docutils API even returns it as a separate metadata stream if asked. (Sphinx, for instance, checks for some fields there.) It's maybe just Markdown here that's deficient in having a first-class metadata syntax of its own. (reStructuredText and docutils also have a first-class concept of a document title made available by API to tools but maybe not intended for direct output in rendered contents, which is the number 1 reason for YAML front-matter in most Markdown documents I've seen.)