5 ms·
Interesting read. This part caught my eye: "The +++s are like --- in Jekyll, and the metadata is in TOML instead of YAML" Why does it seem like every other d
by eternalny1 7y ago
Interesting read.
This part caught my eye:
"The +++s are like --- in Jekyll, and the metadata is in TOML instead of YAML"
Why does it seem like every other day a new mark-up comes around, with its own syntax, often (in this case) the exact opposite symbols. I mean, I guess "markup is hard" or something along those lines, but it doesn't appear to be to me.
- benatkin 7y agoThe TOML in the post is identical to the first config syntax I used, back in the early 90s. It's based on ini syntax.
- jake-low 7y agoFor what it's worth, TOML [0] has been around for a few years. It's intended for configuration data and borrows some ideas from INI files. The +++ thing is just Zola's way to have you tell it whether you put YAML or TOML inside the "front-matter" of the post. +++ and --- to denote front matter isn't a standardized thing, as far as I know; it's just a convention that a lot of static site generators seem to follow. +++ in particular for TOML might have come from Hugo (that's at least the first place I encountered it). [0]: https://github.com/toml-lang/toml https://github.com/toml-lang/toml
- Keats 7y agoIt did come from Hugo.
- WorldMaker 7y agoThe "cute" thing about using --- is that it's a part of the YAML spec as a document divider [1] and some of the cheaper front-matter readers were just YAML spec-compliant libraries told to read only the first document in the file. It's almost weirdly disappointing that +++ doesn't have any real specificity to TOML itself. [1] --- is the explicit document start marker. Most frontmatter should probably be more accurately using ... which is the actual explicit document end marker and doesn't imply another YAML document follows, but the symmetry of using --- on both sides is cleaner.
- jake-low 7y agoHuh, 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.
- WorldMaker 7y agoNeeding 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.)
- reificator 7y agoI'm not arguing in favor of churn, but in fairness TOML is at its core a cleaned-up/standardized INI file. Not exactly the new kid on the block.