Topic on Extension talk:SyntaxHighlight

Issue in parsing -L lexer output on Windows

2
Check to the King (talkcontribs)

I was experiencing an issue on Windows where the lexer list was being incorrectly parsed, identifying language names with a colon at the end, i.e. as 'sql:', 'c++:', etc. My setup was as follows:

Product Version
MediaWiki 1.39.3
PHP 8.0.7 (apache2handler)
MySQL 8.0.25
ICU 68.2
Pygments 2.15.1

Using the latest Python 3.11 for Windows.

I managed to fix this on my machine by making one modification to includes\Pygmentize.php (add '\r' to trim character list for fetchLexers function, on line 214):

Can we please incorporate this into the production code?

Keyacom (talkcontribs)

There is no need because this has been implemented for SyntaxHighlight for a future MediaWiki version.

Optionally, one can use the python -m pygments -L lexer --json command, which outputs the lexer list formatted as JSON. This feature has been added in Pygments 2.11.0.

Reply to "Issue in parsing -L lexer output on Windows"