You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YAML front matter has become a common design pattern for static site generation tools. An example of which looks like:
---
title: Some Titledate: 2016-11-02
---
# Some SubtitleThis is a *blog* post ...And it goes on ...
Notice that this isn't a valid YAML stream, but it is very close. The problem is two fold. First the block scalar string, holding the text of the post and written in Markdown, is not indented. Secondly the string will be folded so the blank line in the post text will be lost, even though it is significant to the Markdown.
I tend to think its a good idea to follow usage to see how a spec might adapt, and here we have a very good case where YAML might be able to do that. Would it be possible for the next generation of YAML to see the above as a valid stream?
I've suggested that plain scalars be treated as literals before. I still think that is a better approach, b/c an application can always remove lines, but it can't get them back if they've already been stripped out.
Allowing block strings flush to left without indention is a little tricker. Maybe it is not possible to do for all nodes, e.g. block sequence
-
this
-
that
But if the content of a document is just one big string, then it seems that at least should be doable.
The text was updated successfully, but these errors were encountered:
Supporting a Front Matter doc as valid YAML is very interesting. We build Statamic, a flat file CMS (not static site generator) that uses this format. Usually it's in a .md file, so we pre-process them by extracting everything between the first two --- delineators and parse as YAML, leaving the rest of the doc as Markdown.
The biggest downside to this is we lose the ability to have multiple docs in a stream. We could open up some interesting options if there was native support.
YAML front matter has become a common design pattern for static site generation tools. An example of which looks like:
Notice that this isn't a valid YAML stream, but it is very close. The problem is two fold. First the block scalar string, holding the text of the post and written in Markdown, is not indented. Secondly the string will be folded so the blank line in the post text will be lost, even though it is significant to the Markdown.
I tend to think its a good idea to follow usage to see how a spec might adapt, and here we have a very good case where YAML might be able to do that. Would it be possible for the next generation of YAML to see the above as a valid stream?
I've suggested that plain scalars be treated as literals before. I still think that is a better approach, b/c an application can always remove lines, but it can't get them back if they've already been stripped out.
Allowing block strings flush to left without indention is a little tricker. Maybe it is not possible to do for all nodes, e.g. block sequence
But if the content of a document is just one big string, then it seems that at least should be doable.
The text was updated successfully, but these errors were encountered: