highlightjs / highlightjs/highlight.js

Again: Ruby syntax: Wrong recognition of symbols at the place of calling a class methods. Now in v11.12.0

Open Beginner friendly
#4,516 2 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

I already wrote about this [issue](https://github.com/highlightjs/highlight.js/issues/4294) for version v11.11.1, the issue was closed, but the bug still remains.

**Wrong recognition of symbols Ruby at the place of calling a class methods**.
Class methods may be call via:
```ClassName::method```
but it recognized as symbol ```:method```, also now ```ClassName:``` reconized as a symbol.

**Which language seems to have the issue?**
Ruby

**Are you using `highlight` or `highlightAuto`?**
```javascript
document.querySelectorAll('pre').forEach((el) => {
hljs.highlightElement(el);
});
```

**Sample Code to Reproduce**
```:symbol```
```symbol:```
```A::a``` - call class method

### To fix the bug:
Just replace
```':(?!\\s)'``` to ```'(?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Ruby highlighting examples `:symbol`, `symbol:`, and `A::a` with the documented `hljs.highlightElement` usage. Check the Ruby language grammar and its symbol patterns, then verify that symbols still highlight correctly while `A::a` is recognized as a class-method call.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ruby
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.