Open chrisfay opened 8 years ago
Hi, I guess you already got the answer from isagalaev/highlight.js/issues/1058.
What you actually need is preventing your <foo bar></foo>
to be parsed by browser before AngularJS gets it hands on it.
hljs source or hljs include can do the trick.
See #30 for the previous discussion.
An example of solving it with hljs-include
<div hljs hljs-include="'the-foo-bar-source'"></div>
<script id="the-foo-bar-source" type="text/ng-template">
<foo bar></foo>
</script>
Ahhh, gotcha. I think I was misunderstanding at what stage the attributes were getting modified before rendering. This makes sense, thanks!
Chris
On Wed, Feb 3, 2016 at 11:26 AM Chih-Hsuan Fan notifications@github.com wrote:
Hi, I guess you already got the answer from isagalaev/highlight.js#1058 https://github.com/isagalaev/highlight.js/issues/1058.
What you actually need is preventing your
to be parsed by browser before AngularJS gets it hands on it. hljs source http://pc035860.github.io/angular-highlightjs/example/#/hljs-source or hljs include http://pc035860.github.io/angular-highlightjs/example/#/hljs-include can do the trick.
See #30 https://github.com/pc035860/angular-highlightjs/issues/30 for the previous discussion.
An example of solving it with hljs-include
— Reply to this email directly or view it on GitHub https://github.com/pc035860/angular-highlightjs/issues/60#issuecomment-179390293 .
Chris Fay http://www.chrisfay.net chrislfay@gmail.com
BTW, you can also prevent from browser parsing by manually escaping those code you put inside hljs
directive, and use it with hljs-no-escape
option.
For example
<div hljs hljs-no-escape>
<foo bar></foo>
</div>
[See this discussion https://github.com/isagalaev/highlight.js/issues/1058]
How do I configure so that this:
<foo bar></foo>
...doesn't become this after it's ran through highlightjs:
<foo bar=""></foo>