DavidAnson / markdownlint

A Node.js style checker and lint tool for Markdown/CommonMark files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

cdeyoung opened this issue · 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?

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.

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!