Page MenuHomePhabricator

API-powered linting for wikitext using Parsoid
Closed, ResolvedPublic

Description

This task is about the wikitext portion of T394965: Provide API-powered linting of supported languages in CodeMirror. See parent task for details applicable to all modes/languages we plan to support.

The /transform/wikitext/to/lint REST API endpoint will allow us to provide real-time linting from Parsoid (i.e. the same results as MediaWiki-extensions-Linter). This can be ran in parallel with the existing JS worker.

Perhaps we could also provide initial linting results from our PHP, so that they are shown immediately once CodeMirror initializes. The /transform/wikitext/to/lint/{title}/{revision} endpoint could be used for that (since the user is not necessarily editing the latest revision).

Event Timeline

Change #1191795 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] CodeMirrorMediaWiki: lint using the REST API

https://gerrit.wikimedia.org/r/1191795

MusikAnimal changed the task status from Open to In Progress.Oct 22 2025, 7:17 PM

Change #1191795 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirrorMediaWiki: lint using the REST API

https://gerrit.wikimedia.org/r/1191795

Currently there are some duplicate rules between WikiLint and Parsoid, such as unclosed-quotes-in-heading (Parsoid)/format-leakage#apostrophe (WikiLint), duplicate-ids (Parsoid)/no-duplicate#id (WikiLint), bogus-image-options (Parsoid)/no-duplicate#imageParameter (WikiLint), fostered (Parsoid)/fostered-content (WikiLint), wikilink-in-extlink (Parsoid)/nested-link (WikiLint), and obsolete-tag (Parsoid)/obsolete-tag (WikiLint). However, the marked text range can be different between the two linters, usually more precise from WikiLint. What should we do with these rules?

I think generally speaking Parsoid should take precedence, as it is the authority. In my testing it didn't seem too confusing to have both running side-by-side, especially after you added the "clickable lint tooltips", but I only tested so many things.

I think the next step is to add preferences for each linter. That will likely satisfy most user's concerns with respect to overlapping rules. I've filed T408729: Add preferences to select between available linters in CodeMirror for that.

Bhsd moved this task from Improvement to Done on the MediaWiki-extensions-CodeMirror board.