SyntaxHighlighter block incorrectly highlighting Clojure codes
Quick summary
When adding Clojure programming language using the SyntaxHighlighter Block, the block incorrectly highlights a word inside a comment when the word has the same name as a function. It also highlights any string with the same name as a function name.
Disclaimer: I'm not familiar with Clojure code, but this is based on a report from a user who's using Clojure language.
Steps to reproduce
- On a Simple site, add a Syntax Highlighter Block
- Add a Clojure codes
- Add a word in the comment that is the same word as one of Clojure functions, such as
firstorsortfunctions
What you expected to happen
The Block should not highlight the word in the comment and should not highlight a word that acts as a string.
What actually happened
The Block highlights the words that do not act as functions.
Code samples can be found here.
Example 1:
From the screenshot above, the word "first" is highlighted, even though it is in a comment, which shouldn't get a special highlighting, even though it is a function name.
Example 2:
From the screenshot above, the word "sort" in "selection-sort" is highlighted in a different color than "selection-", since "sort" is a built-in function in Clojure. But, in this case, the "sort" part of "selection-sort" has nothing to do with the "sort" function.
Impact
Some (< 50%)
Available workarounds?
No but the platform is still usable
Platform (Simple and/or Atomic)
Simple
Logs or notes
Reproduced this on both FSE theme (Masu) and Classic theme (Twenty Twenty).
User report: 7246001-zd-a8c
Support References
This comment is automatically generated. Please do not edit it.
- [ ] 7246001-zen
📌 REPRODUCTION RESULTS – Tested on Simple – Replicated
- Steps are as per the original report.
- Add the syntax highlighter block, select Clojure language, paste in code examples, comments are highlighted, not just commands
I believe this uses the SyntaxHighlighter JS library. My assumption is that this would need to be addressed further up the chain and that there may be a fix already in place if we dig in to see if a relevant update is available. Moving the status to be "Needs Core/3rd Party Fix".