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/README.md +150 -27
- package/dist/html.cjs +97 -97
- package/dist/html.d.cts +26 -0
- package/dist/html.d.ts +26 -0
- package/dist/html.js +97 -97
- package/dist/html.js.map +4 -4
- package/dist/index.cjs +87 -87
- package/dist/index.d.cts +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +87 -87
- package/dist/index.js.map +5 -5
- package/dist/markdown.cjs +110 -110
- package/dist/markdown.js +110 -110
- package/dist/markdown.js.map +5 -5
- package/dist/native.cjs +93 -93
- package/dist/native.d.cts +32 -1
- package/dist/native.d.ts +32 -1
- package/dist/native.js +103 -103
- package/dist/native.js.map +5 -5
- package/dist/react.cjs +83 -83
- package/dist/react.d.cts +34 -3
- package/dist/react.d.ts +34 -3
- package/dist/react.js +84 -84
- package/dist/react.js.map +5 -5
- package/dist/solid.cjs +95 -95
- package/dist/solid.d.cts +26 -0
- package/dist/solid.d.ts +26 -0
- package/dist/solid.js +95 -95
- package/dist/solid.js.map +4 -4
- package/dist/vue.cjs +88 -88
- package/dist/vue.d.cts +34 -3
- package/dist/vue.d.ts +34 -3
- package/dist/vue.js +85 -85
- package/dist/vue.js.map +5 -5
- package/package.json +1 -1
package/dist/vue.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, VNode, Component } from "vue";
|
|
1
|
+
import { h, VNode, Component, InjectionKey } from "vue";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Analogous to `node.type`. Please note that the values here may change at any time,
|
|
@@ -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
|
*/
|
|
@@ -339,6 +365,7 @@ declare global {
|
|
|
339
365
|
declare function parser(source: string, options?: MarkdownToJSX.Options): MarkdownToJSX.ASTNode[];
|
|
340
366
|
declare function sanitizer(input: string): string | null;
|
|
341
367
|
declare function slugify(str: string): string;
|
|
368
|
+
declare const MarkdownOptionsKey: InjectionKey<VueOptions>;
|
|
342
369
|
type VueChild = VNode | string;
|
|
343
370
|
/**
|
|
344
371
|
* Convert HTML attributes to Vue props
|
|
@@ -361,13 +388,17 @@ type VueOptions = Omit<MarkdownToJSX.Options, "createElement" | "wrapperProps" |
|
|
|
361
388
|
};
|
|
362
389
|
declare function astToJSX(ast: MarkdownToJSX.ASTNode[], options?: VueOptions): VNode | VNode[] | null;
|
|
363
390
|
declare function compiler(markdown?: string, options?: VueOptions): VNode | VNode[] | null;
|
|
391
|
+
declare const MarkdownProvider: Component<{
|
|
392
|
+
options?: VueOptions;
|
|
393
|
+
children?: unknown;
|
|
394
|
+
}>;
|
|
364
395
|
/**
|
|
365
396
|
* A Vue component for easy markdown rendering. Feed the markdown content as a direct child
|
|
366
|
-
* and the rest is taken care of automatically.
|
|
397
|
+
* and the rest is taken care of automatically. Supports computed memoization for optimal performance.
|
|
367
398
|
*/
|
|
368
399
|
declare const Markdown: Component<{
|
|
369
400
|
children?: string | null;
|
|
370
401
|
options?: VueOptions;
|
|
371
402
|
[key: string]: unknown;
|
|
372
403
|
}>;
|
|
373
|
-
export { slugify, sanitizer, parser, htmlAttrsToVueProps, Markdown as default, compiler, astToJSX, VueOverrides, VueOverride, VueOptions, RuleType2 as RuleType, MarkdownToJSX, Markdown };
|
|
404
|
+
export { slugify, sanitizer, parser, htmlAttrsToVueProps, Markdown as default, compiler, astToJSX, VueOverrides, VueOverride, VueOptions, RuleType2 as RuleType, MarkdownToJSX, MarkdownProvider, MarkdownOptionsKey, Markdown };
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, VNode, Component } from "vue";
|
|
1
|
+
import { h, VNode, Component, InjectionKey } from "vue";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Analogous to `node.type`. Please note that the values here may change at any time,
|
|
@@ -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
|
*/
|
|
@@ -339,6 +365,7 @@ declare global {
|
|
|
339
365
|
declare function parser(source: string, options?: MarkdownToJSX.Options): MarkdownToJSX.ASTNode[];
|
|
340
366
|
declare function sanitizer(input: string): string | null;
|
|
341
367
|
declare function slugify(str: string): string;
|
|
368
|
+
declare const MarkdownOptionsKey: InjectionKey<VueOptions>;
|
|
342
369
|
type VueChild = VNode | string;
|
|
343
370
|
/**
|
|
344
371
|
* Convert HTML attributes to Vue props
|
|
@@ -361,13 +388,17 @@ type VueOptions = Omit<MarkdownToJSX.Options, "createElement" | "wrapperProps" |
|
|
|
361
388
|
};
|
|
362
389
|
declare function astToJSX(ast: MarkdownToJSX.ASTNode[], options?: VueOptions): VNode | VNode[] | null;
|
|
363
390
|
declare function compiler(markdown?: string, options?: VueOptions): VNode | VNode[] | null;
|
|
391
|
+
declare const MarkdownProvider: Component<{
|
|
392
|
+
options?: VueOptions;
|
|
393
|
+
children?: unknown;
|
|
394
|
+
}>;
|
|
364
395
|
/**
|
|
365
396
|
* A Vue component for easy markdown rendering. Feed the markdown content as a direct child
|
|
366
|
-
* and the rest is taken care of automatically.
|
|
397
|
+
* and the rest is taken care of automatically. Supports computed memoization for optimal performance.
|
|
367
398
|
*/
|
|
368
399
|
declare const Markdown: Component<{
|
|
369
400
|
children?: string | null;
|
|
370
401
|
options?: VueOptions;
|
|
371
402
|
[key: string]: unknown;
|
|
372
403
|
}>;
|
|
373
|
-
export { slugify, sanitizer, parser, htmlAttrsToVueProps, Markdown as default, compiler, astToJSX, VueOverrides, VueOverride, VueOptions, RuleType2 as RuleType, MarkdownToJSX, Markdown };
|
|
404
|
+
export { slugify, sanitizer, parser, htmlAttrsToVueProps, Markdown as default, compiler, astToJSX, VueOverrides, VueOverride, VueOptions, RuleType2 as RuleType, MarkdownToJSX, MarkdownProvider, MarkdownOptionsKey, Markdown };
|