MurhafSousli / ngx-highlightjs

Angular syntax highlighting module
https://ngx-highlight.netlify.app/
MIT License
272 stars 35 forks source link

Failed to migrate to 12.0 #293

Open sergey-morenets opened 3 weeks ago

sergey-morenets commented 3 weeks ago

Hi

We failed to migrate ngx-highlightjs in our project from 10.0 to 12.0 because of the multiple errors in the console. Please note, that new version added "language" property so the error may relate to this feature.

Reproduction

We couldn't reproduce this issue in StackBlitz (https://stackblitz.com/edit/ngx-highlightjs) because the changes were rebuilding too much (more than 15 mins) and probably stuck.

Expected Behavior

No issues should happen

Actual Behavior

If I use this line in the template:

<pre><code [highlight]="'int a'" language="java"></code></pre>

I see an error in the console:

Error: Unknown language: "int a"
    at Object.f [as highlight] (global:scripts.js:10:4344)
    at _HighlightJS.<anonymous> (ngx-highlightjs.mjs:185:17)
    at Generator.next (<anonymous>)

If I use this line in the template:

<pre><code [highlight]="'java'" language="java"></code></pre>

I see this error in the console:

TypeError: t2.substr is not a function
    at Object.f [as highlight] (global:scripts.js:10:4593)
    at _HighlightJS.<anonymous> (ngx-highlightjs.mjs:185:17)
    at Generator.next (<anonymous>)

Environment

MurhafSousli commented 2 weeks ago

Sometimes stackblitz does that in Chome, try Firefox to reproduce it.