Page MenuHomePhabricator

[[Link|Title] breaks link syntax highlighting
Open, Needs TriagePublic

Description

Steps to reproduce

  1. Enable Wikitext syntax highlighting
  2. Open Wikipedia:Sandbox
  3. Edit it as source
  4. Type
{| class="wikitable" 
! Row 1
! Row 2
|-
| [[WP:NPOV|neutral points]
| [[WP:NOTAFORUM|not a forum]]
|}

Actual results

Screenshot from 2018-01-17 11-14-00.png (342×140 px, 8 KB)

Expected results

  • The wikitext [[WP:NPOV|neutral points] should be highlighted as an (incomplete) internal link
  • The wikitext [[WP:NOTAFORUM|not a forum]] should be highlighted as an internal link
  • The wikitext | [[WP:NOTAFORUM|not a forum]] should be highlighted as a table cell

Screenshot

Screenshot from 2018-01-17 11-14-10.png (403×78 px, 5 KB)

Event Timeline

Kaartic renamed this task from Incorrect syntax highlighting for: //Text// to Incorrect syntax highlighting for: [[link|title].Jan 17 2018, 5:48 AM
Kaartic updated the task description. (Show Details)
BEANS-X2 renamed this task from Incorrect syntax highlighting for: [[link|title] to [[Link|Title] breaks link syntax highlighting.May 11 2020, 9:16 AM

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

[mediawiki/extensions/CodeMirror@master] CodeMirrorModeMediaWiki: broken link

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

There are several aspects in this example based on my understanding of the PHP parser and the CodeMirror stream parser.

  1. It is natural to assume [[WP:NPOV|neutral points] is a link before the editor closes the bracket, so the corresponding highlighting is appropriate.
  2. The parser parses the table syntax before links, which seems very difficult to represent in a CodeMirror stream parser.
  3. Double brackets ([[) can never appear within a link except for a file link, and this will be fixed in my patch.

Change #1156259 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirrorModeMediaWiki: broken link

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