- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 25 Jun 2015 10:37:50 -0700
- 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