Jump to content

Extension:SyntaxHighlight/Updating pygments

From mediawiki.org
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

To update the version of Pygments, follow the following instructions.

On Wikimedia sites

Since T320848, Pygments is installed in the Blubber generated container image by directly fetching a built wheel from PyPi. The version of Pygments installed is managed in the syntaxhighlight/requirements.txt file. This file should pin to a specific version matching the version embedded in the extension and use a sha256 hash to verify the downloaded wheel. See https://pip.pypa.io/en/stable/topics/secure-installs/ for more information on hash-checking.

Rebuild the Shellbox container and update the image version for the shellbox-syntaxhighlight deployment. And then deploy it. It'll take roughly an hour for Special:Version to update, triggering cache invalidation of all highlighted content.

The resulting container image expects callers to use $wgPygmentizePath = '/srv/app/pygmentize'; to specify the location of the pygmentize script.

Bundled copy

In a checkout of the SyntaxHighlight git repo, run the createPygmentizeBundle.php maintenance script and commit the result.

If you are working with MediaWiki-Docker, this might look something like:

$ docker compose up -d
$ docker compose exec mediawiki php maintenance/run.php ./extensions/SyntaxHighlight_GeSHi/maintenance/createPygmentizeBundle.php

Note: for the bundle update to work as expected in MediaWiki-Docker, you will either need to run a custom MediaWiki image that includes Python3 support or create and run a locally updated Shellbox container first. If SyntaxHighlight.lexers.php is not changed when you run createPygmentizeBundle.php you should double check that you are not using a stale Shellbox container.