obsidian-linter icon indicating copy to clipboard operation
obsidian-linter copied to clipboard

Add rule to make sure that there are YAML section markers in the files

Open cywtf opened this issue 1 year ago • 2 comments

Can you add a rule to make sure that there are YAML section markers in the files?

For example, missing opening dashes at the beginning of the file. Or missing closing dashes at the end of YAML metadata.

Describe the Solution You'd Like

This is an example of missing dashes at the the beginning of the file

key:value
---

This is an example of missing dashes at the the end of YAML metadata

---
key:value

cywtf avatar Sep 14 '23 11:09 cywtf

Hey @cywtf , this may be feasible. Is there a particular scenario you are running into?

I know that there was an issue reported where the Linter was not able to close the YAML it added when in preview mode (I will have to find the issue link later). Hopefully that gets resolved soon, but we will see.

pjkaufman avatar Sep 14 '23 11:09 pjkaufman

Sure. I had a bunch of files where I only used end dashes who knows why, and the YAML metadata wasn't being read properly. I didn't even realize that until I randomly stumbled upon some of them. Being able to fix those with a linter would be very helpful.

cywtf avatar Sep 15 '23 10:09 cywtf