Highlight.js: Python highligth syntax print() doesn't work

Created on 8 Mar 2017  路  7Comments  路  Source: highlightjs/highlight.js

If I'm using just print then this is highlight.
But if I'm using print() then this isn't highlight.
\\

Most helpful comment

I really would like you to reconsider print("hello world") in a python 3 world. Its indeed not a keyword anymore, but its part of the built ins. I see that build ins are not at all supported see https://github.com/isagalaev/highlight.js/blob/master/src/languages/python.js#L12-L13

see a list of built ins: https://docs.python.org/3/library/functions.html

thanks

All 7 comments

It's by design. print() is a Python 3 thing where print is not a keyword.

Highlight js uses python 2?

It tries to highlight Python code of both versions, but makes a guess on how to highlight print depending on how it's used.

Is it possible to make highligthing print()?
I guess this is used very much on sites and users would like to see highligthing this.

That's unlikely. It's not a keyword in Python anymore, and I don't see the point in highlighting it as one. Also, I'd need some data on how many users actually want it highlighted. It's the first time anyone raises this point.

I see, Thank you for your work!
But please to think about it because sublime, visio code, eclipse, Python IDE highlighting this.

I really would like you to reconsider print("hello world") in a python 3 world. Its indeed not a keyword anymore, but its part of the built ins. I see that build ins are not at all supported see https://github.com/isagalaev/highlight.js/blob/master/src/languages/python.js#L12-L13

see a list of built ins: https://docs.python.org/3/library/functions.html

thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

starikovs picture starikovs  路  8Comments

sustained picture sustained  路  4Comments

OrbintSoft picture OrbintSoft  路  8Comments

zhouxy666 picture zhouxy666  路  3Comments

kkeundotnet picture kkeundotnet  路  3Comments