W3C home > Mailing lists > Public > spec-prod@w3.org > April to June 2015

[bikeshed] Now using Pygments, requires package install

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 25 Jun 2015 10:37:50 -0700
Message-ID: <CAAWBYDBMmHKegr9wzgnhUqrJE+4tevE33D-PJ7zaTQX+nWNMhg@mail.gmail.com>
To: "spec-prod@w3.org Prod" <spec-prod@w3.org>
I just switched Bikeshed's syntax-highlighting from Prism.js to
Pygments, a Python library.

Pros:

* Syntax highlighting is now done on the server and baked into the
document, rather than being applied on-the-fly by JS.
* Pygments supports *way* more languages than Prism.js (through Prism
does support a two or three languages that Pygments doesn't,
interestingly).
* Using the "html" highlighter, <style> and <script> elements are now
automatically highlighted as CSS and JS.

Cons:

* The highlighting is now *slightly different*, because Prism and
Pygments categorize tokens a little differently.  The difference is
small and not noticeable unless you're paying close attention.
* Pygments is a separate package that needs to be installed. (Bikeshed
will complain at you if you don't have it, and tell you how to get
it.)

I copied Prism's color scheme, because it was attractive and changing
the colors would be jarring.  Ideally, you shouldn't notice the change
at all, beyond the package install.

Note that you can continue to invoke syntax highlighting in the
standard old way (class="lang-css" or the like), with any of the
Pygments languages, or you can add a "highlight" attribute to the
element with a value of the Pygments language you want.

~TJ
Received on Thursday, 25 June 2015 17:38:36 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 25 June 2015 17:38:37 UTC