forked from remarkjs/react-markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-markdown.d.ts
More file actions
59 lines (49 loc) · 1.91 KB
/
react-markdown.d.ts
File metadata and controls
59 lines (49 loc) · 1.91 KB
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
// Type definitions for react-markdown v2.2.2
// Project: https://github.com/rexxars/react-markdown
// Definitions by: Ruslan Ibragimov <https://github.com/IRus>, Kohei Asai <me@axross.io>
import { Component, ReactElement, ReactNode, ReactType } from 'react';
declare class ReactMarkdown extends Component<ReactMarkdown.ReactMarkdownProps, {}> {}
declare namespace ReactMarkdown {
interface AllowNode {
readonly type: string;
readonly renderer: string;
readonly props: any;
readonly children: ReactNode[];
}
interface WalkerNode {
readonly entering: boolean,
readonly node: { type: string }
}
interface NodeWalker {
next: () => WalkerNode;
}
export type NodeType = 'HtmlInline' | 'HtmlBlock' | 'Text' | 'Paragraph' | 'Heading' | 'Softbreak' | 'Hardbreak' | 'Link' | 'Image' | 'Emph' | 'Code' | 'CodeBlock' | 'BlockQuote' | 'List' | 'Item' | 'Strong' | 'ThematicBreak';
export interface ReactMarkdownProps {
readonly className?: string;
readonly containerProps?: any;
readonly source: string;
readonly containerTagName?: string;
readonly childBefore?: any;
readonly childAfter?: any;
readonly sourcePos?: boolean;
readonly escapeHtml?: boolean;
readonly skipHtml?: boolean;
readonly softBreak?: string;
readonly allowNode?: (node: AllowNode) => boolean;
readonly allowedTypes?: NodeType[];
readonly disallowedTypes?: NodeType[];
readonly transformLinkUri?: (uri: string) => string;
readonly transformImageUri?: (uri: string) => string;
readonly unwrapDisallowed?: boolean;
readonly renderers?: {[nodeType: string]: ReactType};
readonly walker?: NodeWalker;
}
type Renderer<T> = (props: T) => ReactElement<T>;
interface Renderers {
[key: string]: string | Renderer<any>;
}
export var types: NodeType[];
export var renderers: Renderers;
export var uriTransformer: (uri: string) => string;
}
export = ReactMarkdown;