mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 14:49:32 +01:00
13 lines
366 B
JavaScript
13 lines
366 B
JavaScript
|
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;
|
||
|
}
|