highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

(ruby) Bitwise OR pipe confused with Block Parenthesis pipes

Open dysonreturns opened this issue 1 year ago • 0 comments

Describe the issue Bitwise OR operators which use pipe "|", i.e 1 | 2 get confused with block parenthesis syntax wich are two pipes, i.e.

[1,2,3].each do |num|
   # ...
end

Currently, anything after a pipe is forever highlighted as a parameter until another pipe appears.

Which language seems to have the issue? ruby

Are you using highlight or highlightAuto? Either one.

...

Sample Code to Reproduce

1 | 2 # Bitwise OR
puts "between '2' and '5.times' are all hljs-params"
5.times do |num|
 puts num
end

https://jsfiddle.net/oh57e1s2/

Expected behavior Bitwise OR operator "|" should work just like any other &^~+-*/ etc.

dysonreturns avatar Dec 18 '24 23:12 dysonreturns