jlord / balrog

Learn by making presents: A Static Site Generator (WIP)
Other
86 stars 14 forks source link

Plugable metadata parsers #11

Open brianloveswords opened 10 years ago

brianloveswords commented 10 years ago

So the original metadata parser works by convention: it expects the headers to represent title, author, date and tags in that specific order. This is super lightweight (implementation is only ~10 lines!) and awesome if your posts always conform to that.

However, for some of my stuff I wanted some finer control over what kinda metadata I can put into the doc. To that end, I wrote balrog-meta-htmlcomment to be able to declare metadata upfront in an HTML comment. This still allows the markdown files to be displayed directly (which would have been the issue with YAML frontmatter) but gives some better control.

We need to figure out a good way to declare which style of metadata parser to use. I'm thinking a couple of things:

  1. We could put something into config.json, like metadata: ('htmlcomment' | 'default')' or something like that.
  2. A new command on the balrog binary, balrog use meta-htmlcomment. This would also install the package if necessary.

I should also pull out/modularize the default parser.

jlord commented 10 years ago

Cool! I like number one, but also defer to your judgement!

We should get rid of the old index.js and meta.js in the root, right?

brianloveswords commented 10 years ago

Yep! We can get rid of those. After thinking about it, I also believe number one is the best path.