markdown-to-jsx 9.7.16 → 9.8.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.
package/dist/index.d.cts CHANGED
@@ -82,6 +82,8 @@ type RequireAtLeastOne<
82
82
  _htmlDepth?: number;
83
83
  /** internal: set by collectReferenceDefinitions when input ends inside an unclosed fence */
84
84
  _endsInsideFence?: boolean;
85
+ /** internal: smallest bare-URL start position known to fail by reaching end-of-input (issue #874); scoped per parseInline call */
86
+ _inlineUrlFailFrom?: number;
85
87
  };
86
88
  /**
87
89
  * Blockquote node in the AST
@@ -91,25 +93,25 @@ type RequireAtLeastOne<
91
93
  alert?: string;
92
94
  /** Child nodes within the blockquote */
93
95
  children: MarkdownToJSX.ASTNode[];
94
- type: typeof RuleType2.blockQuote;
96
+ type: typeof RuleType.blockQuote;
95
97
  }
96
98
  /**
97
99
  * Hard line break node
98
100
  */
99
101
  export interface BreakLineNode {
100
- type: typeof RuleType2.breakLine;
102
+ type: typeof RuleType.breakLine;
101
103
  }
102
104
  /**
103
105
  * Thematic break (horizontal rule) node
104
106
  */
105
107
  export interface BreakThematicNode {
106
- type: typeof RuleType2.breakThematic;
108
+ type: typeof RuleType.breakThematic;
107
109
  }
108
110
  /**
109
111
  * Code block node (fenced code blocks)
110
112
  */
