Article From:https://segmentfault.com/q/1010000012146853
Question:
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();
Link of this Article: Once a highlight.js is rendered, the contents of an element in HTML are changed and how to render it again.