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