highlightjs / highlightjs/highlight.js

(ruby) Bitwise OR pipe confused with Block Parenthesis pipes

Open
#4,187 0 comments 0 reactions 0 assignees View on GitHub
bug help welcome language
Dominant language
JavaScript
Stars
25k
Forks
3.8k
Avg merge
11h 35m
Merged PRs (30d)
3

Description

**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.
```ruby
[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**
```ruby
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.