markdown-to-jsx 9.3.4 → 9.4.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/dist/index.d.cts CHANGED
@@ -176,6 +176,7 @@ type RequireAtLeastOne<
176
176
  attrs?: Record<string, any>;
177
177
  children?: ASTNode[] | undefined;
178
178
  noInnerParse?: Boolean;
179
+ rawAttrs?: string;
179
180
  tag: string;
180
181
  text?: string | undefined;
181
182
  }
@@ -227,6 +228,31 @@ type RequireAtLeastOne<
227
228
  */
228
229
  enforceAtxHeadings: boolean;
229
230
  /**
231
+ * **⚠️ SECURITY WARNING: STRONGLY DISCOURAGED FOR USER INPUTS**
232
+ *
233
+ * When enabled, attempts to eval expressions in JSX props that cannot be serialized
234
+ * as JSON (functions, variables, complex expressions). This uses `eval()` which can
235
+ * execute arbitrary code.
236
+ *
237
+ * **ONLY use this option when:**
238
+ * - The markdown source is completely trusted (e.g., your own documentation)
239
+ * - You control all JSX components and their props
240
+ * - The content is NOT user-generated or user-editable
241
+ *
242
+ * **DO NOT use this option when:**
243
+ * - Processing user-submitted markdown
244
+ * - Rendering untrusted content
245
+ * - Building public-facing applications with user content
246
+ *
247
+ * Example unsafe input: `<Component onClick={() => fetch('/admin/delete-all')} />`
248
+ *
249
+ * When disabled (default), unserializable expressions remain as strings that can be
250
+ * safely inspected or handled on a case-by-case basis via custom renderRule logic.
251
+ *
252
+ * @default false
253
+ */
254
+ evalUnserializableExpressions?: boolean;
255
+ /**
230
256
  * Forces the compiler to always output content with a block-level wrapper
231
257
  * (`<p>` or any block-level syntax your markdown already contains.)
232
258
  */
@@ -337,8 +363,8 @@ declare function sanitizer(input: string): string | null;
337
363
  declare function slugify(str: string): string;
338
364
  declare function compiler(markdown?: string, options?: MarkdownToJSX.Options): React2.ReactNode;
339
365
  /**
340
- * A simple HOC for easy React use. Feed the markdown content as a direct child
341
- * and the rest is taken care of automatically.
366
+ * A React component for easy markdown rendering. Feed the markdown content as a direct child
367
+ * and the rest is taken care of automatically. Supports memoization for optimal performance.
342
368
  */
343
369
  declare const Markdown: React2.FC<Omit<React2.HTMLAttributes<Element>, "children"> & {
344
370
  children?: string | null;
package/dist/index.d.ts CHANGED
@@ -176,6 +176,7 @@ type RequireAtLeastOne<
176
176
  attrs?: Record<string, any>;
177
177
  children?: ASTNode[] | undefined;
178
178
  noInnerParse?: Boolean;
179
+ rawAttrs?: string;
179
180
  tag: string;
180
181
  text?: string | undefined;
181
182
  }
@@ -227,6 +228,31 @@ type RequireAtLeastOne<
227
228
  */
228
229
  enforceAtxHeadings: boolean;
229
230
  /**
231
+ * **⚠️ SECURITY WARNING: STRONGLY DISCOURAGED FOR USER INPUTS**
232
+ *
233
+ * When enabled, attempts to eval expressions in JSX props that cannot be serialized
234
+ * as JSON (functions, variables, complex expressions). This uses `eval()` which can
235
+ * execute arbitrary code.
236
+ *
237
+ * **ONLY use this option when:**
238
+ * - The markdown source is completely trusted (e.g., your own documentation)
239
+ * - You control all JSX components and their props
240
+ * - The content is NOT user-generated or user-editable
241
+ *
242
+ * **DO NOT use this option when:**
243
+ * - Processing user-submitted markdown
244
+ * - Rendering untrusted content
245
+ * - Building public-facing applications with user content
246
+ *
247
+ * Example unsafe input: `<Component onClick={() => fetch('/admin/delete-all')} />`
248
+ *
249
+ * When disabled (default), unserializable expressions remain as strings that can be
250
+ * safely inspected or handled on a case-by-case basis via custom renderRule logic.
251
+ *
252
+ * @default false
253
+ */
254
+ evalUnserializableExpressions?: boolean;
255
+ /**
230
256
  * Forces the compiler to always output content with a block-level wrapper
231
257
  * (`<p>` or any block-level syntax your markdown already contains.)
232
258
  */
@@ -337,8 +363,8 @@ declare function sanitizer(input: string): string | null;
337
363
  declare function slugify(str: string): string;
338
364
  declare function compiler(markdown?: string, options?: MarkdownToJSX.Options): React2.ReactNode;
339
365
  /**
340
- * A simple HOC for easy React use. Feed the markdown content as a direct child
341
- * and the rest is taken care of automatically.
366
+ * A React component for easy markdown rendering. Feed the markdown content as a direct child
367
+ * and the rest is taken care of automatically. Supports memoization for optimal performance.
342
368
  */
343
369
  declare const Markdown: React2.FC<Omit<React2.HTMLAttributes<Element>, "children"> & {
344
370
  children?: string | null;