markdown-to-jsx 9.7.16 → 9.8.0
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.
- package/README.md +15 -3
- package/dist/html.cjs +40 -40
- package/dist/html.d.cts +26 -26
- package/dist/html.d.ts +26 -26
- package/dist/html.js +40 -40
- package/dist/html.js.map +5 -5
- package/dist/index.cjs +35 -35
- package/dist/index.d.cts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.js +36 -36
- package/dist/index.js.map +5 -5
- package/dist/markdown.cjs +51 -51
- package/dist/markdown.js +51 -51
- package/dist/markdown.js.map +5 -5
- package/dist/native.cjs +39 -39
- package/dist/native.d.cts +80 -29
- package/dist/native.d.ts +80 -29
- package/dist/native.js +39 -39
- package/dist/native.js.map +5 -5
- package/dist/react.cjs +35 -35
- package/dist/react.d.cts +26 -26
- package/dist/react.d.ts +26 -26
- package/dist/react.js +36 -36
- package/dist/react.js.map +5 -5
- package/dist/solid.cjs +33 -33
- package/dist/solid.d.cts +26 -26
- package/dist/solid.d.ts +26 -26
- package/dist/solid.js +35 -35
- package/dist/solid.js.map +7 -7
- package/dist/vue.cjs +32 -32
- package/dist/vue.d.cts +26 -26
- package/dist/vue.d.ts +26 -26
- package/dist/vue.js +32 -32
- package/dist/vue.js.map +7 -7
- package/package.json +1 -1
package/dist/native.d.cts
CHANGED
|
@@ -92,25 +92,25 @@ type RequireAtLeastOne<
|
|
|
92
92
|
alert?: string;
|
|
93
93
|
/** Child nodes within the blockquote */
|
|
94
94
|
children: MarkdownToJSX.ASTNode[];
|
|
95
|
-
type: typeof
|
|
95
|
+
type: typeof RuleType.blockQuote;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Hard line break node
|
|
99
99
|
*/
|
|
100
100
|
export interface BreakLineNode {
|
|
101
|
-
type: typeof
|
|
101
|
+
type: typeof RuleType.breakLine;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Thematic break (horizontal rule) node
|
|
105
105
|
*/
|
|
106
106
|
export interface BreakThematicNode {
|
|
107
|
-
type: typeof
|
|
107
|
+
type: typeof RuleType.breakThematic;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Code block node (fenced code blocks)
|
|
111
111
|
*/
|
|
112
112
|
export interface CodeBlockNode {
|
|
113
|
-
type: typeof
|
|
113
|
+
type: typeof RuleType.codeBlock;
|
|
114
114
|
/** HTML attributes for the code block */
|
|
115
115
|
attrs?: React.JSX.IntrinsicAttributes;
|
|
116
116
|
/** Programming language identifier */
|
|
@@ -122,7 +122,7 @@ type RequireAtLeastOne<
|
|
|
122
122
|
* Inline code node
|
|
123
123
|
*/
|
|
124
124
|
export interface CodeInlineNode {
|
|
125
|
-
type: typeof
|
|
125
|
+
type: typeof RuleType.codeInline;
|
|
126
126
|
/** Code text */
|
|
127
127
|
text: string;
|
|
128
128
|
}
|
|
@@ -130,13 +130,13 @@ type RequireAtLeastOne<
|
|
|
130
130
|
* Footnote definition node (not rendered, stored in refCollection)
|
|
131
131
|
*/
|
|
132
132
|
export interface FootnoteNode {
|
|
133
|
-
type: typeof
|
|
133
|
+
type: typeof RuleType.footnote;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Footnote reference node
|
|
137
137
|
*/
|
|
138
138
|
export interface FootnoteReferenceNode {
|
|
139
|
-
type: typeof
|
|
139
|
+
type: typeof RuleType.footnoteReference;
|
|
140
140
|
/** Link target (anchor) */
|
|
141
141
|
target: string;
|
|
142
142
|
/** Display text */
|
|
@@ -146,7 +146,7 @@ type RequireAtLeastOne<
|
|
|
146
146
|
* YAML frontmatter node
|
|
147
147
|
*/
|
|
148
148
|
export interface FrontmatterNode {
|
|
149
|
-
type: typeof
|
|
149
|
+
type: typeof RuleType.frontmatter;
|
|
150
150
|
/** Frontmatter content */
|
|
151
151
|
text: string;
|
|
152
152
|
}
|
|
@@ -154,7 +154,7 @@ type RequireAtLeastOne<
|
|
|
154
154
|
* GFM task list item node
|
|
155
155
|
*/
|
|
156
156
|
export interface GFMTaskNode {
|
|
157
|
-
type: typeof
|
|
157
|
+
type: typeof RuleType.gfmTask;
|
|
158
158
|
/** Whether the task is completed */
|
|
159
159
|
completed: boolean;
|
|
160
160
|
}
|
|
@@ -162,7 +162,7 @@ type RequireAtLeastOne<
|
|
|
162
162
|
* Heading node
|
|
163
163
|
*/
|
|
164
164
|
export interface HeadingNode {
|
|
165
|
-
type: typeof
|
|
165
|
+
type: typeof RuleType.heading;
|
|
166
166
|
/** Child nodes (text content) */
|
|
167
167
|
children: MarkdownToJSX.ASTNode[];
|
|
168
168
|
/** Generated HTML ID for anchor linking */
|
|
@@ -174,7 +174,7 @@ type RequireAtLeastOne<
|
|
|
174
174
|
* HTML comment node
|
|
175
175
|
*/
|
|
176
176
|
export interface HTMLCommentNode {
|
|
177
|
-
type: typeof
|
|
177
|
+
type: typeof RuleType.htmlComment;
|
|
178
178
|
/** Comment text */
|
|
179
179
|
text: string;
|
|
180
180
|
}
|
|
@@ -182,7 +182,7 @@ type RequireAtLeastOne<
|
|
|
182
182
|
* Image node
|
|
183
183
|
*/
|
|
184
184
|
export interface ImageNode {
|
|
185
|
-
type: typeof
|
|
185
|
+
type: typeof RuleType.image;
|
|
186
186
|
/** Alt text */
|
|
187
187
|
alt?: string;
|
|
188
188
|
/** Image URL */
|
|
@@ -194,7 +194,7 @@ type RequireAtLeastOne<
|
|
|
194
194
|
* Link node
|
|
195
195
|
*/
|
|
196
196
|
export interface LinkNode {
|
|
197
|
-
type: typeof
|
|
197
|
+
type: typeof RuleType.link;
|
|
198
198
|
/** Child nodes (link text) */
|
|
199
199
|
children: MarkdownToJSX.ASTNode[];
|
|
200
200
|
/** Link URL (null for reference links without definition) */
|
|
@@ -206,7 +206,7 @@ type RequireAtLeastOne<
|
|
|
206
206
|
* Ordered list node
|
|
207
207
|
*/
|
|
208
208
|
export interface OrderedListNode {
|
|
209
|
-
type: typeof
|
|
209
|
+
type: typeof RuleType.orderedList;
|
|
210
210
|
/** Array of list items, each item is an array of nodes */
|
|
211
211
|
items: MarkdownToJSX.ASTNode[][];
|
|
212
212
|
/** Starting number for the list */
|
|
@@ -216,7 +216,7 @@ type RequireAtLeastOne<
|
|
|
216
216
|
* Unordered list node
|
|
217
217
|
*/
|
|
218
218
|
export interface UnorderedListNode {
|
|
219
|
-
type: typeof
|
|
219
|
+
type: typeof RuleType.unorderedList;
|
|
220
220
|
/** Array of list items, each item is an array of nodes */
|
|
221
221
|
items: MarkdownToJSX.ASTNode[][];
|
|
222
222
|
}
|
|
@@ -224,7 +224,7 @@ type RequireAtLeastOne<
|
|
|
224
224
|
* Paragraph node
|
|
225
225
|
*/
|
|
226
226
|
export interface ParagraphNode {
|
|
227
|
-
type: typeof
|
|
227
|
+
type: typeof RuleType.paragraph;
|
|
228
228
|
/** Child nodes */
|
|
229
229
|
children: MarkdownToJSX.ASTNode[];
|
|
230
230
|
}
|
|
@@ -232,13 +232,13 @@ type RequireAtLeastOne<
|
|
|
232
232
|
* Reference definition node (not rendered, stored in refCollection)
|
|
233
233
|
*/
|
|
234
234
|
export interface ReferenceNode {
|
|
235
|
-
type: typeof
|
|
235
|
+
type: typeof RuleType.ref;
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Reference collection node (appears at AST root, includes footnotes with '^' prefix)
|
|
239
239
|
*/
|
|
240
240
|
export interface ReferenceCollectionNode {
|
|
241
|
-
type: typeof
|
|
241
|
+
type: typeof RuleType.refCollection;
|
|
242
242
|
/** Map of reference labels to their definitions */
|
|
243
243
|
refs: {
|
|
244
244
|
[key: string]: {
|
|
@@ -251,7 +251,7 @@ type RequireAtLeastOne<
|
|
|
251
251
|
* Table node
|
|
252
252
|
*/
|
|
253
253
|
export interface TableNode {
|
|
254
|
-
type: typeof
|
|
254
|
+
type: typeof RuleType.table;
|
|
255
255
|
/**
|
|
256
256
|
* alignment for each table column
|
|
257
257
|
*/
|
|
@@ -265,7 +265,7 @@ type RequireAtLeastOne<
|
|
|
265
265
|
* Plain text node
|
|
266
266
|
*/
|
|
267
267
|
export interface TextNode {
|
|
268
|
-
type: typeof
|
|
268
|
+
type: typeof RuleType.text;
|
|
269
269
|
/** Text content */
|
|
270
270
|
text: string;
|
|
271
271
|
}
|
|
@@ -273,7 +273,7 @@ type RequireAtLeastOne<
|
|
|
273
273
|
* Formatted text node (bold, italic, etc.)
|
|
274
274
|
*/
|
|
275
275
|
export interface FormattedTextNode {
|
|
276
|
-
type: typeof
|
|
276
|
+
type: typeof RuleType.textFormatted;
|
|
277
277
|
/**
|
|
278
278
|
* the corresponding html tag
|
|
279
279
|
*/
|
|
@@ -287,7 +287,7 @@ type RequireAtLeastOne<
|
|
|
287
287
|
* HTML block node (includes JSX components)
|
|
288
288
|
*/
|
|
289
289
|
export interface HTMLNode {
|
|
290
|
-
type: typeof
|
|
290
|
+
type: typeof RuleType.htmlBlock;
|
|
291
291
|
/** Parsed HTML attributes */
|
|
292
292
|
attrs?: Record<string, any>;
|
|
293
293
|
/** Parsed child nodes (always parsed, even for verbatim blocks) */
|
|
@@ -309,7 +309,7 @@ type RequireAtLeastOne<
|
|
|
309
309
|
* Self-closing HTML tag node
|
|
310
310
|
*/
|
|
311
311
|
export interface HTMLSelfClosingNode {
|
|
312
|
-
type: typeof
|
|
312
|
+
type: typeof RuleType.htmlSelfClosing;
|
|
313
313
|
/** Parsed HTML attributes */
|
|
314
314
|
attrs?: Record<string, any>;
|
|
315
315
|
/** @internal Whether this is a closing tag */
|
|
@@ -503,8 +503,8 @@ type RequireAtLeastOne<
|
|
|
503
503
|
optimizeForStreaming?: boolean;
|
|
504
504
|
}>;
|
|
505
505
|
}
|
|
506
|
-
declare const
|
|
507
|
-
type
|
|
506
|
+
declare const RuleType: typeof RuleTypeConst;
|
|
507
|
+
type RuleType = RuleTypeValue;
|
|
508
508
|
/**
|
|
509
509
|
* Main parser entry point - matches original parser interface
|
|
510
510
|
*/
|
|
@@ -533,9 +533,60 @@ declare function slugify(str: string): string;
|
|
|
533
533
|
*/
|
|
534
534
|
declare const MarkdownContext: React2.Context<NativeOptions | undefined>;
|
|
535
535
|
/**
|
|
536
|
+
* Per-key style map for React Native rendering. Each key is narrowed to the
|
|
537
|
+
* style type accepted by the component it targets — Text styles for inline /
|
|
538
|
+
* text content, View styles for block containers, ImageStyle for images.
|
|
539
|
+
*/
|
|
540
|
+
interface NativeStyles {
|
|
541
|
+
text?: StyleProp<TextStyle>;
|
|
542
|
+
paragraph?: StyleProp<TextStyle>;
|
|
543
|
+
heading1?: StyleProp<TextStyle>;
|
|
544
|
+
heading2?: StyleProp<TextStyle>;
|
|
545
|
+
heading3?: StyleProp<TextStyle>;
|
|
546
|
+
heading4?: StyleProp<TextStyle>;
|
|
547
|
+
heading5?: StyleProp<TextStyle>;
|
|
548
|
+
heading6?: StyleProp<TextStyle>;
|
|
549
|
+
link?: StyleProp<TextStyle>;
|
|
550
|
+
image?: StyleProp<ImageStyle>;
|
|
551
|
+
codeBlock?: StyleProp<ViewStyle>;
|
|
552
|
+
codeInline?: StyleProp<TextStyle>;
|
|
553
|
+
blockquote?: StyleProp<ViewStyle>;
|
|
554
|
+
listOrdered?: StyleProp<ViewStyle>;
|
|
555
|
+
listUnordered?: StyleProp<ViewStyle>;
|
|
556
|
+
listItem?: StyleProp<ViewStyle>;
|
|
557
|
+
listItemBullet?: StyleProp<TextStyle>;
|
|
558
|
+
listItemNumber?: StyleProp<TextStyle>;
|
|
559
|
+
thematicBreak?: StyleProp<ViewStyle>;
|
|
560
|
+
table?: StyleProp<ViewStyle>;
|
|
561
|
+
tableHeader?: StyleProp<ViewStyle>;
|
|
562
|
+
tableHeaderCell?: StyleProp<ViewStyle>;
|
|
563
|
+
tableRow?: StyleProp<ViewStyle>;
|
|
564
|
+
tableCell?: StyleProp<ViewStyle>;
|
|
565
|
+
em?: StyleProp<TextStyle>;
|
|
566
|
+
strong?: StyleProp<TextStyle>;
|
|
567
|
+
del?: StyleProp<TextStyle>;
|
|
568
|
+
mark?: StyleProp<TextStyle>;
|
|
569
|
+
gfmTask?: StyleProp<ViewStyle>;
|
|
570
|
+
div?: StyleProp<ViewStyle>;
|
|
571
|
+
section?: StyleProp<ViewStyle>;
|
|
572
|
+
article?: StyleProp<ViewStyle>;
|
|
573
|
+
aside?: StyleProp<ViewStyle>;
|
|
574
|
+
header?: StyleProp<ViewStyle>;
|
|
575
|
+
footer?: StyleProp<ViewStyle>;
|
|
576
|
+
main?: StyleProp<ViewStyle>;
|
|
577
|
+
nav?: StyleProp<ViewStyle>;
|
|
578
|
+
figure?: StyleProp<ViewStyle>;
|
|
579
|
+
figcaption?: StyleProp<ViewStyle>;
|
|
580
|
+
ul?: StyleProp<ViewStyle>;
|
|
581
|
+
ol?: StyleProp<ViewStyle>;
|
|
582
|
+
li?: StyleProp<ViewStyle>;
|
|
583
|
+
th?: StyleProp<ViewStyle>;
|
|
584
|
+
td?: StyleProp<ViewStyle>;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
536
587
|
* Style keys for React Native components
|
|
537
588
|
*/
|
|
538
|
-
type NativeStyleKey =
|
|
589
|
+
type NativeStyleKey = keyof NativeStyles;
|
|
539
590
|
/**
|
|
540
591
|
* React Native compiler options
|
|
541
592
|
*/
|
|
@@ -545,7 +596,7 @@ type NativeOptions = Omit<MarkdownToJSX.Options, "wrapperProps"> & {
|
|
|
545
596
|
/** Handler for link long press events */
|
|
546
597
|
onLinkLongPress?: (url: string, title?: string) => void;
|
|
547
598
|
/** Style overrides for React Native components */
|
|
548
|
-
styles?:
|
|
599
|
+
styles?: NativeStyles;
|
|
549
600
|
/** Props for wrapper component (View or Text) */
|
|
550
601
|
wrapperProps?: ViewProps | TextProps;
|
|
551
602
|
};
|
|
@@ -584,7 +635,7 @@ declare const MarkdownProvider: React2.FC<{
|
|
|
584
635
|
* @param props - Additional View props
|
|
585
636
|
*/
|
|
586
637
|
declare const Markdown: React2.FC<Omit<ViewProps, "children"> & {
|
|
587
|
-
children?: string | null;
|
|
638
|
+
children?: string | string[] | null;
|
|
588
639
|
options?: NativeOptions;
|
|
589
640
|
}>;
|
|
590
|
-
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative,
|
|
641
|
+
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative, RuleType, NativeStyles, NativeStyleKey, NativeOptions, MarkdownToJSX, MarkdownProvider, MarkdownContext, Markdown };
|
package/dist/native.d.ts
CHANGED
|
@@ -92,25 +92,25 @@ type RequireAtLeastOne<
|
|
|
92
92
|
alert?: string;
|
|
93
93
|
/** Child nodes within the blockquote */
|
|
94
94
|
children: MarkdownToJSX.ASTNode[];
|
|
95
|
-
type: typeof
|
|
95
|
+
type: typeof RuleType.blockQuote;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Hard line break node
|
|
99
99
|
*/
|
|
100
100
|
export interface BreakLineNode {
|
|
101
|
-
type: typeof
|
|
101
|
+
type: typeof RuleType.breakLine;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Thematic break (horizontal rule) node
|
|
105
105
|
*/
|
|
106
106
|
export interface BreakThematicNode {
|
|
107
|
-
type: typeof
|
|
107
|
+
type: typeof RuleType.breakThematic;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Code block node (fenced code blocks)
|
|
111
111
|
*/
|
|
112
112
|
export interface CodeBlockNode {
|
|
113
|
-
type: typeof
|
|
113
|
+
type: typeof RuleType.codeBlock;
|
|
114
114
|
/** HTML attributes for the code block */
|
|
115
115
|
attrs?: React.JSX.IntrinsicAttributes;
|
|
116
116
|
/** Programming language identifier */
|
|
@@ -122,7 +122,7 @@ type RequireAtLeastOne<
|
|
|
122
122
|
* Inline code node
|
|
123
123
|
*/
|
|
124
124
|
export interface CodeInlineNode {
|
|
125
|
-
type: typeof
|
|
125
|
+
type: typeof RuleType.codeInline;
|
|
126
126
|
/** Code text */
|
|
127
127
|
text: string;
|
|
128
128
|
}
|
|
@@ -130,13 +130,13 @@ type RequireAtLeastOne<
|
|
|
130
130
|
* Footnote definition node (not rendered, stored in refCollection)
|
|
131
131
|
*/
|
|
132
132
|
export interface FootnoteNode {
|
|
133
|
-
type: typeof
|
|
133
|
+
type: typeof RuleType.footnote;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Footnote reference node
|
|
137
137
|
*/
|
|
138
138
|
export interface FootnoteReferenceNode {
|
|
139
|
-
type: typeof
|
|
139
|
+
type: typeof RuleType.footnoteReference;
|
|
140
140
|
/** Link target (anchor) */
|
|
141
141
|
target: string;
|
|
142
142
|
/** Display text */
|
|
@@ -146,7 +146,7 @@ type RequireAtLeastOne<
|
|
|
146
146
|
* YAML frontmatter node
|
|
147
147
|
*/
|
|
148
148
|
export interface FrontmatterNode {
|
|
149
|
-
type: typeof
|
|
149
|
+
type: typeof RuleType.frontmatter;
|
|
150
150
|
/** Frontmatter content */
|
|
151
151
|
text: string;
|
|
152
152
|
}
|
|
@@ -154,7 +154,7 @@ type RequireAtLeastOne<
|
|
|
154
154
|
* GFM task list item node
|
|
155
155
|
*/
|
|
156
156
|
export interface GFMTaskNode {
|
|
157
|
-
type: typeof
|
|
157
|
+
type: typeof RuleType.gfmTask;
|
|
158
158
|
/** Whether the task is completed */
|
|
159
159
|
completed: boolean;
|
|
160
160
|
}
|
|
@@ -162,7 +162,7 @@ type RequireAtLeastOne<
|
|
|
162
162
|
* Heading node
|
|
163
163
|
*/
|
|
164
164
|
export interface HeadingNode {
|
|
165
|
-
type: typeof
|
|
165
|
+
type: typeof RuleType.heading;
|
|
166
166
|
/** Child nodes (text content) */
|
|
167
167
|
children: MarkdownToJSX.ASTNode[];
|
|
168
168
|
/** Generated HTML ID for anchor linking */
|
|
@@ -174,7 +174,7 @@ type RequireAtLeastOne<
|
|
|
174
174
|
* HTML comment node
|
|
175
175
|
*/
|
|
176
176
|
export interface HTMLCommentNode {
|
|
177
|
-
type: typeof
|
|
177
|
+
type: typeof RuleType.htmlComment;
|
|
178
178
|
/** Comment text */
|
|
179
179
|
text: string;
|
|
180
180
|
}
|
|
@@ -182,7 +182,7 @@ type RequireAtLeastOne<
|
|
|
182
182
|
* Image node
|
|
183
183
|
*/
|
|
184
184
|
export interface ImageNode {
|
|
185
|
-
type: typeof
|
|
185
|
+
type: typeof RuleType.image;
|
|
186
186
|
/** Alt text */
|
|
187
187
|
alt?: string;
|
|
188
188
|
/** Image URL */
|
|
@@ -194,7 +194,7 @@ type RequireAtLeastOne<
|
|
|
194
194
|
* Link node
|
|
195
195
|
*/
|
|
196
196
|
export interface LinkNode {
|
|
197
|
-
type: typeof
|
|
197
|
+
type: typeof RuleType.link;
|
|
198
198
|
/** Child nodes (link text) */
|
|
199
199
|
children: MarkdownToJSX.ASTNode[];
|
|
200
200
|
/** Link URL (null for reference links without definition) */
|
|
@@ -206,7 +206,7 @@ type RequireAtLeastOne<
|
|
|
206
206
|
* Ordered list node
|
|
207
207
|
*/
|
|
208
208
|
export interface OrderedListNode {
|
|
209
|
-
type: typeof
|
|
209
|
+
type: typeof RuleType.orderedList;
|
|
210
210
|
/** Array of list items, each item is an array of nodes */
|
|
211
211
|
items: MarkdownToJSX.ASTNode[][];
|
|
212
212
|
/** Starting number for the list */
|
|
@@ -216,7 +216,7 @@ type RequireAtLeastOne<
|
|
|
216
216
|
* Unordered list node
|
|
217
217
|
*/
|
|
218
218
|
export interface UnorderedListNode {
|
|
219
|
-
type: typeof
|
|
219
|
+
type: typeof RuleType.unorderedList;
|
|
220
220
|
/** Array of list items, each item is an array of nodes */
|
|
221
221
|
items: MarkdownToJSX.ASTNode[][];
|
|
222
222
|
}
|
|
@@ -224,7 +224,7 @@ type RequireAtLeastOne<
|
|
|
224
224
|
* Paragraph node
|
|
225
225
|
*/
|
|
226
226
|
export interface ParagraphNode {
|
|
227
|
-
type: typeof
|
|
227
|
+
type: typeof RuleType.paragraph;
|
|
228
228
|
/** Child nodes */
|
|
229
229
|
children: MarkdownToJSX.ASTNode[];
|
|
230
230
|
}
|
|
@@ -232,13 +232,13 @@ type RequireAtLeastOne<
|
|
|
232
232
|
* Reference definition node (not rendered, stored in refCollection)
|
|
233
233
|
*/
|
|
234
234
|
export interface ReferenceNode {
|
|
235
|
-
type: typeof
|
|
235
|
+
type: typeof RuleType.ref;
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Reference collection node (appears at AST root, includes footnotes with '^' prefix)
|
|
239
239
|
*/
|
|
240
240
|
export interface ReferenceCollectionNode {
|
|
241
|
-
type: typeof
|
|
241
|
+
type: typeof RuleType.refCollection;
|
|
242
242
|
/** Map of reference labels to their definitions */
|
|
243
243
|
refs: {
|
|
244
244
|
[key: string]: {
|
|
@@ -251,7 +251,7 @@ type RequireAtLeastOne<
|
|
|
251
251
|
* Table node
|
|
252
252
|
*/
|
|
253
253
|
export interface TableNode {
|
|
254
|
-
type: typeof
|
|
254
|
+
type: typeof RuleType.table;
|
|
255
255
|
/**
|
|
256
256
|
* alignment for each table column
|
|
257
257
|
*/
|
|
@@ -265,7 +265,7 @@ type RequireAtLeastOne<
|
|
|
265
265
|
* Plain text node
|
|
266
266
|
*/
|
|
267
267
|
export interface TextNode {
|
|
268
|
-
type: typeof
|
|
268
|
+
type: typeof RuleType.text;
|
|
269
269
|
/** Text content */
|
|
270
270
|
text: string;
|
|
271
271
|
}
|
|
@@ -273,7 +273,7 @@ type RequireAtLeastOne<
|
|
|
273
273
|
* Formatted text node (bold, italic, etc.)
|
|
274
274
|
*/
|
|
275
275
|
export interface FormattedTextNode {
|
|
276
|
-
type: typeof
|
|
276
|
+
type: typeof RuleType.textFormatted;
|
|
277
277
|
/**
|
|
278
278
|
* the corresponding html tag
|
|
279
279
|
*/
|
|
@@ -287,7 +287,7 @@ type RequireAtLeastOne<
|
|
|
287
287
|
* HTML block node (includes JSX components)
|
|
288
288
|
*/
|
|
289
289
|
export interface HTMLNode {
|
|
290
|
-
type: typeof
|
|
290
|
+
type: typeof RuleType.htmlBlock;
|
|
291
291
|
/** Parsed HTML attributes */
|
|
292
292
|
attrs?: Record<string, any>;
|
|
293
293
|
/** Parsed child nodes (always parsed, even for verbatim blocks) */
|
|
@@ -309,7 +309,7 @@ type RequireAtLeastOne<
|
|
|
309
309
|
* Self-closing HTML tag node
|
|
310
310
|
*/
|
|
311
311
|
export interface HTMLSelfClosingNode {
|
|
312
|
-
type: typeof
|
|
312
|
+
type: typeof RuleType.htmlSelfClosing;
|
|
313
313
|
/** Parsed HTML attributes */
|
|
314
314
|
attrs?: Record<string, any>;
|
|
315
315
|
/** @internal Whether this is a closing tag */
|
|
@@ -503,8 +503,8 @@ type RequireAtLeastOne<
|
|
|
503
503
|
optimizeForStreaming?: boolean;
|
|
504
504
|
}>;
|
|
505
505
|
}
|
|
506
|
-
declare const
|
|
507
|
-
type
|
|
506
|
+
declare const RuleType: typeof RuleTypeConst;
|
|
507
|
+
type RuleType = RuleTypeValue;
|
|
508
508
|
/**
|
|
509
509
|
* Main parser entry point - matches original parser interface
|
|
510
510
|
*/
|
|
@@ -533,9 +533,60 @@ declare function slugify(str: string): string;
|
|
|
533
533
|
*/
|
|
534
534
|
declare const MarkdownContext: React2.Context<NativeOptions | undefined>;
|
|
535
535
|
/**
|
|
536
|
+
* Per-key style map for React Native rendering. Each key is narrowed to the
|
|
537
|
+
* style type accepted by the component it targets — Text styles for inline /
|
|
538
|
+
* text content, View styles for block containers, ImageStyle for images.
|
|
539
|
+
*/
|
|
540
|
+
interface NativeStyles {
|
|
541
|
+
text?: StyleProp<TextStyle>;
|
|
542
|
+
paragraph?: StyleProp<TextStyle>;
|
|
543
|
+
heading1?: StyleProp<TextStyle>;
|
|
544
|
+
heading2?: StyleProp<TextStyle>;
|
|
545
|
+
heading3?: StyleProp<TextStyle>;
|
|
546
|
+
heading4?: StyleProp<TextStyle>;
|
|
547
|
+
heading5?: StyleProp<TextStyle>;
|
|
548
|
+
heading6?: StyleProp<TextStyle>;
|
|
549
|
+
link?: StyleProp<TextStyle>;
|
|
550
|
+
image?: StyleProp<ImageStyle>;
|
|
551
|
+
codeBlock?: StyleProp<ViewStyle>;
|
|
552
|
+
codeInline?: StyleProp<TextStyle>;
|
|
553
|
+
blockquote?: StyleProp<ViewStyle>;
|
|
554
|
+
listOrdered?: StyleProp<ViewStyle>;
|
|
555
|
+
listUnordered?: StyleProp<ViewStyle>;
|
|
556
|
+
listItem?: StyleProp<ViewStyle>;
|
|
557
|
+
listItemBullet?: StyleProp<TextStyle>;
|
|
558
|
+
listItemNumber?: StyleProp<TextStyle>;
|
|
559
|
+
thematicBreak?: StyleProp<ViewStyle>;
|
|
560
|
+
table?: StyleProp<ViewStyle>;
|
|
561
|
+
tableHeader?: StyleProp<ViewStyle>;
|
|
562
|
+
tableHeaderCell?: StyleProp<ViewStyle>;
|
|
563
|
+
tableRow?: StyleProp<ViewStyle>;
|
|
564
|
+
tableCell?: StyleProp<ViewStyle>;
|
|
565
|
+
em?: StyleProp<TextStyle>;
|
|
566
|
+
strong?: StyleProp<TextStyle>;
|
|
567
|
+
del?: StyleProp<TextStyle>;
|
|
568
|
+
mark?: StyleProp<TextStyle>;
|
|
569
|
+
gfmTask?: StyleProp<ViewStyle>;
|
|
570
|
+
div?: StyleProp<ViewStyle>;
|
|
571
|
+
section?: StyleProp<ViewStyle>;
|
|
572
|
+
article?: StyleProp<ViewStyle>;
|
|
573
|
+
aside?: StyleProp<ViewStyle>;
|
|
574
|
+
header?: StyleProp<ViewStyle>;
|
|
575
|
+
footer?: StyleProp<ViewStyle>;
|
|
576
|
+
main?: StyleProp<ViewStyle>;
|
|
577
|
+
nav?: StyleProp<ViewStyle>;
|
|
578
|
+
figure?: StyleProp<ViewStyle>;
|
|
579
|
+
figcaption?: StyleProp<ViewStyle>;
|
|
580
|
+
ul?: StyleProp<ViewStyle>;
|
|
581
|
+
ol?: StyleProp<ViewStyle>;
|
|
582
|
+
li?: StyleProp<ViewStyle>;
|
|
583
|
+
th?: StyleProp<ViewStyle>;
|
|
584
|
+
td?: StyleProp<ViewStyle>;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
536
587
|
* Style keys for React Native components
|
|
537
588
|
*/
|
|
538
|
-
type NativeStyleKey =
|
|
589
|
+
type NativeStyleKey = keyof NativeStyles;
|
|
539
590
|
/**
|
|
540
591
|
* React Native compiler options
|
|
541
592
|
*/
|
|
@@ -545,7 +596,7 @@ type NativeOptions = Omit<MarkdownToJSX.Options, "wrapperProps"> & {
|
|
|
545
596
|
/** Handler for link long press events */
|
|
546
597
|
onLinkLongPress?: (url: string, title?: string) => void;
|
|
547
598
|
/** Style overrides for React Native components */
|
|
548
|
-
styles?:
|
|
599
|
+
styles?: NativeStyles;
|
|
549
600
|
/** Props for wrapper component (View or Text) */
|
|
550
601
|
wrapperProps?: ViewProps | TextProps;
|
|
551
602
|
};
|
|
@@ -584,7 +635,7 @@ declare const MarkdownProvider: React2.FC<{
|
|
|
584
635
|
* @param props - Additional View props
|
|
585
636
|
*/
|
|
586
637
|
declare const Markdown: React2.FC<Omit<ViewProps, "children"> & {
|
|
587
|
-
children?: string | null;
|
|
638
|
+
children?: string | string[] | null;
|
|
588
639
|
options?: NativeOptions;
|
|
589
640
|
}>;
|
|
590
|
-
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative,
|
|
641
|
+
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative, RuleType, NativeStyles, NativeStyleKey, NativeOptions, MarkdownToJSX, MarkdownProvider, MarkdownContext, Markdown };
|