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/native.d.cts
CHANGED
|
@@ -177,6 +177,7 @@ type RequireAtLeastOne<
|
|
|
177
177
|
attrs?: Record<string, any>;
|
|
178
178
|
children?: ASTNode[] | undefined;
|
|
179
179
|
noInnerParse?: Boolean;
|
|
180
|
+
rawAttrs?: string;
|
|
180
181
|
tag: string;
|
|
181
182
|
text?: string | undefined;
|
|
182
183
|
}
|
|
@@ -228,6 +229,31 @@ type RequireAtLeastOne<
|
|
|
228
229
|
*/
|
|
229
230
|
enforceAtxHeadings: boolean;
|
|
230
231
|
/**
|
|
232
|
+
* **⚠️ SECURITY WARNING: STRONGLY DISCOURAGED FOR USER INPUTS**
|
|
233
|
+
*
|
|
234
|
+
* When enabled, attempts to eval expressions in JSX props that cannot be serialized
|
|
235
|
+
* as JSON (functions, variables, complex expressions). This uses `eval()` which can
|
|
236
|
+
* execute arbitrary code.
|
|
237
|
+
*
|
|
238
|
+
* **ONLY use this option when:**
|
|
239
|
+
* - The markdown source is completely trusted (e.g., your own documentation)
|
|
240
|
+
* - You control all JSX components and their props
|
|
241
|
+
* - The content is NOT user-generated or user-editable
|
|
242
|
+
*
|
|
243
|
+
* **DO NOT use this option when:**
|
|
244
|
+
* - Processing user-submitted markdown
|
|
245
|
+
* - Rendering untrusted content
|
|
246
|
+
* - Building public-facing applications with user content
|
|
247
|
+
*
|
|
248
|
+
* Example unsafe input: `<Component onClick={() => fetch('/admin/delete-all')} />`
|
|
249
|
+
*
|
|
250
|
+
* When disabled (default), unserializable expressions remain as strings that can be
|
|
251
|
+
* safely inspected or handled on a case-by-case basis via custom renderRule logic.
|
|
252
|
+
*
|
|
253
|
+
* @default false
|
|
254
|
+
*/
|
|
255
|
+
evalUnserializableExpressions?: boolean;
|
|
256
|
+
/**
|
|
231
257
|
* Forces the compiler to always output content with a block-level wrapper
|
|
232
258
|
* (`<p>` or any block-level syntax your markdown already contains.)
|
|
233
259
|
*/
|
|
@@ -336,6 +362,7 @@ declare global {
|
|
|
336
362
|
declare function parser(source: string, options?: MarkdownToJSX.Options): MarkdownToJSX.ASTNode[];
|
|
337
363
|
declare function sanitizer(input: string): string | null;
|
|
338
364
|
declare function slugify(str: string): string;
|
|
365
|
+
declare const MarkdownContext: React2.Context<NativeOptions | undefined>;
|
|
339
366
|
type NativeStyleKey = "text" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "link" | "image" | "codeBlock" | "codeInline" | "blockquote" | "listOrdered" | "listUnordered" | "listItem" | "listItemBullet" | "listItemNumber" | "thematicBreak" | "table" | "tableHeader" | "tableHeaderCell" | "tableRow" | "tableCell" | "em" | "strong" | "del" | "gfmTask" | "div" | "section" | "article" | "aside" | "header" | "footer" | "main" | "nav" | "figure" | "figcaption" | "ul" | "ol" | "li" | "th" | "td";
|
|
340
367
|
type NativeOptions = Omit<MarkdownToJSX.Options, "wrapperProps"> & {
|
|
341
368
|
onLinkPress?: (url: string, title?: string) => void;
|
|
@@ -345,8 +372,12 @@ type NativeOptions = Omit<MarkdownToJSX.Options, "wrapperProps"> & {
|
|
|
345
372
|
};
|
|
346
373
|
declare function astToNative(ast: MarkdownToJSX.ASTNode[], options?: NativeOptions): React2.ReactNode;
|
|
347
374
|
declare function compiler(markdown?: string, options?: NativeOptions): React2.ReactNode;
|
|
375
|
+
declare const MarkdownProvider: React2.FC<{
|
|
376
|
+
options?: NativeOptions;
|
|
377
|
+
children: React2.ReactNode;
|
|
378
|
+
}>;
|
|
348
379
|
declare const Markdown: React2.FC<Omit<ViewProps, "children"> & {
|
|
349
380
|
children?: string | null;
|
|
350
381
|
options?: NativeOptions;
|
|
351
382
|
}>;
|
|
352
|
-
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative, RuleType2 as RuleType, NativeStyleKey, NativeOptions, MarkdownToJSX, Markdown };
|
|
383
|
+
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative, RuleType2 as RuleType, NativeStyleKey, NativeOptions, MarkdownToJSX, MarkdownProvider, MarkdownContext, Markdown };
|
package/dist/native.d.ts
CHANGED
|
@@ -177,6 +177,7 @@ type RequireAtLeastOne<
|
|
|
177
177
|
attrs?: Record<string, any>;
|
|
178
178
|
children?: ASTNode[] | undefined;
|
|
179
179
|
noInnerParse?: Boolean;
|
|
180
|
+
rawAttrs?: string;
|
|
180
181
|
tag: string;
|
|
181
182
|
text?: string | undefined;
|
|
182
183
|
}
|
|
@@ -228,6 +229,31 @@ type RequireAtLeastOne<
|
|
|
228
229
|
*/
|
|
229
230
|
enforceAtxHeadings: boolean;
|
|
230
231
|
/**
|
|
232
|
+
* **⚠️ SECURITY WARNING: STRONGLY DISCOURAGED FOR USER INPUTS**
|
|
233
|
+
*
|
|
234
|
+
* When enabled, attempts to eval expressions in JSX props that cannot be serialized
|
|
235
|
+
* as JSON (functions, variables, complex expressions). This uses `eval()` which can
|
|
236
|
+
* execute arbitrary code.
|
|
237
|
+
*
|
|
238
|
+
* **ONLY use this option when:**
|
|
239
|
+
* - The markdown source is completely trusted (e.g., your own documentation)
|
|
240
|
+
* - You control all JSX components and their props
|
|
241
|
+
* - The content is NOT user-generated or user-editable
|
|
242
|
+
*
|
|
243
|
+
* **DO NOT use this option when:**
|
|
244
|
+
* - Processing user-submitted markdown
|
|
245
|
+
* - Rendering untrusted content
|
|
246
|
+
* - Building public-facing applications with user content
|
|
247
|
+
*
|
|
248
|
+
* Example unsafe input: `<Component onClick={() => fetch('/admin/delete-all')} />`
|
|
249
|
+
*
|
|
250
|
+
* When disabled (default), unserializable expressions remain as strings that can be
|
|
251
|
+
* safely inspected or handled on a case-by-case basis via custom renderRule logic.
|
|
252
|
+
*
|
|
253
|
+
* @default false
|
|
254
|
+
*/
|
|
255
|
+
evalUnserializableExpressions?: boolean;
|
|
256
|
+
/**
|
|
231
257
|
* Forces the compiler to always output content with a block-level wrapper
|
|
232
258
|
* (`<p>` or any block-level syntax your markdown already contains.)
|
|
233
259
|
*/
|
|
@@ -336,6 +362,7 @@ declare global {
|
|
|
336
362
|
declare function parser(source: string, options?: MarkdownToJSX.Options): MarkdownToJSX.ASTNode[];
|
|
337
363
|
declare function sanitizer(input: string): string | null;
|
|
338
364
|
declare function slugify(str: string): string;
|
|
365
|
+
declare const MarkdownContext: React2.Context<NativeOptions | undefined>;
|
|
339
366
|
type NativeStyleKey = "text" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "link" | "image" | "codeBlock" | "codeInline" | "blockquote" | "listOrdered" | "listUnordered" | "listItem" | "listItemBullet" | "listItemNumber" | "thematicBreak" | "table" | "tableHeader" | "tableHeaderCell" | "tableRow" | "tableCell" | "em" | "strong" | "del" | "gfmTask" | "div" | "section" | "article" | "aside" | "header" | "footer" | "main" | "nav" | "figure" | "figcaption" | "ul" | "ol" | "li" | "th" | "td";
|
|
340
367
|
type NativeOptions = Omit<MarkdownToJSX.Options, "wrapperProps"> & {
|
|
341
368
|
onLinkPress?: (url: string, title?: string) => void;
|
|
@@ -345,8 +372,12 @@ type NativeOptions = Omit<MarkdownToJSX.Options, "wrapperProps"> & {
|
|
|
345
372
|
};
|
|
346
373
|
declare function astToNative(ast: MarkdownToJSX.ASTNode[], options?: NativeOptions): React2.ReactNode;
|
|
347
374
|
declare function compiler(markdown?: string, options?: NativeOptions): React2.ReactNode;
|
|
375
|
+
declare const MarkdownProvider: React2.FC<{
|
|
376
|
+
options?: NativeOptions;
|
|
377
|
+
children: React2.ReactNode;
|
|
378
|
+
}>;
|
|
348
379
|
declare const Markdown: React2.FC<Omit<ViewProps, "children"> & {
|
|
349
380
|
children?: string | null;
|
|
350
381
|
options?: NativeOptions;
|
|
351
382
|
}>;
|
|
352
|
-
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative, RuleType2 as RuleType, NativeStyleKey, NativeOptions, MarkdownToJSX, Markdown };
|
|
383
|
+
export { slugify, sanitizer, parser, Markdown as default, compiler, astToNative, RuleType2 as RuleType, NativeStyleKey, NativeOptions, MarkdownToJSX, MarkdownProvider, MarkdownContext, Markdown };
|