111
113
  export interface CodeBlockNode {
112
- type: typeof RuleType2.codeBlock;
114
+ type: typeof RuleType.codeBlock;
113
115
  /** HTML attributes for the code block */
114
116
  attrs?: React.JSX.IntrinsicAttributes;
115
117
  /** Programming language identifier */
@@ -121,7 +123,7 @@ type RequireAtLeastOne<
121
123
  * Inline code node
122
124
  */
123
125
  export interface CodeInlineNode {
124
- type: typeof RuleType2.codeInline;
126
+ type: typeof RuleType.codeInline;
125
127
  /** Code text */
126
128
  text: string;
127
129
  }
@@ -129,13 +131,13 @@ type RequireAtLeastOne<
129
131
  * Footnote definition node (not rendered, stored in refCollection)
130
132
  */
131
133
  export interface FootnoteNode {
132
- type: typeof RuleType2.footnote;
134
+ type: typeof RuleType.footnote;
133
135
  }
134
136
  /**
135
137
  * Footnote reference node
136
138
  */
137
139
  export interface FootnoteReferenceNode {
138
- type: typeof RuleType2.footnoteReference;
140
+ type: typeof RuleType.footnoteReference;
139
141
  /** Link target (anchor) */
140
142
  target: string;
141
143
  /** Display text */
@@ -145,7 +147,7 @@ type RequireAtLeastOne<
145
147
  * YAML frontmatter node
146
148
  */
147
149
  export interface FrontmatterNode {
148
- type: typeof RuleType2.frontmatter;
150
+ type: typeof RuleType.frontmatter;
149
151
  /** Frontmatter content */
150
152
  text: string;
151
153
  }
@@ -153,7 +155,7 @@ type RequireAtLeastOne<
153
155
  * GFM task list item node
154
156
  */
155
157
  export interface GFMTaskNode {
156
- type: typeof RuleType2.gfmTask;
158
+ type: typeof RuleType.gfmTask;
157
159
  /** Whether the task is completed */
158
160
  completed: boolean;
159
161
  }
@@ -161,7 +163,7 @@ type RequireAtLeastOne<
161
163
  * Heading node
162
164
  */
163
165
  export interface HeadingNode {
164
- type: typeof RuleType2.heading;
166
+ type: typeof RuleType.heading;
165
167
  /** Child nodes (text content) */
166
168
  children: MarkdownToJSX.ASTNode[];
167
169
  /** Generated HTML ID for anchor linking */
@@ -173,7 +175,7 @@ type RequireAtLeastOne<
173
175
  * HTML comment node
174
176
  */
175
177
  export interface HTMLCommentNode {
176
- type: typeof RuleType2.htmlComment;
178
+ type: typeof RuleType.htmlComment;
177
179
  /** Comment text */
178
180
  text: string;
179
181
  }
@@ -181,7 +183,7 @@ type RequireAtLeastOne<
181
183
  * Image node
182
184
  */
183
185
  export interface ImageNode {
184
- type: typeof RuleType2.image;
186
+ type: typeof RuleType.image;
185
187
  /** Alt text */
186
188
  alt?: string;
187
189
  /** Image URL */
@@ -193,7 +195,7 @@ type RequireAtLeastOne<
193
195
  * Link node
194
196
  */
195
197
  export interface LinkNode {
196
- type: typeof RuleType2.link;
198
+ type: typeof RuleType.link;
197
199
  /** Child nodes (link text) */
198
200
  children: MarkdownToJSX.ASTNode[];
199
201
  /** Link URL (null for reference links without definition) */
@@ -205,7 +207,7 @@ type RequireAtLeastOne<
205
207
  * Ordered list node
206
208
  */
207
209
  export interface OrderedListNode {
208
- type: typeof RuleType2.orderedList;
210
+ type: typeof RuleType.orderedList;
209
211
  /** Array of list items, each item is an array of nodes */
210
212
  items: MarkdownToJSX.ASTNode[][];
211
213
  /** Starting number for the list */
@@ -215,7 +217,7 @@ type RequireAtLeastOne<
215
217
  * Unordered list node
216
218
  */
217
219
  export interface UnorderedListNode {
218
- type: typeof RuleType2.unorderedList;
220
+ type: typeof RuleType.unorderedList;
219
221
  /** Array of list items, each item is an array of nodes */
220
222
  items: MarkdownToJSX.ASTNode[][];
221
223
  }
@@ -223,7 +225,7 @@ type RequireAtLeastOne<
223
225
  * Paragraph node
224
226
  */
225
227
  export interface ParagraphNode {
226
- type: typeof RuleType2.paragraph;
228
+ type: typeof RuleType.paragraph;
227
229
  /** Child nodes */
228
230
  children: MarkdownToJSX.ASTNode[];
229
231
  }
@@ -231,13 +233,13 @@ type RequireAtLeastOne<
231
233
  * Reference definition node (not rendered, stored in refCollection)
232
234
  */
233
235
  export interface ReferenceNode {
234
- type: typeof RuleType2.ref;
236
+ type: typeof RuleType.ref;
235
237
  }
236
238
  /**
237
239
  * Reference collection node (appears at AST root, includes footnotes with '^' prefix)
238
240
  */
239
241
  export interface ReferenceCollectionNode {
240
- type: typeof RuleType2.refCollection;
242
+ type: typeof RuleType.refCollection;
241
243
  /** Map of reference labels to their definitions */
242
244
  refs: {
243
245
  [key: string]: {
@@ -250,7 +252,7 @@ type RequireAtLeastOne<
250
252
  * Table node
251
253
  */
252
254
  export interface TableNode {
253
- type: typeof RuleType2.table;
255
+ type: typeof RuleType.table;
254
256
  /**
255
257
  * alignment for each table column
256
258
  */
@@ -264,7 +266,7 @@ type RequireAtLeastOne<
264
266
  * Plain text node
265
267
  */
266
268
  export interface TextNode {
267
- type: typeof RuleType2.text;
269
+ type: typeof RuleType.text;
268
270
  /** Text content */
269
271
  text: string;
270
272
  }
@@ -272,7 +274,7 @@ type RequireAtLeastOne<
272
274
  * Formatted text node (bold, italic, etc.)
273
275
  */
274
276
  export interface FormattedTextNode {
275
- type: typeof RuleType2.textFormatted;
277
+ type: typeof RuleType.textFormatted;
276
278
  /**
277
279
  * the corresponding html tag
278
280
  */
@@ -286,7 +288,7 @@ type RequireAtLeastOne<
286
288
  * HTML block node (includes JSX components)
287
289
  */
288
290
  export interface HTMLNode {
289
- type: typeof RuleType2.htmlBlock;
291
+ type: typeof RuleType.htmlBlock;
290
292
  /** Parsed HTML attributes */
291
293
  attrs?: Record<string, any>;
292
294
  /** Parsed child nodes (always parsed, even for verbatim blocks) */
@@ -308,7 +310,7 @@ type RequireAtLeastOne<
308
310
  * Self-closing HTML tag node
309
311
  */
310
312
  export interface HTMLSelfClosingNode {
311
- type: typeof RuleType2.htmlSelfClosing;
313
+ type: typeof RuleType.htmlSelfClosing;
312
314
  /** Parsed HTML attributes */
313
315
  attrs?: Record<string, any>;
314
316
  /** @internal Whether this is a closing tag */
@@ -502,8 +504,8 @@ type RequireAtLeastOne<
502
504
  optimizeForStreaming?: boolean;
503
505
  }>;
504
506
  }
505
- declare const RuleType2: typeof RuleTypeConst;
506
- type RuleType2 = RuleTypeValue;
507
+ declare const RuleType: typeof RuleTypeConst;
508
+ type RuleType = RuleTypeValue;
507
509
  /**
508
510
  * Main parser entry point - matches original parser interface
509
511
  */
@@ -551,4 +553,4 @@ declare const Markdown: React2.FC<Omit<React2.HTMLAttributes<Element>, "children
551
553
  declare var Markdown2: typeof Markdown;
552
554
  /** @deprecated Use the `markdown-to-jsx/react` import instead */
553
555
  declare var compiler2: typeof compiler;
554
- export { slugify, sanitizer, parser, Markdown as default, compiler2 as compiler, RuleType2 as RuleType, MarkdownToJSX, Markdown2 as Markdown };
556
+ export { slugify, sanitizer, parser, Markdown as default, compiler2 as compiler, RuleType, MarkdownToJSX, Markdown2 as Markdown };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,8 @@ type RequireAtLeastOne<
82
82
  _htmlDepth?: number;
83
83
  /** internal: set by collectReferenceDefinitions when input ends inside an unclosed fence */
84
84
  _endsInsideFence?: boolean;
85
+ /** internal: smallest bare-URL start position known to fail by reaching end-of-input (issue #874); scoped per parseInline call */
86
+ _inlineUrlFailFrom?: number;
85
87
  };
86
88
  /**
87
89
  * Blockquote node in the AST
@@ -91,25 +93,25 @@ type RequireAtLeastOne<
91
93
  alert?: string;
92
94
  /** Child nodes within the blockquote */
93
95
  children: MarkdownToJSX.ASTNode[];
94
- type: typeof RuleType2.blockQuote;
96
+ type: typeof RuleType.blockQuote;
95
97
  }
96
98
  /**
97
99
  * Hard line break node
98
100
  */
99
101
  export interface BreakLineNode {
100
- type: typeof RuleType2.breakLine;
102
+ type: typeof RuleType.breakLine;
101
103
  }
102
104
  /**
103
105
  * Thematic break (horizontal rule) node
104
106
  */
105
107
  export interface BreakThematicNode {
106
- type: typeof RuleType2.breakThematic;
108
+ type: typeof RuleType.breakThematic;
107
109
  }
108
110
  /**
109
111
  * Code block node (fenced code blocks)
110
112
  */
111
113
  export interface CodeBlockNode {
112
- type: typeof RuleType2.codeBlock;
114
+ type: typeof RuleType.codeBlock;
113
115
  /** HTML attributes for the code block */
114
116
  attrs?: React.JSX.IntrinsicAttributes;
115
117
  /** Programming language identifier */
@@ -121,7 +123,7 @@ type RequireAtLeastOne<
121
123
  * Inline code node
122
124
  */
123
125
  export interface CodeInlineNode {
124
- type: typeof RuleType2.codeInline;
126
+ type: typeof RuleType.codeInline;
125
127
  /** Code text */
126
128
  text: string;
127
129
  }
@@ -129,13 +131,13 @@ type RequireAtLeastOne<
129
131
  * Footnote definition node (not rendered, stored in refCollection)
130
132
  */
131
133
  export interface FootnoteNode {
132
- type: typeof RuleType2.footnote;
134
+ type: typeof RuleType.footnote;
133
135
  }
134
136
  /**
135
137
  * Footnote reference node
136
138
  */
137
139
  export interface FootnoteReferenceNode {
138
- type: typeof RuleType2.footnoteReference;
140
+ type: typeof RuleType.footnoteReference;
139
141
  /** Link target (anchor) */
140
142
  target: string;
141
143
  /** Display text */
@@ -145,7 +147,7 @@ type RequireAtLeastOne<
145
147
  * YAML frontmatter node
146
148
  */
147
149
  export interface FrontmatterNode {
148
- type: typeof RuleType2.frontmatter;
150
+ type: typeof RuleType.frontmatter;
149
151
  /** Frontmatter content */
150
152
  text: string;
151
153
  }
@@ -153,7 +155,7 @@ type RequireAtLeastOne<
153
155
  * GFM task list item node
154
156
  */
155
157
  export interface GFMTaskNode {
156
- type: typeof RuleType2.gfmTask;
158
+ type: typeof RuleType.gfmTask;
157
159
  /** Whether the task is completed */
158
160
  completed: boolean;
159
161
  }
@@ -161,7 +163,7 @@ type RequireAtLeastOne<
161
163
  * Heading node
162
164
  */
163
165
  export interface HeadingNode {
164
- type: typeof RuleType2.heading;
166
+ type: typeof RuleType.heading;
165
167
  /** Child nodes (text content) */
166
168
  children: MarkdownToJSX.ASTNode[];
167
169
  /** Generated HTML ID for anchor linking */
@@ -173,7 +175,7 @@ type RequireAtLeastOne<
173
175
  * HTML comment node
174
176
  */
175
177
  export interface HTMLCommentNode {
176
- type: typeof RuleType2.htmlComment;
178
+ type: typeof RuleType.htmlComment;
177
179
  /** Comment text */
178
180
  text: string;
179
181
  }
@@ -181,7 +183,7 @@ type RequireAtLeastOne<
181
183
  * Image node
182
184
  */
183
185
  export interface ImageNode {
184
- type: typeof RuleType2.image;
186
+ type: typeof RuleType.image;
185
187
  /** Alt text */
186
188
  alt?: string;
187
189
  /** Image URL */
@@ -193,7 +195,7 @@ type RequireAtLeastOne<
193
195
  * Link node
194
196
  */
195
197
  export interface LinkNode {
196
- type: typeof RuleType2.link;
198
+ type: typeof RuleType.link;
197
199
  /** Child nodes (link text) */
198
200
  children: MarkdownToJSX.ASTNode[];
199
201
  /** Link URL (null for reference links without definition) */
@@ -205,7 +207,7 @@ type RequireAtLeastOne<
205
207
  * Ordered list node
206
208
  */
207
209
  export interface OrderedListNode {
208
- type: typeof RuleType2.orderedList;
210
+ type: typeof RuleType.orderedList;
209
211
  /** Array of list items, each item is an array of nodes */
210
212
  items: MarkdownToJSX.ASTNode[][];
211
213
  /** Starting number for the list */
@@ -215,7 +217,7 @@ type RequireAtLeastOne<
215
217
  * Unordered list node
216
218
  */
217
219
  export interface UnorderedListNode {
218
- type: typeof RuleType2.unorderedList;
220
+ type: typeof RuleType.unorderedList;
219
221
  /** Array of list items, each item is an array of nodes */
220
222
  items: MarkdownToJSX.ASTNode[][];
221
223
  }
@@ -223,7 +225,7 @@ type RequireAtLeastOne<
223
225
  * Paragraph node
224
226
  */
225
227
  export interface ParagraphNode {
226
- type: typeof RuleType2.paragraph;
228
+ type: typeof RuleType.paragraph;
227
229
  /** Child nodes */
228
230
  children: MarkdownToJSX.ASTNode[];
229
231
  }
@@ -231,13 +233,13 @@ type RequireAtLeastOne<
231
233
  * Reference definition node (not rendered, stored in refCollection)
232
234
  */
233
235
  export interface ReferenceNode {
234
- type: typeof RuleType2.ref;
236
+ type: typeof RuleType.ref;
235
237
  }
236
238
  /**
237
239
  * Reference collection node (appears at AST root, includes footnotes with '^' prefix)
238
240
  */
239
241
  export interface ReferenceCollectionNode {
240
- type: typeof RuleType2.refCollection;
242
+ type: typeof RuleType.refCollection;
241
243
  /** Map of reference labels to their definitions */
242
244
  refs: {
243
245
  [key: string]: {
@@ -250,7 +252,7 @@ type RequireAtLeastOne<
250
252
  * Table node
251
253
  */
252
254
  export interface TableNode {
253
- type: typeof RuleType2.table;
255
+ type: typeof RuleType.table;
254
256
  /**
255
257
  * alignment for each table column
256
258
  */
@@ -264,7 +266,7 @@ type RequireAtLeastOne<
264
266
  * Plain text node
265
267
  */
266
268
  export interface TextNode {
267
- type: typeof RuleType2.text;
269
+ type: typeof RuleType.text;
268
270
  /** Text content */
269
271
  text: string;
270
272
  }
@@ -272,7 +274,7 @@ type RequireAtLeastOne<
272
274
  * Formatted text node (bold, italic, etc.)
273
275
  */
274
276
  export interface FormattedTextNode {
275
- type: typeof RuleType2.textFormatted;
277
+ type: typeof RuleType.textFormatted;
276
278
  /**
277
279
  * the corresponding html tag
278
280
  */
@@ -286,7 +288,7 @@ type RequireAtLeastOne<
286
288
  * HTML block node (includes JSX components)
287
289
  */
288
290
  export interface HTMLNode {
289
- type: typeof RuleType2.htmlBlock;
291
+ type: typeof RuleType.htmlBlock;
290
292
  /** Parsed HTML attributes */
291
293
  attrs?: Record<string, any>;
292
294
  /** Parsed child nodes (always parsed, even for verbatim blocks) */
@@ -308,7 +310,7 @@ type RequireAtLeastOne<
308
310
  * Self-closing HTML tag node
309
311
  */
310
312
  export interface HTMLSelfClosingNode {
311
- type: typeof RuleType2.htmlSelfClosing;
313
+ type: typeof RuleType.htmlSelfClosing;
312
314
  /** Parsed HTML attributes */
313
315
  attrs?: Record<string, any>;
314
316
  /** @internal Whether this is a closing tag */
@@ -502,8 +504,8 @@ type RequireAtLeastOne<
502
504
  optimizeForStreaming?: boolean;
503
505
  }>;
504
506
  }
505
- declare const RuleType2: typeof RuleTypeConst;
506
- type RuleType2 = RuleTypeValue;
507
+ declare const RuleType: typeof RuleTypeConst;
508
+ type RuleType = RuleTypeValue;
507
509
  /**
508
510
  * Main parser entry point - matches original parser interface
509
511
  */
@@ -551,4 +553,4 @@ declare const Markdown: React2.FC<Omit<React2.HTMLAttributes<Element>, "children
551
553
  declare var Markdown2: typeof Markdown;
552
554
  /** @deprecated Use the `markdown-to-jsx/react` import instead */
553
555
  declare var compiler2: typeof compiler;
554
- export { slugify, sanitizer, parser, Markdown as default, compiler2 as compiler, RuleType2 as RuleType, MarkdownToJSX, Markdown2 as Markdown };
556
+ export { slugify, sanitizer, parser, Markdown as default, compiler2 as compiler, RuleType, MarkdownToJSX, Markdown2 as Markdown };