Topic on Extension talk:Linter

Suggestion: Add a basic html validator to the extension

Summary by Elitre (WMF) (talkcontribs)


It can be quite hard to find these errors in pages full of markup and deeply nested templates.

Proposed solution (some ideas)

Add special page that does basic html validation, e.g.:


Add a basic html beautifier to the page, e.g.

Special:Expandtemplates works, but it is very hard to discern the exact problem without a linter or a beautifier. (talkcontribs)

See for an example. It would have extremely hard to find the exact error if those tools weren't used. The linter was complaining about "<span>" when in reality it was being caused by the abuse of definition lists (<dd>) for indenting. That in turn resulted in unbalanced tags which caused the error.

Elitre (WMF) (talkcontribs)
SSastry (WMF) (talkcontribs)

Linter is based on Parsoid which uses a HTML5 parser. So, we extract information based on that parse which fixes up all the broken HTML. The linting is part of the regular parsing pipeline and we cannot do additional expensive HTML validation in addition. Unsure of the benefits of a validator on top of the mediawiki output (since it has already gone through Tidy which would have fixed everything).

But, I suppose one option is to look at adding html validation to output of Special:ExpandTemplates ... that is a mixed bag since it might flag a lot of noise as well. So, I am a bit unsure about this just yet. But, the general suggestion of making LInter output more easily actionable is something we will continue to work on.

That said, suggestion to add a HTML5 validator to output of Special:Expandtemplates is worth a phab task. (talkcontribs)

It is true for the most part that this is not an easy fit. Although some editors do add the good old html table using html markup to templates (most infoboxes consist of these), so something like the table check tool would certainly detect errors from those, and it fits quite nicely with the fostered table lint type.

The linter could show the full html table, with highlighted errors which wouldn't be a problem as some experienced wikitext editors are familiar with those anyway.