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

auto detect over rides manually specified language using ngRepeat #50

Closed pcnate closed 8 years ago

pcnate commented 9 years ago

Using the following line:

<div hljs="" source="'$project->set(\'parameter\', \'value\');'" language="php"></div>

I am expecting:

<code class="hljs php"><span class="hljs-variable">$project</span>-&gt;set(<span class="hljs-string">"parameter"</span>, <span class="hljs-string">"value"</span>);</code>

Instead, I am getting:

<code class="hljs bash php"><span class="hljs-variable">$project</span>-&gt;set(<span class="hljs-string">"parameter"</span>, <span class="hljs-string">"value"</span>);</code>
pc035860 commented 9 years ago

Hi @pcnate ,

I can't reproduce the issue. Here's the plunk. http://plnkr.co/edit/WNujp5wA4GMjIQ7BuPmZ?p=preview

Can you fork it and try to reproduce the issue?

pcnate commented 9 years ago

It appears to be related to using ng-repeat="code in arrayOfCode"

<div ng-repeat="code in phpCode track by $index">
  <div hljs="" source="code" language="php"></div>
</div>

http://plnkr.co/edit/ekMJmrxWK9CpJtjhH3XK?p=preview

pc035860 commented 9 years ago

OK, I'll look into it.

pc035860 commented 8 years ago

The fix for #35 actually also fixed the issue. Will release a new version later today.