Skip to content

Commit

Permalink
Merge branch 'client-syntax-highlight' into bundlesize-compare-client…
Browse files Browse the repository at this point in the history
…-syntax-highlight
  • Loading branch information
LeoMcA committed Sep 9, 2024
2 parents ca6031d + 713d8d8 commit 2869e00
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions client/src/document/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from "./code/playground";
import { addCopyToClipboardButton } from "./code/copy";
import { useUIStatus } from "../ui-context";
import { highlightElement } from "./code/syntax-highlight";

export function useDocumentURL() {
const locale = useLocale();
Expand Down Expand Up @@ -119,10 +118,12 @@ export function useDecorateExamples(doc: Doc | undefined) {
} else {
addCopyToClipboardButton(element, header);
}
highlightElement(
element,
header?.querySelector(".language-name")?.textContent || "plain"
);
import("./code/syntax-highlight").then(({ highlightElement }) => {
highlightElement(
element,
header?.querySelector(".language-name")?.textContent || "plain"
);
});
});
}, [doc, location]);
}
Expand Down

0 comments on commit 2869e00

Please sign in to comment.