2023-04-24 16:18:54 +02:00
|
|
|
window.addEventListener("load", () => {
|
2023-04-25 02:32:43 +02:00
|
|
|
const theme = window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
|
|
? "dark" // dark
|
|
|
|
: "default"; // light
|
|
|
|
|
2023-04-24 16:18:54 +02:00
|
|
|
hljs.configure({
|
|
|
|
noHighlightRe: /^$/i,
|
|
|
|
languageDetectRe: /\blanguage-hljs-([\w-]+)\b/i,
|
|
|
|
});
|
|
|
|
|
|
|
|
hljs.addPlugin(new CopyButtonPlugin());
|
2023-04-24 16:47:38 +02:00
|
|
|
|
|
|
|
const aliases = {
|
|
|
|
bash: ["fish"],
|
|
|
|
};
|
|
|
|
for (const lang in aliases) {
|
|
|
|
hljs.registerAliases(aliases[lang], { languageName: lang });
|
|
|
|
}
|
|
|
|
|
2023-04-24 16:18:54 +02:00
|
|
|
hljs.highlightAll();
|
2023-04-24 20:58:55 +02:00
|
|
|
|
|
|
|
hljs.initLineNumbersOnLoad();
|
2023-04-25 02:32:43 +02:00
|
|
|
|
|
|
|
document
|
|
|
|
.getElementById(
|
|
|
|
`hljs-${
|
|
|
|
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
|
|
? "dark"
|
|
|
|
: "light"
|
|
|
|
}-theme`
|
|
|
|
)
|
|
|
|
.removeAttribute("disabled");
|
2023-04-24 16:18:54 +02:00
|
|
|
});
|