Skip to content

Conversation

barrycohen
Copy link
Contributor

@barrycohen barrycohen commented Dec 7, 2022

Fixes a logic error which causes the language prop to be ignored unless autodetection is explicit disabled.

For example, in 2.1.2, the following is highlighted as cpp rather than shell, even though we have asked for shell:

<highlightjs language="shell" code="#include <iostream>"></highlightjs>

I've tested the fix over a wide range of cases. The example code I used is

#include <iostream>; import os

because it is autodetected as stan but renders differently for stan, cpp and shell, which means you can visually tell how it has been highlighted.

I believe the fix provides reasonable results in all cases.

image

Fixes #41.

Fixes a logic error which meant autodetection would override an explicit language being given.
@joshgoebel
Copy link
Member

Awesome, also will need to update the CHANGELOG.

@barrycohen
Copy link
Contributor Author

Good point, thanks. ChangeLog updated. I've assumed the change will go into 2.1.3.

@joshgoebel joshgoebel merged commit 454575a into highlightjs:main Dec 8, 2022
@helloxz
Copy link

helloxz commented Dec 31, 2024

Good point, thanks. ChangeLog updated. I've assumed the change will go into 2.1.3.

This bug has been around for a long time, why hasn't version 2.1.3 been released yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Providing a language doesn't disable autodetect
3 participants