pc035860 / angular-highlightjs

AngularJS directive for syntax highlighting with highlight.js
http://pc035860.github.io/angular-highlightjs/example/
MIT License
294 stars 53 forks source link

Incorrect language setup #58

Closed sergey-morenets closed 8 years ago

sergey-morenets commented 8 years ago

Hi

I'm using angular-highlightjs for my site and always specify language, for example, hljs-language="java". However I often see incorrect language in the resulting HTML. Sometimes it's correct: [code class="hljs java"]. Sometimes [code class="hljs cs"] or [code class="hljs cpp"]. Please advise.

pc035860 commented 8 years ago

Can you provide an example plunk to demonstrate the issue?

The hljs-language always works in the example page. I guess the bug is caused by how you use it.

sergey-morenets commented 8 years ago

Hi

Thank you for the response. As I mentioned most often language is configured correctly. You can look at this link. http://it-simulator.com/#/article/1/133

There are four code blocks there. First one has "java" class, other three blocks "coffeescript", "php" and "cs".

Thank you.

pc035860 commented 8 years ago

Hi, I noticed that you're using angular-highlightjs 0.3.3, which is not the latest version (which is 0.5.1). http://it-simulator.com/scripts/angular-highlightjs.min.js

Can you try to upgrade it to the latest version? There was a fix for the hljs-language in ng-repeat issue.

See the releases & changelogs.

You can grab the latest build at http://pc035860.github.io/angular-highlightjs/angular-highlightjs.min.js

sergey-morenets commented 8 years ago

Hi

Thank you the response. I tried to upgrade to 0.5.1 version but it didn't work for me. I got an error:

Error: b is undefined .$get@http://it-simulator.com/scripts/angular-highlightjs.min.js:6:535

sergey-morenets commented 8 years ago

0.5.0 version doesn't work as well.

Here is more descriptive error message: Error: hljs is undefined .$get@http://it-simulator.com/scripts/angular-highlightjs.js:47:8

sergey-morenets commented 8 years ago

I finally got it working by moving highlight.min.js upper than angular-highlight.min.js in html file. Thank you, you can close this issue.