1
1
import React , { useImperativeHandle } from 'react' ;
2
- import ReactMarkdown from 'react-markdown' ;
3
- // @ts -ignore
2
+ import ReactMarkdown , { Options } from 'react-markdown' ;
4
3
import gfm from 'remark-gfm' ;
5
- // @ts -ignore
6
4
import slug from 'remark-slug' ;
7
- // @ts -ignore
8
5
import headings from 'remark-autolink-headings'
9
- // @ts -ignore
10
6
import rehypeRaw from 'rehype-raw' ;
11
7
import rehypePrism from '@mapbox/rehype-prism' ;
12
- // @ts -ignore
13
8
import rehypeRewrite from 'rehype-rewrite' ;
14
9
import './styles/markdown.less' ;
15
10
import './styles/markdowncolor.less' ;
@@ -54,7 +49,7 @@ export type MarkdownPreviewProps = {
54
49
warpperElement ?: React . DetailedHTMLProps < React . HTMLAttributes < HTMLDivElement > , HTMLDivElement > ;
55
50
onScroll ?: ( e : React . UIEvent < HTMLDivElement > ) => void ;
56
51
onMouseOver ?: ( e : React . MouseEvent < HTMLDivElement > ) => void ;
57
- } & Omit < ReactMarkdown . ReactMarkdownOptions , 'children' > ;
52
+ } & Omit < Options , 'children' > ;
58
53
59
54
export type MarkdownPreviewRef = {
60
55
mdp : React . RefObject < HTMLDivElement > ;
@@ -69,7 +64,7 @@ export default React.forwardRef<MarkdownPreviewRef, MarkdownPreviewProps>((props
69
64
< div ref = { mdp } onScroll = { onScroll } onMouseOver = { onMouseOver } { ...warpperElement } className = { cls } style = { style } >
70
65
< ReactMarkdown
71
66
{ ...other }
72
- rehypePlugins = { [ [ rehypePrism , { ignoreMissing : true } ] , [ rehypeRewrite , rehypeRewriteHandle ] , rehypeRaw , ...( other . rehypePlugins || [ ] ) ] }
67
+ rehypePlugins = { [ [ rehypePrism , { ignoreMissing : true } ] , [ rehypeRewrite as any , rehypeRewriteHandle ] , rehypeRaw , ...( other . rehypePlugins || [ ] ) ] }
73
68
remarkPlugins = { [ slug , headings , ...( other . remarkPlugins || [ ] ) , gfm ] }
74
69
children = { source || '' }
75
70
/>
0 commit comments