You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library uses YAML ruby standard library, which uses psych under the hood, to load the front matter. I don't think we should move away from the standard solution.
Also, this library calls YAML.safe_load instead of YAML.load. The bug only affects to the former, but I don't want to change and use load because it is dangerous for user provided content.
As long as the bug is not solved, you could do as @icco says or implement your own loader. For example, if you are parsing from a well known source and you don't need to protect against user content, you could safely use load instead of safe_load:
unsafe_loader=->(string){YAML.load(string)}# And then...# For a fileFrontMatterParser::Parser.parse_file('example.md',loader: unsafe_loader)# For a stringFrontMatterParser::Parser.new(:md,loader: unsafe_loader).call(string)
I have frontmatter like this:
This fails with:
I'm pretty sure the root cause is ruby/psych#262 and that the parser is attempting to run
Date.new('2012-01-11')
, but I haven't nailed it down yet.I might be able to write a customer parser to overwrite how the frontmatter is being parsed, I guess?
Was wondering if there was a different solution or if anyone had any insight?
The text was updated successfully, but these errors were encountered: