Open redactedscribe opened 9 months ago
Other observations:
:
) to HHH
key causes the YAML to lint, but it merges FFF
together at the root level (and also erroneously the III
key too).HHH
and then removing the leading -
from both GGG
and HHH
causes FFF
keys to merge and GGG
and HHH
to be deleted (with III
also merged).Technically, the above doesn't happen with the example code in the first comment, but it's what I'm seeing happen with my real-world example because my FFF
so-to-speak is earlier in the alphabet than the AAA
. The reason seems to be because of the YAML Sort Order for Other Keys setting being set to Ascending Alphabetical.
---
AAA:
- BBB: x
CCC: x
- DDD: x
EEE: x
A:
- GGG: x
- HHH:
III: x
A:
-
---
... linted turns into:
---
A:
- GGG: x
- HHH:
III: x
AAA:
- BBB: x
CCC: x
- DDD: x
EEE: x
---
This bug report is a bit of a mess, sorry. Hopefully you can make sense of it.
If this is an issue with the YAML after the Linter runs, I can do something about it. Jowever if this is from the parser, I cannot do anything about that at this time.
I believe the linter is the cause as I'm manually triggering linting using Ctrl+Alt+L.
It says there is bad indentation. Is the YAML line it is referring to the same as the initial value? If so, there may be nothing I can do. Generally bad identation means it was expecting more or less spaces than were provided.
The error provided seems to happen before YAML Key Sort happens. That would mean I likely cannot fix it via the Linter code since it is an external library that parses the YAML.
YAML Key Sort definitely needs work. It was a workaround to get it to work, but it cannot handle nesting due to its implementation. It would have to be rewritten to handle sorting nested values. However if it is pulling nested values out of their nesting level, that may ne addressable.
However if it is pulling nested values out of their nesting level, that may ne addressable.
That it is doing, and at times removing them without them even being merged.
I will need to double check what modified this. I am able to reproduce in Obsidian, but YAML Key Sort does not seem to affect this directly. Some other rule seems to be modifying it first which is causing the issue. I will have to see which rule is making that change and make the modification in that rule.
@pjkaufman Do you want me to work on this? cuz there's overlap with my sort frontmatter, i just dont test on mobile so i'll need some help on that front.
Hey @mariomui , that would be great. I can test mobile, so that should not be an issue.
My main concern would be avoiding breaking existing UTs and keeping the original formatting as much as possible, but the latter is more lenient.
Apologies if this issue has already been created. Not quite sure what to search for.
Describe the Bug
According to https://www.yamllint.com/, this is valid:
FFF
is present twice, but at different levels, and therefore should be unique, but obsidian-linter still complains with (even if line withGGG
has: x
removed):How to Reproduce
Steps to reproduce the behavior:
Expected Behavior
Support this YAML syntax.
Screenshots
Device
Thanks.