Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

([JavaScript]) Incorrect highlighting of code #2449

Closed
Tejas2805 opened this issue Mar 5, 2020 · 8 comments
Closed

([JavaScript]) Incorrect highlighting of code #2449

Tejas2805 opened this issue Mar 5, 2020 · 8 comments
Labels
bug help welcome Could use help from community language

Comments

@Tejas2805
Copy link

Tejas2805 commented Mar 5, 2020

Describe the issue
A clear and concise description of what the issue seems to be.

For some reason, its picking up code as regex and thats why coloring it differently.

Which language seems to have the issue?
Please specify exactly which language grammar you are using to highlight (python, javascript, etc.) or specify if you are using auto-detection. If you are using auto-detection please first check to make sure the language you are expecting was properly detected. If Highlight.js misidentifies the type of code - then the highlighting may be entirely incorrect - and there often isn't much we can do about that - auto-detection is only best-effort and can't guess right 100% of the time.

JavaScript

Sample Code to Reproduce
Please include text examples of the code that fails to highlight properly or can reproduce the bug. You can attach a screenshot if you'd like, but the code is necessary because we may need to copy/paste it to help resolve the issue - or add it to a test.

Screen Shot 2020-03-05 at 4 51 00 PM

A jsfiddle can sometimes be even better. You can fork an example test case:
https://jsfiddle.net/ajoshguy/gfzujpyt/

Expected behavior
A clear and concise description of what you expected to happen. A screenshot might help here if another highlighting library gets it right, or is Github highlights it better/properly you can use a GitHub code block.

The font in green should be black too.

Additional context
Add any other context about the problem here.

@Tejas2805 Tejas2805 added bug help welcome Could use help from community language labels Mar 5, 2020
@Tejas2805 Tejas2805 changed the title ([language name]) Short description of issue... ([Java]) Incorrect highlighting of code Mar 5, 2020
@joshgoebel
Copy link
Member

Java or JavaScript? Looks like Javascript code to me.

@Tejas2805 Tejas2805 changed the title ([Java]) Incorrect highlighting of code ([JavaScript]) Incorrect highlighting of code Mar 5, 2020
@Tejas2805
Copy link
Author

Aah my bad. Sorry. Its Javascript.

@joshgoebel
Copy link
Member

Can you test this against master? Pretty sure this is fixed in 10.0 already.

@Tejas2805
Copy link
Author

Tejas2805 commented Mar 5, 2020

How to test against master if I am using something like this?

script(src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/highlight.min.js")

@joshgoebel
Copy link
Member

You'd have to build it from source and test locally. :-|

@Tejas2805
Copy link
Author

Thanks for your help!

@joshgoebel
Copy link
Member

joshgoebel commented Mar 8, 2020

Closing as a dup of #2380 (resolved PR)

@joshgoebel
Copy link
Member

If you can test via NPM:

https://www.npmjs.com/package/highlight.js/v/10.0.0-beta.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community language
Projects
None yet
Development

No branches or pull requests

2 participants