markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

QUESTION: Is it possible to write custom linting rules, including Quick Fix information, for frontmatter?

Open cdeyoung opened this issue 1 year ago • 2 comments

I know I can access frontmatter data using params.frontMatterLines; however, the onError function seems to operate solely on the params.lines array. Is there any way to write custom linting rules to validate text in the frontmatter area of a document?

cdeyoung avatar May 08 '24 09:05 cdeyoung

Not directly. Front matter is so varied that I have not thought to support something like this.

But if you want to lint front matter, I suppose you could report errors for line 1 of the Markdown. It would be slightly wrong, but maybe good enough for your purposes.

DavidAnson avatar May 08 '24 15:05 DavidAnson

Your decisions makes sense. I think everything is great in markdownlint as it is. The one thing that would make it perfect would be the ability to tell onError which array to operate on so people could write custom linters for their frontmatter, too, since it is only the reporting that doesn't currently work.

I'll try doing what you suggested with line one of the params.lines array.

Thanks for your response!

cdeyoung avatar May 08 '24 16:05 cdeyoung