2021-03-15 18:55:49 +01:00
|
|
|
import hljs from 'highlight.js/lib/core';
|
|
|
|
|
|
|
|
import javascript from 'highlight.js/lib/languages/javascript';
|
|
|
|
import json from 'highlight.js/lib/languages/json';
|
|
|
|
import bash from 'highlight.js/lib/languages/bash';
|
2021-06-15 16:27:38 +02:00
|
|
|
import xml from 'highlight.js/lib/languages/xml';
|
2021-03-15 18:55:49 +01:00
|
|
|
import ini from 'highlight.js/lib/languages/ini';
|
|
|
|
import yaml from 'highlight.js/lib/languages/yaml';
|
2021-03-16 08:55:07 +01:00
|
|
|
import markdown from 'highlight.js/lib/languages/markdown';
|
2021-03-15 18:55:49 +01:00
|
|
|
|
|
|
|
hljs.registerLanguage('javascript', javascript);
|
|
|
|
hljs.registerLanguage('json', json);
|
|
|
|
hljs.registerLanguage('bash', bash);
|
2021-06-15 16:27:38 +02:00
|
|
|
hljs.registerLanguage('html', xml);
|
2021-03-15 18:55:49 +01:00
|
|
|
hljs.registerLanguage('ini', ini);
|
|
|
|
hljs.registerLanguage('toml', ini);
|
|
|
|
hljs.registerLanguage('yaml', yaml);
|
2021-03-16 08:55:07 +01:00
|
|
|
hljs.registerLanguage('md', markdown);
|
2021-03-15 18:55:49 +01:00
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
document.querySelectorAll('pre code').forEach((block) => {
|
2021-04-18 12:59:49 +02:00
|
|
|
hljs.highlightElement(block);
|
2021-03-15 18:55:49 +01:00
|
|
|
});
|
|
|
|
});
|