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.

12 lines
366 B

  1. export default async function initHighlight() {
  2. if (!window.config || !window.config.HighlightJS) return;
  3. const hljs = await import(/* webpackChunkName: "highlight" */'highlight.js');
  4. const nodes = [].slice.call(document.querySelectorAll('pre code') || []);
  5. for (let i = 0; i < nodes.length; i++) {
  6. hljs.highlightBlock(nodes[i]);
  7. }
  8. return hljs;
  9. }