Line numbers
Highlight.js’ notable lack of line numbers support is not an oversight but afeature. Following is the explanation of this policy from the current projectmaintainer (hey guys!):
One of the defining design principles for highlight.js from the start wassimplicity. Not the simplicity of code (in fact, it’s quite complex) butthe simplicity of usage and of the actual look of highlighted snippets onHTML pages. Many highlighters, in my opinion, are overdoing it with suchthings as separate colors for every single type of lexemes, stripedbackgrounds, fancy buttons around code blocks and — yes — line numbers.The more fancy stuff resides around the code the more it distracts areader from understanding it.
This is why it’s not a straightforward decision: this new feature will notjust make highlight.js better, it might actually make it worse simply bymaking it look more bloated in blog posts around the Internet. This is whyI’m asking people to show that it’s worth it.
The only real use-case that ever was brought up in support of line numbersis referencing code from the descriptive text around it. On my own blog Iwas always solving this either with comments within the code itself or bybreaking the larger snippets into smaller ones and describing each smallpart separately. I’m not saying that my solution is better. But I don’tsee how line numbers are better either. And the only way to show that theyare better is to set up some usability research on the subject. I doubtanyone would bother to do it.
Then there’s maintenance. So far the core code of highlight.js ismaintained by only one person — yours truly. Inclusion of any new code inhighlight.js means that from that moment I will have to fix bugs in it,improve it further, make it work together with the rest of the code,defend its design. And I don’t want to do all this for the feature that Iconsider “evil” and probably will never use myself.
This position is subject to discuss.Also it doesn’t stop anyone from forking the code and maintaining line-numbers implementation separately.