jxson / front-matter

Extract YAML front matter from strings
MIT License
674 stars 76 forks source link

Reserved characters/list requiring quoting? #89

Open dwertheimer opened 1 year ago

dwertheimer commented 1 year ago

We have run into some edges with the parsing:

But It makes me wonder what other edge cases there are that require quoting and we're just not aware of yet. Is there a definitive list somewhere or can you point me to where in the code I can look to try to create the list?

jxson commented 1 year ago

Thanks for the issue David.

I suspect that the issue you are having is really with the version of the yaml parser.

I'd like to just remove the parsing from this module then leave it up to the consuming client to do whatever they want with the separated front-matter. I haven't had much time to work on this though...

On Fri, Jan 13, 2023 at 11:59 AM David Wertheimer @.***> wrote:

We have run into some edges with the parsing:

  • colons in values, including colon at the end of the line. YAML says that colons should be legal in values, but not if they have ": " colon space. I guess ":" at the end of the line is failing because of an overly broad regex. But now that I know those case, I can trap for it.
  • a field value cannot start with a "#" but can exist elsewhere in the value Both of these edges are fine if you quote them, so I am pre-parsing the data before passing the data to the parser.

But It makes me wonder what other edge cases there are that require quoting and we're just not aware of yet. Is there a definitive list somewhere or can you point me to where in the code I can look to try to create the list?

— Reply to this email directly, view it on GitHub https://github.com/jxson/front-matter/issues/89, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACV4ISL7T5D6UZLIBZKZTWSGX3LANCNFSM6AAAAAAT2YP7GM . You are receiving this because you are subscribed to this thread.Message ID: @.***>