Article From:

I use ithljs.initHighlightingOnLoad();When loading the page, a highlight rendering is made to the code.

Then execute the following code to change the content of ID’s content element.

document.getElementById('content').inerHTML = markdown;

Content contains
<pre><code class="xxx">xxx</code><pre>In this format, the new block of code is not highlighted.

How do you render the code again with highlight.js after the page content changes?

Answer 0:

Do it againhljs.initHighlightingOnLoad();

Leave a Reply

Your email address will not be published. Required fields are marked *