File tree Expand file tree Collapse file tree 2 files changed +124
-1
lines changed
src/components/MarkdownRender Expand file tree Collapse file tree 2 files changed +124
-1
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,73 @@ import remarkGfm from 'remark-gfm'
5
5
import remarkBreaks from 'remark-breaks'
6
6
import { Pre } from './Pre'
7
7
import { Hyperlink } from './Hyperlink'
8
+ import { memo } from 'react'
8
9
9
10
export function MarkdownRender ( props ) {
10
11
return (
11
12
< div dir = "auto" >
12
13
< ReactMarkdown
14
+ allowedElements = { [
15
+ 'div' ,
16
+ 'p' ,
17
+ 'span' ,
18
+
19
+ 'video' ,
20
+ 'img' ,
21
+
22
+ 'abbr' ,
23
+ 'acronym' ,
24
+ 'b' ,
25
+ 'blockquote' ,
26
+ 'code' ,
27
+ 'em' ,
28
+ 'i' ,
29
+ 'li' ,
30
+ 'ol' ,
31
+ 'ul' ,
32
+ 'strong' ,
33
+ 'table' ,
34
+ 'tr' ,
35
+ 'td' ,
36
+ 'th' ,
37
+
38
+ 'details' ,
39
+ 'summary' ,
40
+ 'kbd' ,
41
+ 'samp' ,
42
+ 'sub' ,
43
+ 'sup' ,
44
+ 'ins' ,
45
+ 'del' ,
46
+ 'var' ,
47
+ 'q' ,
48
+ 'dl' ,
49
+ 'dt' ,
50
+ 'dd' ,
51
+ 'ruby' ,
52
+ 'rt' ,
53
+ 'rp' ,
54
+
55
+ 'br' ,
56
+ 'hr' ,
57
+
58
+ 'h1' ,
59
+ 'h2' ,
60
+ 'h3' ,
61
+ 'h4' ,
62
+ 'h5' ,
63
+ 'h6' ,
64
+
65
+ 'thead' ,
66
+ 'tbody' ,
67
+ 'tfoot' ,
68
+ 'u' ,
69
+ 's' ,
70
+ 'a' ,
71
+ 'pre' ,
72
+ 'cite' ,
73
+ ] }
74
+ unwrapDisallowed = { true }
13
75
remarkPlugins = { [ remarkGfm , remarkBreaks ] }
14
76
rehypePlugins = { [
15
77
rehypeRaw ,
@@ -37,4 +99,4 @@ MarkdownRender.propTypes = {
37
99
...ReactMarkdown . propTypes ,
38
100
}
39
101
40
- export default MarkdownRender
102
+ export default memo ( MarkdownRender )
Original file line number Diff line number Diff line change @@ -14,6 +14,67 @@ export function MarkdownRender(props) {
14
14
return (
15
15
< div dir = "auto" >
16
16
< ReactMarkdown
17
+ allowedElements = { [
18
+ 'div' ,
19
+ 'p' ,
20
+ 'span' ,
21
+
22
+ 'video' ,
23
+ 'img' ,
24
+
25
+ 'abbr' ,
26
+ 'acronym' ,
27
+ 'b' ,
28
+ 'blockquote' ,
29
+ 'code' ,
30
+ 'em' ,
31
+ 'i' ,
32
+ 'li' ,
33
+ 'ol' ,
34
+ 'ul' ,
35
+ 'strong' ,
36
+ 'table' ,
37
+ 'tr' ,
38
+ 'td' ,
39
+ 'th' ,
40
+
41
+ 'details' ,
42
+ 'summary' ,
43
+ 'kbd' ,
44
+ 'samp' ,
45
+ 'sub' ,
46
+ 'sup' ,
47
+ 'ins' ,
48
+ 'del' ,
49
+ 'var' ,
50
+ 'q' ,
51
+ 'dl' ,
52
+ 'dt' ,
53
+ 'dd' ,
54
+ 'ruby' ,
55
+ 'rt' ,
56
+ 'rp' ,
57
+
58
+ 'br' ,
59
+ 'hr' ,
60
+
61
+ 'h1' ,
62
+ 'h2' ,
63
+ 'h3' ,
64
+ 'h4' ,
65
+ 'h5' ,
66
+ 'h6' ,
67
+
68
+ 'thead' ,
69
+ 'tbody' ,
70
+ 'tfoot' ,
71
+ 'u' ,
72
+ 's' ,
73
+ 'a' ,
74
+ 'pre' ,
75
+ 'cite' ,
76
+ ] }
77
+ unwrapDisallowed = { true }
17
78
remarkPlugins = { [ remarkMath , remarkGfm , remarkBreaks ] }
18
79
rehypePlugins = { [
19
80
rehypeKatex ,
You can’t perform that action at this time.
0 commit comments