Any linter for Hugo .md files?

Markdownlint is not smart enough: it sometimes produces false positives as it doesn’t understand Hugo templates. Is there something what understands Hugo specific markdown files and warns users about mistakes done not just in Markdown syntax, but in templates too?

Describe your issue more. Markdownlint is perfect for Hugo content files. You might have it configured falsely. Markdownlint should go over your content directory, not the layouts or themes directory, so you might have it configured wrong regarding what files to lint. Or… you might have template syntax in your markdown files, which is as wrong as the other one :slight_smile:

Markdownlint will flag a few things, for example it will flag “no-inline-html” if it is in a highlight shortcode. You can get it to ignore certain things, not set it up yet.

Here is my configuration. My complaint is that without such config markdown lint will complain about 35 line (in another branch): MD025/single-title/single-h1: Multiple top-level headings in the same document. It doesn’t recognize (and not intended to) that code is shortcode with a content inside it.

I wanna smth like markdown linter, but which understands Hugo syntax. BTW, I expect it (such linter) to warn about wrong shortcode arguments too. I don’t wanna always keep docs open to know what parameters are required for shortcodes and what are not. I want my editor to suggest them. Is Hugo team planning to implement smth like this or not?

Your config file looks different than the one I am using. Not sure why. We are talking about this markdownlint right?

My config for markdown-lint is here.

I wanna smth like markdown linter, but which understands Hugo syntax.

Wouldn’t that be nice? But that basically means you expect that MARKDOWN linter to understand Go, the structure of your layout directory, how shortcodes work. It must be able to understand how modules work, in case the layout file is somewhere completely else (what if you use a different layout directory?).

And that’s basically impossible.

A possible solution might be a linter that can be scripted to either filter out everything between $DELIMITER1 and $DELIMITER2 or is able to lint the stuff inside individually without knowing it’s meaning in the surrounding markup.

There is no linter I know of that can do that.

Sure. :slight_smile: