GlimpseArchive / Glimpse.Client.Prototype

Glimpse v2 Client prototype
MIT License
9 stars 3 forks source link

Remove unnecessary registration of highlight.js languages #95

Closed philliphoff closed 8 years ago

philliphoff commented 8 years ago

In src/lib/modules/glimpse-highlight.js we register with highlight.js a number of languages used by the Client UI. This doesn't seem to be necessary (at least for JavaScript) and we should consider removing this if that's the case.

philliphoff commented 8 years ago

Looking more closely, it seems that we're using Webpack to highjack require('highlight.js'), redirecting it from the normal index.js which would register all of the supported languages and toward our own substitute glimpse-highlight.js which registers only a small subset (I would guess for performance reasons). Interestingly, at least in the case of JavaScript, highlighting seems to work whether registered or not. If the declared language is not registered, highlight.js uses "auto detection" to weigh how closely the text matches each registered language as well as a fall back, which generically highlights just enough of JavaScript/JSON to look correct.

Given that, it seems that the correct thing to do is currently being done--that is, to register the JavaScript language (as well as the others).