gvvaughan / lyaml

LibYAML binding for Lua.
gvvaughan.github.io/lyaml
Other
209 stars 34 forks source link

does lyaml provide a means to get yaml frontmatter from markdown file? #49

Closed ahillio closed 2 years ago

ahillio commented 2 years ago

Am I suppose to parse my markdown files for yaml frontmatter first and then supply that to lyaml or does lyaml itself have a means for extracting the frontmatter from markdown files?

gvvaughan commented 2 years ago

lyaml is a wrapper for libYAML, and I'm afraid neither understand any other file formats such as markdown, json, toml or anything else.

It's trivial to extract the frontmatter if your file starts with ---\n and encodes frontmatter up to the first ...\n or next ---\n, but you'll need to figure out whether that frontmatter data is encoded as yaml (lyaml will decode that for you, including the boundary lines if you'd like) or as json, toml, graphql or some other format (lyaml will not be able to decode those for you).

ahillio commented 2 years ago

awesome, thanks!