hastyscribe icon indicating copy to clipboard operation
hastyscribe copied to clipboard

Add function for parsing YAML Front Matter metadata

Open tomidery opened this issue 3 years ago • 2 comments

This function is a simple parser for YAML metadata. It removes the YAML section from the beginning of the file so it can be processed by Discount later. The metadata is returned in the provided StringTable. The function is not used in HastyScribe (I wasn't sure you wanted it), I use it from my version of LiteStore. There all retrieved metadata is added as fields to be used inside the page.

tomidery avatar Apr 06 '21 14:04 tomidery

Well... if I understand correctly it would be an alternative to the PanDoc-style metadata understood by Discount, right? Cannot have both...

Now, personally I would probably like this pseudo-YAML frontmatter more than the PanDoc headers, but I wouldn't want to change this. And additionally it's more suited for markdown fragments. I am doing exactly the same thing for HastySite, as well, and hence code that is similar to yours is part of the HastySite repository.

Wouldn't you be able to use this functionality outside of HastyScribe? Or are you proposing this because otherwise you'd have to do the same in (currently your version of) LiteStore?

h3rald avatar Apr 07 '21 05:04 h3rald

Fabio, See the answers below .

Piotr

On Wed, 7 Apr 2021, 07:57 Fabio Cevasco, @.***> wrote:

Well... if I understand correctly it would be an alternative to the PanDoc-style metadata understood by Discount, right? Cannot have both...

Yes, that was my thinking. Try one or the other. This is actually what happens in the renderer.nim code.

Now, personally I would probably like this pseudo-YAML frontmatter more than the PanDoc headers, but I wouldn't want to change this. And additionally it's more suited for markdown fragments. I am doing exactly the same thing for HastySite, as well, and hence code that is similar to yours is part of the HastySite repository.

I think YAML gives more power and flexibility. I want to render math equations using MathJax but if the page is small and has no math at all why would I load large js file? I may use YAML to define a flag like: `math: true' and then enable processing equations.

Wouldn't you be able to use this functionality outside of HastyScribe? Or are you proposing this because otherwise you'd have to do the same in (currently your version of) LiteStore?

Initially it was part of the renderer but I thought that you might want to use it in HastyScribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/h3rald/hastyscribe/pull/81#issuecomment-814624569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK42NENJUNYMPD3R5XN4QETTHPX3DANCNFSM42O36ZTQ .

tomidery avatar Apr 07 '21 06:04 tomidery