Live data from Hacker News

Highlight.js – Syntax highlighting for the Web

highlightjs.org

21–30 of 72 posts

Re: Highlight.js – Syntax highlighting for the Web

#21
Used this in a project[0] a little while ago and found it really easy to work with. The syntax detection was an added bonus that I had expected to need another library for.

http://cmdv.io

edit: I should mention that this might be a cool example for someone looking to use hljs in React/Flux-- I tried to make it fairly clean. There's a github link on the bottom-left of the website.

Re: Highlight.js – Syntax highlighting for the Web

#22

We use highlight.js at Resonant Core for our blog posts. After reading the comments here, I'm considering forking it to support line numbers :)

It would be really helpful when presenting at Events.

A lot of events record the presenters screen and the presenter but expect the presenter to stand in one spot so they don't need a cameraman.

So, it does not work very well to point at a screen when presenting.

Re: Highlight.js – Syntax highlighting for the Web

#24
post #10

It should be mentioned that this does not support and will indeed never support line numbers due to some strange opinions of the lead developer: http://highlightjs.readthedocs.org/en/latest/line-numbers.ht...

Is line numbers considered "highlighting"? I mean, I get why you would want it but I never would have thought to ask for it.

It does seem more appropriate to have a separate module for line numbers. I would definitely understand the separation of concerns argument, but the maintainer instead makes some sort of emotional appeal about clutter and simplicity to explain why there is no line number support.

Re: Highlight.js – Syntax highlighting for the Web

#25
post #10

It should be mentioned that this does not support and will indeed never support line numbers due to some strange opinions of the lead developer: http://highlightjs.readthedocs.org/en/latest/line-numbers.ht...

http://prismjs.com/ is an alternative that supports line numbers.

Re: Highlight.js – Syntax highlighting for the Web

#26

We use highlight.js at Resonant Core for our blog posts. After reading the comments here, I'm considering forking it to support line numbers :)

It would be really helpful when presenting at Events. A lot of events record the presenters screen and the presenter but expect the presenter to stand in one spot so they don't need a cameraman. So, it does not work very well to point at a screen when presenting.

It should be a trivial patch. I'll see about getting it done tonight.

Re: Highlight.js – Syntax highlighting for the Web

#27
At one point I got really into the idea of ASTs for languages. I've used pygments, the python syntax highlighter, with the intention of parsing the meaning of code.

These syntax highlighters are great but I think that underlie the lack of a defined and accessible AST parse definition for most languages. Highlight.js and others kind of just rely regexes-- https://github.com/isagalaev/highlight.js/blob/master/src/la...

It'd be great if we could parse through programming languages to get their meaning. I want to get tuples back!

``` a = 23 ``` would give

(variable(name=a), assignedTo, number(23))

This does exist for some languages, but mostly compiled ones. But it would make the syntax highlighting even more robust! Antlr is the best one around at the moment. http://www.antlr.org/

Re: Highlight.js – Syntax highlighting for the Web

#29
post #10

It should be mentioned that this does not support and will indeed never support line numbers due to some strange opinions of the lead developer: http://highlightjs.readthedocs.org/en/latest/line-numbers.ht...

Of course, YMMV

http://uu.zoy.fr/p/T4RwhQ#x=2zHnAK7/HQAxDmEA

Re: Highlight.js – Syntax highlighting for the Web

#30
post #10

It should be mentioned that this does not support and will indeed never support line numbers due to some strange opinions of the lead developer: http://highlightjs.readthedocs.org/en/latest/line-numbers.ht...

I understand the author's point-of-view on this, but disabling line numbers sounds like something that should be user-controllable. Right now it feels like a misfeature, whereas "we don't implement line numbers by default, but if you want them, do this and that and you can have them" would feel way more like a good feature to have.
Post reply on HN