mylloon.fr/static/js/libs/hljs.js

30 lines
603 B
JavaScript
Raw Normal View History

2023-04-24 16:18:54 +02:00
window.addEventListener("load", () => {
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();
document
.getElementById(
`hljs-${
window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light"
}-theme`
)
.removeAttribute("disabled");
2023-04-24 16:18:54 +02:00
});