Failing test with nasty HRs#56
Failing test with nasty HRs#56Soreine wants to merge 1 commit intojxson:masterfrom Soreine:failing-test-with-hrs
Conversation
|
Even if this PR is not merged in the end, any advice that could improve my understanding of YAML frontmatters would be greatly appreciated |
|
Sorry for the delayed response, I have been really short on spare time. I'll have to dig into this some as I would like to avoid having a broken test be in the source, i.e. I want to fix the bug ;) It might be possible to check the value in front-matter where the YAML is parsed, e.g. check the type around line 41 in index.js. If the value being returned from the parse call is the wrong type it can be worked around but ideally there should be fix upstream to the js-yaml library. |
Yes of course, the goal is to merge the test and a fix that goes with it :p
I said I would expect attributes to always be an object, not a string. But the YAML specs seems to be a superset of JSON, and I think just a string is valid JSON. So maybe it's not Also, I said that I did not know a frontmatter could be elsewhere than the start of a document. But actually the YAML spec says that there can be as many |
Hello, I'm opening this PR with a failing test, that yields the following result:
for the following string:
Here is what seems to be wrong about it:
attributesto always be a JSON, not a string.I don't know if this is an issue with the regex of
front-matterto detect where a frontmatter is in the text, or if it is an issue withjs-yamlfor returning something that is not a JSON. Any help is appreciated.