We've been working hard to update the Mathematica portion of highlight.js, and it was merged into the main repository some time ago. It fixes all kinds of issues with the old version, e.g. it supports the whole range of Mathematica's crazy way to input numbers:

enter image description here

If you look at the implementation, you'll find that we use detailed CSS classes that will default to standard classes. However, it gives the opportunity to adapt the colours specifically for Mathematica in greater detail.

Here is a list of all exposed CSS classes and how they should be coloured:

  • symbol, named-character, operator, brace: Normal variables and code that should just be coloured black like it is now.
  • builtin-symbol: The keywords of the language. The blue that's used right now is fine
  • number: Numbers that should have a dark reddish colour. Probably
  • string, message-name: Should probably have the same colour as numbers. Definitely not green please, because that's what we need for...
  • pattern, slot: special pattern-like expressions that are coloured green in Mathematica and users expect them to be green with the highlighter
  • comment: The grey that's used right now is fine

Question: Can we get an update of the Mathematica highlighter for our site?

  • 1
    Is there any reason not to add the feature-request tag?
    – b3m2a1
    Dec 22, 2020 at 7:04
  • @b3m2a1 The only reason was to give everyone the chance to look at what I've written and possibly add/change details before we ping SE staff.
    – halirutan Mod
    Dec 23, 2020 at 13:47


You must log in to answer this question.

Browse other questions tagged .