Closed olearydj closed 1 year ago
I am not sure this is something that can be fixed directly as the YAML parser is an external package. It could be that the format provided is a newer format than is supported.
If this format is valid, which it seems to be, it would be an upstream issue rather than an issue created by the Linter.
I will have to see if this is operator error on my end or if the issue is actually a bug in the dependency.
Thanks for reporting this!
My pleasure. Let me know if you need anything more. I also shared the link of this report with the author of share as gist, as an FYI.
Oh, neat - that crosspost shows up in the chain above.
This doesn't seem to be a fundamental issue with the YAML parser, as it works for me in a REPL: https://replit.com/join/vhuytqxdzd-timrogers4
This doesn't seem to be a fundamental issue with the YAML parser, as it works for me in a REPL: https://replit.com/join/vhuytqxdzd-timrogers4
Looks like I cannot see the replit without an account.
Nothing too exciting in there - I just pasted the YAML into a string and then passed it to load
and it worked.
Interesting. I will have to see what is different about the YAML. @olearydj , did you provide your entire YAML block for the file?
It could be caused by another YAML key value pair.
Yes. The YAML in my bug report is the entire block.
Ok. I see the problem. The issue is the format make it act as though the value is a YAML array which triggers the escaping of the the id which is what cause the remaining problem. Let me see what I can do about that.
I am not sure how to proceed with fixing this issue. The logic is correctly identifying the value as an array. However, it has no concept of what an array with an object inside of it is. The problem is being able to distinguish them since it is not using a parser to do so since that would cause a an error if there was a need to escape a value.
For now, I would recommend disabling the escape yaml characters rule for any files that have this issue while I try to think of a good way to actually avoid this issue as the Linter is not designed to work on more advanced YAML data nesting when it comes to escaping characters.
Ok, thank you for looking into it and for suggesting this workaround.
I am working on a fix for this, but we will see how well it does. It essentially will try to account for dictionaries inside of multiline arrays by checking if the next line has a value that has the same amount of spaces preceding its value as the line with the dash (this is because escape comparisons are done one line at a time rather than accounting for all formats and parsing them and then trying to account for the difference). The main potential problem is using inconsistent spacing which could cause an issue. But I guess that is the price to pay to try to escape these characters.
I should have a fix for this coming up. It should also account for this in Format YAML arrays as well.
This should be fixed on master and in the next release. If it is not, please let us know. Thanks for helping make the Linter more robust.
Describe the Bug
The YAML generated by the "share as a gist" plugin (https://github.com/timrogers/obsidian-share-as-gist) is flagged as invalid by Linter. I'm no YAML expert, but it seems ok to me?
How to Reproduce
Install the plugin, create the github key, share an obsidian page as a gist. YAML header is automatically generated to hold the resulting metadata.
When Linting the file with the above YAML, the following error message is put to the console:
Expected Behavior
Should not flag as bad YAML?
Screenshots
Device
Additional Context
If it is a problem with the gist plugin please share details so I can communicate that back to him.