forked from remarkjs/react-markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
122 lines (108 loc) · 3.08 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Type definitions for react-markdown > v3.3.0
// Project: https://github.com/rexxars/react-markdown
// Definitions by:
// - Ruslan Ibragimov <https://github.com/IRus>
// - Kohei Asai <me@axross.io>
// - ClassicDarkChocolate <https://github.com/ClassicDarkChocolate>
// - Espen Hovlandsdal <https://espen.codes/>
import {Component, ReactElement, ReactNode, ReactType} from 'react'
declare class ReactMarkdown extends Component<ReactMarkdown.ReactMarkdownProps, {}> {}
declare namespace ReactMarkdown {
interface Point {
readonly line: number
readonly column: number
readonly offset?: number
}
interface Position {
readonly start: Point
readonly end: Point
readonly indent?: number[]
}
export type NodeType =
| 'root'
| 'text'
| 'break'
| 'paragraph'
| 'emphasis'
| 'strong'
| 'thematicBreak'
| 'blockquote'
| 'delete'
| 'link'
| 'image'
| 'linkReference'
| 'imageReference'
| 'table'
| 'tableHead'
| 'tableBody'
| 'tableRow'
| 'tableCell'
| 'list'
| 'listItem'
| 'definition'
| 'heading'
| 'inlineCode'
| 'code'
| 'html'
| 'virtualHtml'
export type AlignType =
| "left"
| "right"
| "center"
| null
export type ReferenceType =
| "shortcut"
| "collapsed"
| "full"
export interface ReactMarkdownProps {
readonly className?: string
readonly source?: string
readonly sourcePos?: boolean
readonly rawSourcePos?: boolean
readonly escapeHtml?: boolean
readonly skipHtml?: boolean
readonly allowNode?: (node: MarkdownAbstractSyntaxTree, index: number, parent: NodeType) => boolean
readonly allowedTypes?: NodeType[]
readonly disallowedTypes?: NodeType[]
readonly transformLinkUri?: (uri: string, children?: ReactNode, title?: string) => string
readonly transformImageUri?: (uri: string, children?: ReactNode, title?: string, alt?: string) => string
readonly unwrapDisallowed?: boolean
readonly renderers?: {[nodeType: string]: ReactType}
readonly astPlugins?: MdastPlugin[]
readonly plugins?: any[] | (() => void)
}
interface RenderProps extends ReactMarkdownProps {
readonly definitions?: object
}
type Renderer<T> = (props: T) => ReactElement<T>
interface Renderers {
[key: string]: string | Renderer<any>
}
interface MarkdownAbstractSyntaxTree {
align?: AlignType[]
alt?: string | null
checked?: boolean | null
children?: MarkdownAbstractSyntaxTree[]
data?: {[key: string]: any}
index?: number
depth?: number
height?: number
identifier?: string
lang?: string | null
loose?: boolean
ordered?: boolean
position?: Position
referenceType?: ReferenceType
start?: number | null
title?: string | null
type: string
url?: string
value?: string
width?: number
}
type MdastPlugin = (node: MarkdownAbstractSyntaxTree, renderProps?: RenderProps) => MarkdownAbstractSyntaxTree
export var types: NodeType[]
export var renderers: Renderers
export var uriTransformer: (uri: string) => string
}
export = ReactMarkdown