Highlight using Pygments rather than Geshi
GeSHi is unmaintained, lacks support for many popular modern languages, and
suffers from deep architectural flaws, chief among them the inconsistent
tokenization of different languages, each of which requires a custom
stylesheet.
Pygments is a well-maintained alternative. It is, by my count, the most popular
syntax highlighting library around. It is BSD-licensed, actively maintained,
and is widely used in PHP projects.
To keep this easy to review, this change does not include update for l10n
files, and it does not delete the geshi/ directory. I will do those in a
separate patch.
The chief change between this and the previous implementation is that errors
result in the code block not being highlighted, as opposed to not being printed
at all, having been replaced by an angry red error message. I think that is the
right user experience. If you go to StackOverflow or GitHub and try to mark up
your code block as being written in some language that their highlighter
doesn't know about, you don't get an error message -- the code simply doesn't
get highlighted.
Because we don't recursively load dependencies for extensions, to test this,
you will need to create a composer.local.json in $IP and add:
{
"extra": {
"merge-plugin": {
"include": [
"extensions/SyntaxHighlight_GeSHi/composer.json"
]
}
}
}
Then run `composer update`.
Bug: T85794
Change-Id: I07446ec9893fae3d1e394f435d3d95cf8be6bc33
2015-06-16 03:52:58 +00:00
|
|
|
{
|
2017-05-20 15:58:14 +00:00
|
|
|
"name": "mediawiki/syntax-highlight",
|
2015-10-23 22:33:06 +00:00
|
|
|
"description": "Syntax highlighting extension for MediaWiki",
|
|
|
|
"require-dev": {
|
2018-03-10 05:56:54 +00:00
|
|
|
"jakub-onderka/php-parallel-lint": "1.0.0",
|
2018-09-03 19:50:49 +00:00
|
|
|
"mediawiki/mediawiki-codesniffer": "22.0.0",
|
2017-11-04 02:49:51 +00:00
|
|
|
"jakub-onderka/php-console-highlighter": "0.3.2",
|
2018-02-18 09:46:21 +00:00
|
|
|
"mediawiki/minus-x": "0.3.1",
|
2018-06-08 07:49:40 +00:00
|
|
|
"mediawiki/mediawiki-phan-config": "0.3.0"
|
2015-10-23 22:33:06 +00:00
|
|
|
},
|
2018-03-02 23:40:34 +00:00
|
|
|
"license": "GPL-2.0-or-later",
|
2015-10-23 22:33:06 +00:00
|
|
|
"authors": [
|
|
|
|
{
|
|
|
|
"name": "Brion Vibber",
|
|
|
|
"email": "brion@wikimedia.org"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Niklas Laxström",
|
|
|
|
"email": "nlaxstrom@wikimedia.org"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Ori Livneh",
|
|
|
|
"email": "ori@wikimedia.org"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Rob Church"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Tim Starling",
|
|
|
|
"email": "tstarling@wikimedia.org"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"scripts": {
|
2017-11-04 02:49:51 +00:00
|
|
|
"fix": [
|
|
|
|
"phpcbf",
|
|
|
|
"minus-x fix ."
|
|
|
|
],
|
2015-10-23 22:33:06 +00:00
|
|
|
"test": [
|
2017-06-13 10:20:31 +00:00
|
|
|
"parallel-lint . --exclude vendor --exclude node_modules",
|
2017-11-04 02:49:51 +00:00
|
|
|
"phpcs -p -s",
|
|
|
|
"minus-x check ."
|
2015-10-23 22:33:06 +00:00
|
|
|
]
|
2018-02-16 21:44:31 +00:00
|
|
|
},
|
|
|
|
"extra": {
|
2018-09-08 06:06:54 +00:00
|
|
|
"phan-taint-check-plugin": "1.5.0"
|
2015-10-23 22:33:06 +00:00
|
|
|
}
|
Highlight using Pygments rather than Geshi
GeSHi is unmaintained, lacks support for many popular modern languages, and
suffers from deep architectural flaws, chief among them the inconsistent
tokenization of different languages, each of which requires a custom
stylesheet.
Pygments is a well-maintained alternative. It is, by my count, the most popular
syntax highlighting library around. It is BSD-licensed, actively maintained,
and is widely used in PHP projects.
To keep this easy to review, this change does not include update for l10n
files, and it does not delete the geshi/ directory. I will do those in a
separate patch.
The chief change between this and the previous implementation is that errors
result in the code block not being highlighted, as opposed to not being printed
at all, having been replaced by an angry red error message. I think that is the
right user experience. If you go to StackOverflow or GitHub and try to mark up
your code block as being written in some language that their highlighter
doesn't know about, you don't get an error message -- the code simply doesn't
get highlighted.
Because we don't recursively load dependencies for extensions, to test this,
you will need to create a composer.local.json in $IP and add:
{
"extra": {
"merge-plugin": {
"include": [
"extensions/SyntaxHighlight_GeSHi/composer.json"
]
}
}
}
Then run `composer update`.
Bug: T85794
Change-Id: I07446ec9893fae3d1e394f435d3d95cf8be6bc33
2015-06-16 03:52:58 +00:00
|
|
|
}
|