-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative frontmatter end / body start indicator #18
Comments
Thank you for this well explained proposal. Unfortunately the choice of JSON for the frontmatter is only temporary and in the future we'll switch to a custom format that won't be compatible with YAML. If you can give me an idea of the usecase / workflow that you had in mind (ie the reason why it would have been nice to use YAML tooling to generate the content file), I can then keep that in mind when designing the new system. This is not a promise that your use case will be fully supported by Zine in the future, but telling me about real world use cases never hurts :^) Thank you! |
I generate all of my Markdown (and previously reStructuredText) files that contains code and the results of this code using The So one thing I wanted to look into, is hooking that up I never understood why the R-docs and several other that have YAML frontmatter did not add the space + I don't want to push things, but you could tag the frontmatter. If it stays essentially (nested) key-value pairs you could have the current
or (done by hand no guarantee to be correct, not even sure if anything but structs or strings are allowed as value)
(note the Both could be parsed with a YAML parser, and updated (at least if I would have a .zon loader/dumper), and the current tools are easily apated to the these "separators". And yes, if you develop and maintain a YAML parser, everything looks like a YAML document stream >:-) |
I propose to change the end frontmatter end indictor from
---
to--- |
, or at least allow the presence of the|
. This proposal does not affect the initial---
in the.md
files.The rationale for this is that this little change makes the combination of the frontmatter and the markdown body into a valid multi-document YAML file that can be processed, and generated using any, standards conforming, YAML parser, without the need to explicitly split the header from body. The only restriction for this to work for most standard conforming parsers is that the body (i.e. the markdown) should not contain lines starting with
...
or---
followed by whitespace, but even this is not a requirement for all parsers (assuming you tell them up front how many documents are in the stream).For those not familiar with the YAML specification:
---
at the beginning of a line, followed by whitespace, is the end-of-directives marker in YAML. In the absence of directives (%YAML
,%TAG
) there is no need for a preceding document in a YAML document stream to be ended with an end-of-document directive (...
), and documents can just be seperated by the end-of-directives marker.--- |
consist of a single literal scalar. Such a "root-level" scalar, does not have to be indented and should be loaded keeping the linebreaks intact.If acceptable I can write a PR for this change.
The text was updated successfully, but these errors were encountered: