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';
|
|
|
|
import htmlbars from 'highlight.js/lib/languages/htmlbars';
|
|
|
|
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);
|
|
|
|
hljs.registerLanguage('html', htmlbars);
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|