mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-26 09:46:01 +03:00
[GH-ISSUE #1202] QUESTION: Is it possible to write custom linting rules, including Quick Fix information, for frontmatter? #2486
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#2486
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cdeyoung on GitHub (May 8, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1202
I know I can access frontmatter data using
params.frontMatterLines; however, theonErrorfunction seems to operate solely on theparams.linesarray. Is there any way to write custom linting rules to validate text in the frontmatter area of a document?@DavidAnson commented on GitHub (May 8, 2024):
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.
@cdeyoung commented on GitHub (May 8, 2024):
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!