Highlightjs doesn't show code for html and handelbars

148 Views Asked by At

I m using Highlight.js from NPM and I would like to have html and handelbar templates code showing on screen. I confirm it works perfectly for JS code but it doesn't show code for html and handelbars. For example below code, I expect to display the html on screen but it doesn't...

My html code:

<pre><code><button>Click</button></code></pre>

My js code

hljs.initHighlightingOnLoad();

$('pre code').each( (i, block) => {
  console.log(block);
  hljs.highlightBlock(block);
});

The html when inspect view source:

<pre><code class="handelbars hljs ebnf"><button><span class="hljs-attribute"><span class="hljs-attribute">Click</span></span></button></code></pre>

What is showing on page is just a text 'Click'

enter image description here

Does anyone know how to get it working?

0

There are 0 best solutions below