highlightjs / vue-plugin

Highlight.js Vue Plugin
BSD 3-Clause "New" or "Revised" License
201 stars 27 forks source link

Fix language prop being ignored #42

Closed barrycohen closed 1 year ago

barrycohen commented 1 year ago

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.

joshgoebel commented 1 year ago

Awesome, also will need to update the CHANGELOG.

barrycohen commented 1 year ago

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