highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.31k stars 3.52k forks source link

Python code not fully highlighted #3984

Closed pmac-dev closed 4 months ago

pmac-dev commented 4 months ago

Describe the issue Some parts of this Python code are not highlighted.

Which language seems to have the issue? Python

Are you using highlight or highlightAuto?

highlightAll()

Sample Code to Reproduce Please check this jsfiddle:

https://jsfiddle.net/dz32yks9/

or this screenshot, html+HighlightJS:

mywebsite

Expected behavior Functions, variables and constants should be highlighted too, just like Github or VSCode:

github

VSCode

Additional context

ghomem commented 4 months ago

Reproducible on the demo as well:

Screenshot_20240213_002645

joshgoebel commented 4 months ago

A PR would be very welcome, but I'm closing this as a dup of #2500... we're very open to these types of improvements for all grammars, but we don't need 189 individual issues.

joshgoebel commented 4 months ago

Ruby, Wren, and other grammars have some rules that could be examined if you wanted to work on a PR...