0

Prism JS library is not working inside an AngularJS project. I have tried all solutions mentioned here(SO) as well as on other tutorials, but copy pasting the whole code even from CodePen, doesn't give the same outputs. Very strange. Following is the code:

<pre>
  <code class="language-markup">
    <h1>hello</h1>
  </code>
</pre>

Output: enter image description here

I have downloaded the prism.js and prism.css files with all options, and these files are included in app.html and the above code is in a template named index.html. Don't know what's the problem.

R. Richards
  • 24,603
  • 10
  • 64
  • 64
Sahil Babbar
  • 579
  • 1
  • 7
  • 21
  • it should work fine. Please create a plnkr to make your problem reproduceable. – lin Feb 26 '17 at 11:51
  • Possible duplicate of [Highlights don't work in external template](http://stackoverflow.com/questions/28283191/highlights-dont-work-in-external-template) – Midhun Darvin Feb 26 '17 at 15:52
  • Please Take a look at this [question](http://stackoverflow.com/questions/28283191/highlights-dont-work-in-external-template). Templates loaded through with angularjs won't be rendered by prism. You can use this [Prism Directive](https://github.com/sercaneraslan/angular-prism-directive). – Midhun Darvin Feb 26 '17 at 15:55

1 Answers1

0

The issue was that instead of < and >, we need to use &lt; and &gt;, then only it works. That's all.

Sahil Babbar
  • 579
  • 1
  • 7
  • 21