You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
366 B
13 lines
366 B
5 years ago
|
export default async function initHighlight() {
|
||
|
if (!window.config || !window.config.HighlightJS) return;
|
||
|
|
||
|
const hljs = await import(/* webpackChunkName: "highlight" */'highlight.js');
|
||
|
|
||
|
const nodes = [].slice.call(document.querySelectorAll('pre code') || []);
|
||
|
for (let i = 0; i < nodes.length; i++) {
|
||
|
hljs.highlightBlock(nodes[i]);
|
||
|
}
|
||
|
|
||
|
return hljs;
|
||
|
}
|