Page MenuHomePhabricator

Implement syntax highlight for U+00A0 (no-break space, nbsp)
Open, Needs TriagePublic

Description

CodeMirror already makes a syntax highlight for U+00AD (soft hyphen). A soft hyphen in the wikitext is shown as red bullet.

It would be nice to have a syntax highlight for U+00A0 (no-break space, nbsp), too. A suggested visualization is a gray background color for the space character. This visualization is also used in LibreOffice Writer.

Event Timeline

Fomafix created this task.Nov 29 2017, 8:34 PM
Restricted Application added a project: Community-Tech. · View Herald TranscriptNov 29 2017, 8:34 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 394385 had a related patch set uploaded (by Fomafix; owner: Fomafix):
[mediawiki/extensions/CodeMirror@master] [WIP] Add syntax highlight for special characters

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

Fomafix renamed this task from Implement syntax highlight for U+00A0 (no-break space, non-breaking space, nbsp) to Implement syntax highlight for U+00A0 (no-break space, nbsp).Dec 2 2017, 12:22 PM
Fomafix claimed this task.
Fomafix updated the task description. (Show Details)
Arbnos added a subscriber: Arbnos.Feb 22 2018, 2:58 PM
TBolliger added a subscriber: TBolliger.

Potential alternate fix: add a CSS class and let users individually set their personal CSS to highlight it

The highlight of special characters should enabled and disabled by a ¶ button.

Vort added a subscriber: Vort.Jun 12 2018, 11:07 AM
cscott added a subscriber: cscott.Jul 13 2018, 10:02 PM

This seems reasonable: most pages shouldn't have invisible non-breaking spaces anyway, so making them visible shouldn't disturb editors.

I played with cm-show-invisibles and it was very easy to integrate.

However, like in most editors, showing all invisibles is also very annoying when you actually want to read what you are editing. So either we need to only show very specific invisble characters other than, space and enter, or we need a toolbar button to toggle showing them (like we have in CodeEditor).