45 lines
1.7 KiB
JavaScript
45 lines
1.7 KiB
JavaScript
|
import hljs from 'highlight.js/lib/core';
|
||
|
|
||
|
import go from 'highlight.js/lib/languages/go';
|
||
|
import json from 'highlight.js/lib/languages/json';
|
||
|
import bash from 'highlight.js/lib/languages/bash';
|
||
|
import xml from 'highlight.js/lib/languages/xml';
|
||
|
import yaml from 'highlight.js/lib/languages/yaml';
|
||
|
import dockerfile from 'highlight.js/lib/languages/dockerfile';
|
||
|
import nginx from 'highlight.js/lib/languages/nginx';
|
||
|
import ruby from 'highlight.js/lib/languages/ruby';
|
||
|
import plaintext from 'highlight.js/lib/languages/plaintext';
|
||
|
import php from 'highlight.js/lib/languages/php';
|
||
|
import python from 'highlight.js/lib/languages/python';
|
||
|
import ldif from 'highlight.js/lib/languages/ldif';
|
||
|
import ini from 'highlight.js/lib/languages/ini';
|
||
|
|
||
|
hljs.registerLanguage('go', go);
|
||
|
hljs.registerLanguage('json', json);
|
||
|
hljs.registerLanguage('bash', bash);
|
||
|
hljs.registerLanguage('console', bash);
|
||
|
hljs.registerLanguage('sh', bash);
|
||
|
hljs.registerLanguage('shell', bash);
|
||
|
hljs.registerLanguage('html', xml);
|
||
|
hljs.registerLanguage('yaml', yaml);
|
||
|
hljs.registerLanguage('yml', yaml);
|
||
|
hljs.registerLanguage('dockerfile', dockerfile);
|
||
|
hljs.registerLanguage('nginx', nginx);
|
||
|
hljs.registerLanguage('ruby', ruby);
|
||
|
hljs.registerLanguage('rb', ruby);
|
||
|
hljs.registerLanguage('plaintext', plaintext);
|
||
|
hljs.registerLanguage('php', php);
|
||
|
hljs.registerLanguage('text', plaintext);
|
||
|
hljs.registerLanguage('txt', plaintext);
|
||
|
hljs.registerLanguage('python', python);
|
||
|
hljs.registerLanguage('py', python);
|
||
|
hljs.registerLanguage('ldif', ldif);
|
||
|
hljs.registerLanguage('ini', ini);
|
||
|
hljs.registerLanguage('cnf', ini);
|
||
|
|
||
|
document.addEventListener('DOMContentLoaded', () => {
|
||
|
document.querySelectorAll('pre code:not(.language-mermaid)').forEach((block) => {
|
||
|
hljs.highlightElement(block);
|
||
|
});
|
||
|
});
|