@khanacademy/simple-markdown 0.9.4 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,267 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { Capture, MatchFunction, State } from "./troublesome-types";
8
- import * as React from "react";
9
- declare type Attr = string | number | boolean | null | void;
10
- declare type SingleASTNode = {
11
- type: string,
12
- [key: string]: any,
13
- };
14
- declare type UnTypedASTNode = {
15
- [key: string]: any,
16
- };
17
- declare type ASTNode = SingleASTNode | Array<SingleASTNode>;
18
- declare type ReactElement = React.Element<any>;
19
- declare type ReactElements = React.Node;
20
- declare type Parser = (
21
- source: string,
22
- state?: State | null | void
23
- ) => Array<SingleASTNode>;
24
- declare type ParseFunction = (
25
- capture: Capture,
26
- nestedParse: Parser,
27
- state: State
28
- ) => UnTypedASTNode | ASTNode;
29
- declare type SingleNodeParseFunction = (
30
- capture: Capture,
31
- nestedParse: Parser,
32
- state: State
33
- ) => UnTypedASTNode;
34
- declare type Output<Result> = (
35
- node: ASTNode,
36
- state?: State | null | void
37
- ) => Result;
38
- declare type NodeOutput<Result> = (
39
- node: SingleASTNode,
40
- nestedOutput: Output<Result>,
41
- state: State
42
- ) => Result;
43
- declare type ArrayNodeOutput<Result> = (
44
- node: Array<SingleASTNode>,
45
- nestedOutput: Output<Result>,
46
- state: State
47
- ) => Result;
48
- declare type ReactOutput = Output<ReactElements>;
49
- declare type ReactNodeOutput = NodeOutput<ReactElements>;
50
- declare type HtmlOutput = Output<string>;
51
- declare type HtmlNodeOutput = NodeOutput<string>;
52
- declare type ParserRule = {|
53
- +order: number,
54
- +match: MatchFunction,
55
- +quality?: (capture: Capture, state: State, prevCapture: string) => number,
56
- +parse: ParseFunction,
57
- |};
58
- declare type SingleNodeParserRule = {|
59
- +order: number,
60
- +match: MatchFunction,
61
- +quality?: (capture: Capture, state: State, prevCapture: string) => number,
62
- +parse: SingleNodeParseFunction,
63
- |};
64
- declare type ReactOutputRule = {|
65
- +react: ReactNodeOutput | null,
66
- |};
67
- declare type HtmlOutputRule = {|
68
- +html: HtmlNodeOutput | null,
69
- |};
70
- declare type ArrayRule = {
71
- +react?: ArrayNodeOutput<ReactElements>,
72
- +html?: ArrayNodeOutput<string>,
73
- +[key: string]: ArrayNodeOutput<any>,
74
- };
75
- declare type ParserRules = {
76
- +Array?: ArrayRule,
77
- +[type: string]: ParserRule,
78
- };
79
- declare type OutputRules<Rule> = {
80
- +Array?: ArrayRule,
81
- +[type: string]: Rule,
82
- };
83
- declare type Rules<OutputRule> = {
84
- +Array?: ArrayRule,
85
- +[type: string]: {| ...ParserRule, ...OutputRule |},
86
- };
87
- declare type ReactRules = {
88
- +Array?: {|
89
- +react: ArrayNodeOutput<ReactElements>,
90
- |},
91
- +[type: string]: {| ...ParserRule, ...ReactOutputRule |},
92
- };
93
- declare type HtmlRules = {
94
- +Array?: {|
95
- +html: ArrayNodeOutput<string>,
96
- |},
97
- +[type: string]: {| ...ParserRule, ...HtmlOutputRule |},
98
- };
99
- declare type NonNullReactOutputRule = {|
100
- +react: ReactNodeOutput,
101
- |};
102
- declare type ElementReactOutputRule = {|
103
- +react: NodeOutput<ReactElement>,
104
- |};
105
- declare type TextReactOutputRule = {|
106
- +react: NodeOutput<string>,
107
- |};
108
- declare type NonNullHtmlOutputRule = {|
109
- +html: HtmlNodeOutput,
110
- |};
111
- declare type DefaultInRule = {|
112
- ...SingleNodeParserRule,
113
- ...ReactOutputRule,
114
- ...HtmlOutputRule,
115
- |};
116
- declare type TextInOutRule = {|
117
- ...SingleNodeParserRule,
118
- ...TextReactOutputRule,
119
- ...NonNullHtmlOutputRule,
120
- |};
121
- declare type LenientInOutRule = {|
122
- ...SingleNodeParserRule,
123
- ...NonNullReactOutputRule,
124
- ...NonNullHtmlOutputRule,
125
- |};
126
- declare type DefaultInOutRule = {|
127
- ...SingleNodeParserRule,
128
- ...ElementReactOutputRule,
129
- ...NonNullHtmlOutputRule,
130
- |};
131
- declare type DefaultRules = {|
132
- +Array: {|
133
- +react: ArrayNodeOutput<ReactElements>,
134
- +html: ArrayNodeOutput<string>,
135
- |},
136
- +heading: DefaultInOutRule,
137
- +nptable: DefaultInRule,
138
- +lheading: DefaultInRule,
139
- +hr: DefaultInOutRule,
140
- +codeBlock: DefaultInOutRule,
141
- +fence: DefaultInRule,
142
- +blockQuote: DefaultInOutRule,
143
- +list: DefaultInOutRule,
144
- +def: LenientInOutRule,
145
- +table: DefaultInOutRule,
146
- +tableSeparator: DefaultInRule,
147
- +newline: TextInOutRule,
148
- +paragraph: DefaultInOutRule,
149
- +escape: DefaultInRule,
150
- +autolink: DefaultInRule,
151
- +mailto: DefaultInRule,
152
- +url: DefaultInRule,
153
- +link: DefaultInOutRule,
154
- +image: DefaultInOutRule,
155
- +reflink: DefaultInRule,
156
- +refimage: DefaultInRule,
157
- +em: DefaultInOutRule,
158
- +strong: DefaultInOutRule,
159
- +u: DefaultInOutRule,
160
- +del: DefaultInOutRule,
161
- +inlineCode: DefaultInOutRule,
162
- +br: DefaultInOutRule,
163
- +text: TextInOutRule,
164
- |};
165
- declare type Exports = {|
166
- +defaultRules: DefaultRules,
167
- +parserFor: (
168
- rules: ParserRules,
169
- defaultState?: State | null | void
170
- ) => Parser,
171
- +outputFor: <Rule>(
172
- rules: OutputRules<Rule>,
173
- param: $Keys<Rule>,
174
- defaultState?: State | null | void
175
- ) => Output<any>,
176
- +ruleOutput: <Rule>(
177
- rules: OutputRules<Rule>,
178
- param: $Keys<Rule>
179
- ) => NodeOutput<any>,
180
- +reactFor: (arg1: ReactNodeOutput) => ReactOutput,
181
- +htmlFor: (arg1: HtmlNodeOutput) => HtmlOutput,
182
- +inlineRegex: (regex: RegExp) => MatchFunction,
183
- +blockRegex: (regex: RegExp) => MatchFunction,
184
- +anyScopeRegex: (regex: RegExp) => MatchFunction,
185
- +parseInline: (parse: Parser, content: string, state: State) => ASTNode,
186
- +parseBlock: (parse: Parser, content: string, state: State) => ASTNode,
187
- +markdownToReact: (
188
- source: string,
189
- state?: State | null | void
190
- ) => ReactElements,
191
- +markdownToHtml: (source: string, state?: State | null | void) => string,
192
- +ReactMarkdown: (props: {
193
- source: string,
194
- [key: string]: any,
195
- }) => ReactElement,
196
- +defaultRawParse: (
197
- source: string,
198
- state?: State | null | void
199
- ) => Array<SingleASTNode>,
200
- +defaultBlockParse: (
201
- source: string,
202
- state?: State | null | void
203
- ) => Array<SingleASTNode>,
204
- +defaultInlineParse: (
205
- source: string,
206
- state?: State | null | void
207
- ) => Array<SingleASTNode>,
208
- +defaultImplicitParse: (
209
- source: string,
210
- state?: State | null | void
211
- ) => Array<SingleASTNode>,
212
- +defaultReactOutput: ReactOutput,
213
- +defaultHtmlOutput: HtmlOutput,
214
- +preprocess: (source: string) => string,
215
- +sanitizeText: (text: Attr) => string,
216
- +sanitizeUrl: (url?: string | null | void) => string | null | void,
217
- +unescapeUrl: (url: string) => string,
218
- +htmlTag: (
219
- tagName: string,
220
- content: string,
221
- attributes?: $Rest<{ [key: any]: Attr | null | void }, {}> | null | void,
222
- isClosed?: boolean | null | void
223
- ) => string,
224
- +reactElement: (
225
- type: string,
226
- key: string | null,
227
- props: {
228
- [key: string]: any,
229
- }
230
- ) => ReactElement,
231
-
232
- /**
233
- * defaultParse is deprecated, please use `defaultImplicitParse`
234
- * @deprecated
235
- */
236
- +defaultParse: (...args: any[]) => any,
237
-
238
- /**
239
- * defaultOutput is deprecated, please use `defaultReactOutput`
240
- * @deprecated
241
- */
242
- +defaultOutput: (...args: any[]) => any,
243
- |};
244
- export type {
245
- State,
246
- Parser,
247
- Output,
248
- ReactOutput,
249
- HtmlOutput,
250
- Capture,
251
- MatchFunction,
252
- ParseFunction,
253
- NodeOutput,
254
- ArrayNodeOutput,
255
- ReactNodeOutput,
256
- ParserRule,
257
- ReactOutputRule,
258
- HtmlOutputRule,
259
- ParserRules,
260
- OutputRules,
261
- Rules,
262
- ReactRules,
263
- HtmlRules,
264
- SingleASTNode,
265
- };
266
- declare var SimpleMarkdown: Exports;
267
- declare export default typeof SimpleMarkdown;
@@ -1,22 +0,0 @@
1
- // @flow
2
- export type Capture =
3
- | (Array<string> & {
4
- index: number,
5
- })
6
- | (Array<string> & {
7
- index?: number,
8
- });
9
-
10
- export type State = {
11
- key?: string | number | undefined,
12
- inline?: boolean | null | undefined,
13
- [key: string]: any,
14
- };
15
-
16
- export type MatchFunction = {
17
- regex?: RegExp,
18
- } & ((
19
- source: string,
20
- state: State,
21
- prevCapture: string,
22
- ) => Capture | null | undefined);
@@ -1,22 +0,0 @@
1
- // @flow
2
- export type Capture =
3
- | (Array<string> & {
4
- index: number,
5
- })
6
- | (Array<string> & {
7
- index?: number,
8
- });
9
-
10
- export type State = {
11
- key?: string | number | undefined,
12
- inline?: boolean | null | undefined,
13
- [key: string]: any,
14
- };
15
-
16
- export type MatchFunction = {
17
- regex?: RegExp,
18
- } & ((
19
- source: string,
20
- state: State,
21
- prevCapture: string,
22
- ) => Capture | null | undefined);