Prettify has a bunch of more languages plugins available than Stack Overflow uses, among them one for XQuery.

I guess that Stack Exchange wants to keep the JavaScript size low and thus leaves out some rarely used languages. While seems to be a less important tag (only something around 1k questions with that tag), it is also able to highlight correctly (which is a subset of XQuery) that has much more impact. Together their use is comparable to the one of , which is included.

And both XQuery and XPath highlightings are very, very broken at the moment – they use lots of // tokens in regular code statements, so we've got lots of false comments in there. For example:

for $node in //*[attribute()]
return local-name($node)

There are lots of <!-- language: lang-none --> blocks in lots of posts, and barely all others should be edited to include it as the wrong highlighting really hurts your eyes.

  • Hmm, that's still 22kb compressed, that's a lot of extra JS to be sending to the vast majority of users who won't benefit...you're right in assuming that's what we weigh when including these language plugins. Feb 15, 2014 at 14:34
  • This is mainly for all the function in Marklogic's namespaces that also got included. This regular expression will strip it down to a third of it's size, only leaving standard: ((xinc|xhtml|xdmp|trgr|xp|sec|spell|thsr|search|prof|ppt|pki|cts|alert|kml|pdf|p|msword|mcgm|ooxml|mamamamamamamalnk|lnk|gml|geo|georss|feed|dom|dls|dbg|cvt|css|cpf):[-\w]+\|). I guess one could improve even further by optimizing the regular expression (or making it a little bit more fuzzy and match everything as a function that looks like one).
    – Jens Erat
    Feb 15, 2014 at 14:52


You must log in to answer this question.

Browse other questions tagged .