Skip to content

Commit 1fdbc84

Browse files
authored
Only import the languages we use for highlight.js (#359)
1 parent 0e8f332 commit 1fdbc84

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils/Highlight.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React, { PureComponent } from 'react';
2-
import hljs from 'highlight.js';
2+
import hljs from 'highlight.js/lib/core';
3+
import xml from 'highlight.js/lib/languages/xml';
4+
import sh from 'highlight.js/lib/languages/bash';
5+
6+
hljs.registerLanguage('jsx', xml);
7+
hljs.registerLanguage('html', xml);
8+
hljs.registerLanguage('sh', sh);
39

410
type HighlightProps = {
511
className?: string;

0 commit comments

Comments
 (0)