highlight.js
highlight.js copied to clipboard
(Python) or"string" highlights the raw string instead of `or` operator
Describe the issue
Incorrect highlighting of python or
operator preceded by string without whitespace, highlight.js treats the string as a raw string (with r
prefix)
Which language seems to have the issue? Python
Are you using highlight
or highlightAuto
?
highlight
Sample Code to Reproduce https://jsfiddle.net/beh3j1nw/
Expected behavior This is valid Python code
print(test()or'string')
Probably just a matter of adding a \bor
rule prior to the string rule... or would it be simpler to add \b
to the string prefixes perhaps, forcing them to stand on their own?
I have read the Python highlighting script and found the solution: string highlighting the prefixes such as (r, u, b, f) and I will fix it now. After solving it, I will submit my PR.