markdown-to-jsx 7.3.0 → 7.3.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/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.d.ts +23 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +154 -154
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/site.d.ts +6 -6
- package/package.json +33 -34
package/dist/index.d.ts
CHANGED
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* markdown-to-jsx is a fork of [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown)
|
|
3
|
-
* from Khan Academy. Thank you Khan devs for making such an awesome and extensible
|
|
4
|
-
* parsing infra... without it, half of the optimizations here wouldn't be feasible. 🙏🏼
|
|
5
|
-
*/
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
export declare namespace MarkdownToJSX {
|
|
8
|
-
/**
|
|
9
|
-
* RequireAtLeastOne<{ ... }> <- only requires at least one key
|
|
10
|
-
*/
|
|
11
|
-
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
12
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
13
|
-
}[Keys];
|
|
14
|
-
export type CreateElement = typeof React.createElement;
|
|
15
|
-
export type HTMLTags = keyof JSX.IntrinsicElements;
|
|
16
|
-
export type State = {
|
|
17
|
-
_inAnchor?: boolean;
|
|
18
|
-
_inline?: boolean;
|
|
19
|
-
_inTable?: boolean;
|
|
20
|
-
_key?: React.Key;
|
|
21
|
-
_list?: boolean;
|
|
22
|
-
_simple?: boolean;
|
|
23
|
-
};
|
|
24
|
-
export type ParserResult = {
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
type?: string;
|
|
27
|
-
};
|
|
28
|
-
export type NestedParser = (input: string, state?: MarkdownToJSX.State) => MarkdownToJSX.ParserResult;
|
|
29
|
-
export type Parser<ParserOutput> = (capture: RegExpMatchArray, nestedParse: NestedParser, state?: MarkdownToJSX.State) => ParserOutput;
|
|
30
|
-
export type RuleOutput = (ast: MarkdownToJSX.ParserResult, state: MarkdownToJSX.State) => JSX.Element;
|
|
31
|
-
export type Rule<ParserOutput = MarkdownToJSX.ParserResult> = {
|
|
32
|
-
_match: (source: string, state: MarkdownToJSX.State, prevCapturedString?: string) => RegExpMatchArray;
|
|
33
|
-
_order: Priority;
|
|
34
|
-
_parse: MarkdownToJSX.Parser<ParserOutput>;
|
|
35
|
-
_react?: (node: ParserOutput, output: RuleOutput, state?: MarkdownToJSX.State) => React.ReactChild;
|
|
36
|
-
};
|
|
37
|
-
export type Rules = {
|
|
38
|
-
[key: string]: Rule;
|
|
39
|
-
};
|
|
40
|
-
export type Override = RequireAtLeastOne<{
|
|
41
|
-
component: React.ElementType;
|
|
42
|
-
props: Object;
|
|
43
|
-
}> | React.ElementType;
|
|
44
|
-
export type Overrides = {
|
|
45
|
-
[tag in HTMLTags]?: Override;
|
|
46
|
-
} & {
|
|
47
|
-
[customComponent: string]: Override;
|
|
48
|
-
};
|
|
49
|
-
export type Options = Partial<{
|
|
50
|
-
/**
|
|
51
|
-
* Ultimate control over the output of all rendered JSX.
|
|
52
|
-
*/
|
|
53
|
-
createElement: (tag: Parameters<CreateElement>[0], props: JSX.IntrinsicAttributes, ...children: React.ReactChild[]) => JSX.Element;
|
|
54
|
-
/**
|
|
55
|
-
* Disable the compiler's best-effort transcription of provided raw HTML
|
|
56
|
-
* into JSX-equivalent. This is the functionality that prevents the need to
|
|
57
|
-
* use `dangerouslySetInnerHTML` in React.
|
|
58
|
-
*/
|
|
59
|
-
disableParsingRawHTML: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Forces the compiler to always output content with a block-level wrapper
|
|
62
|
-
* (`<p>` or any block-level syntax your markdown already contains.)
|
|
63
|
-
*/
|
|
64
|
-
forceBlock: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Forces the compiler to always output content with an inline wrapper (`<span>`)
|
|
67
|
-
*/
|
|
68
|
-
forceInline: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Supply additional HTML entity: unicode replacement mappings.
|
|
71
|
-
*
|
|
72
|
-
* Pass only the inner part of the entity as the key,
|
|
73
|
-
* e.g. `≤` -> `{ "le": "\u2264" }`
|
|
74
|
-
*
|
|
75
|
-
* By default
|
|
76
|
-
* the following entities are replaced with their unicode equivalents:
|
|
77
|
-
*
|
|
78
|
-
* ```
|
|
79
|
-
* &
|
|
80
|
-
* '
|
|
81
|
-
* >
|
|
82
|
-
* <
|
|
83
|
-
*
|
|
84
|
-
* "
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
namedCodesToUnicode: {
|
|
88
|
-
[key: string]: string;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Selectively control the output of particular HTML tags as they would be
|
|
92
|
-
* emitted by the compiler.
|
|
93
|
-
*/
|
|
94
|
-
overrides: Overrides;
|
|
95
|
-
/**
|
|
96
|
-
* Declare the type of the wrapper to be used when there are multiple
|
|
97
|
-
* children to render. Set to `null` to get an array of children back
|
|
98
|
-
* without any wrapper, or use `React.Fragment` to get a React element
|
|
99
|
-
* that won't show up in the DOM.
|
|
100
|
-
*/
|
|
101
|
-
wrapper: React.ElementType | null;
|
|
102
|
-
/**
|
|
103
|
-
* Forces the compiler to wrap results, even if there is only a single
|
|
104
|
-
* child or no children.
|
|
105
|
-
*/
|
|
106
|
-
forceWrapper: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Override normalization of non-URI-safe characters for use in generating
|
|
109
|
-
* HTML IDs for anchor linking purposes.
|
|
110
|
-
*/
|
|
111
|
-
slugify: (source: string) => string;
|
|
112
|
-
/**
|
|
113
|
-
* Forces the compiler to have space between hash sign and the header text which
|
|
114
|
-
* is explicitly stated in the most of the markdown specs.
|
|
115
|
-
* https://github.github.com/gfm/#atx-heading
|
|
116
|
-
* `The opening sequence of # characters must be followed by a space or by the end of line.`
|
|
117
|
-
*/
|
|
118
|
-
enforceAtxHeadings: boolean;
|
|
119
|
-
}>;
|
|
120
|
-
export {};
|
|
121
|
-
}
|
|
122
|
-
declare enum Priority {
|
|
123
|
-
/**
|
|
124
|
-
* anything that must scan the tree before everything else
|
|
125
|
-
*/
|
|
126
|
-
MAX = 0,
|
|
127
|
-
/**
|
|
128
|
-
* scans for block-level constructs
|
|
129
|
-
*/
|
|
130
|
-
HIGH = 1,
|
|
131
|
-
/**
|
|
132
|
-
* inline w/ more priority than other inline
|
|
133
|
-
*/
|
|
134
|
-
MED = 2,
|
|
135
|
-
/**
|
|
136
|
-
* inline elements
|
|
137
|
-
*/
|
|
138
|
-
LOW = 3,
|
|
139
|
-
/**
|
|
140
|
-
* bare text and stuff that is considered leftovers
|
|
141
|
-
*/
|
|
142
|
-
MIN = 4
|
|
143
|
-
}
|
|
144
|
-
export declare function compiler(markdown: string, options?: MarkdownToJSX.Options): JSX.Element;
|
|
145
|
-
/**
|
|
146
|
-
* A simple HOC for easy React use. Feed the markdown content as a direct child
|
|
147
|
-
* and the rest is taken care of automatically.
|
|
148
|
-
*/
|
|
149
|
-
declare const Markdown: React.FC<{
|
|
150
|
-
[key: string]: any;
|
|
151
|
-
children: string;
|
|
152
|
-
options?: MarkdownToJSX.Options;
|
|
153
|
-
}>;
|
|
154
|
-
export default Markdown;
|
|
1
|
+
/**
|
|
2
|
+
* markdown-to-jsx is a fork of [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown)
|
|
3
|
+
* from Khan Academy. Thank you Khan devs for making such an awesome and extensible
|
|
4
|
+
* parsing infra... without it, half of the optimizations here wouldn't be feasible. 🙏🏼
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
export declare namespace MarkdownToJSX {
|
|
8
|
+
/**
|
|
9
|
+
* RequireAtLeastOne<{ ... }> <- only requires at least one key
|
|
10
|
+
*/
|
|
11
|
+
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
12
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
13
|
+
}[Keys];
|
|
14
|
+
export type CreateElement = typeof React.createElement;
|
|
15
|
+
export type HTMLTags = keyof JSX.IntrinsicElements;
|
|
16
|
+
export type State = {
|
|
17
|
+
_inAnchor?: boolean;
|
|
18
|
+
_inline?: boolean;
|
|
19
|
+
_inTable?: boolean;
|
|
20
|
+
_key?: React.Key;
|
|
21
|
+
_list?: boolean;
|
|
22
|
+
_simple?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type ParserResult = {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
type?: string;
|
|
27
|
+
};
|
|
28
|
+
export type NestedParser = (input: string, state?: MarkdownToJSX.State) => MarkdownToJSX.ParserResult;
|
|
29
|
+
export type Parser<ParserOutput> = (capture: RegExpMatchArray, nestedParse: NestedParser, state?: MarkdownToJSX.State) => ParserOutput;
|
|
30
|
+
export type RuleOutput = (ast: MarkdownToJSX.ParserResult, state: MarkdownToJSX.State) => JSX.Element;
|
|
31
|
+
export type Rule<ParserOutput = MarkdownToJSX.ParserResult> = {
|
|
32
|
+
_match: (source: string, state: MarkdownToJSX.State, prevCapturedString?: string) => RegExpMatchArray;
|
|
33
|
+
_order: Priority;
|
|
34
|
+
_parse: MarkdownToJSX.Parser<ParserOutput>;
|
|
35
|
+
_react?: (node: ParserOutput, output: RuleOutput, state?: MarkdownToJSX.State) => React.ReactChild;
|
|
36
|
+
};
|
|
37
|
+
export type Rules = {
|
|
38
|
+
[key: string]: Rule;
|
|
39
|
+
};
|
|
40
|
+
export type Override = RequireAtLeastOne<{
|
|
41
|
+
component: React.ElementType;
|
|
42
|
+
props: Object;
|
|
43
|
+
}> | React.ElementType;
|
|
44
|
+
export type Overrides = {
|
|
45
|
+
[tag in HTMLTags]?: Override;
|
|
46
|
+
} & {
|
|
47
|
+
[customComponent: string]: Override;
|
|
48
|
+
};
|
|
49
|
+
export type Options = Partial<{
|
|
50
|
+
/**
|
|
51
|
+
* Ultimate control over the output of all rendered JSX.
|
|
52
|
+
*/
|
|
53
|
+
createElement: (tag: Parameters<CreateElement>[0], props: JSX.IntrinsicAttributes, ...children: React.ReactChild[]) => JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* Disable the compiler's best-effort transcription of provided raw HTML
|
|
56
|
+
* into JSX-equivalent. This is the functionality that prevents the need to
|
|
57
|
+
* use `dangerouslySetInnerHTML` in React.
|
|
58
|
+
*/
|
|
59
|
+
disableParsingRawHTML: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Forces the compiler to always output content with a block-level wrapper
|
|
62
|
+
* (`<p>` or any block-level syntax your markdown already contains.)
|
|
63
|
+
*/
|
|
64
|
+
forceBlock: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Forces the compiler to always output content with an inline wrapper (`<span>`)
|
|
67
|
+
*/
|
|
68
|
+
forceInline: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Supply additional HTML entity: unicode replacement mappings.
|
|
71
|
+
*
|
|
72
|
+
* Pass only the inner part of the entity as the key,
|
|
73
|
+
* e.g. `≤` -> `{ "le": "\u2264" }`
|
|
74
|
+
*
|
|
75
|
+
* By default
|
|
76
|
+
* the following entities are replaced with their unicode equivalents:
|
|
77
|
+
*
|
|
78
|
+
* ```
|
|
79
|
+
* &
|
|
80
|
+
* '
|
|
81
|
+
* >
|
|
82
|
+
* <
|
|
83
|
+
*
|
|
84
|
+
* "
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
namedCodesToUnicode: {
|
|
88
|
+
[key: string]: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Selectively control the output of particular HTML tags as they would be
|
|
92
|
+
* emitted by the compiler.
|
|
93
|
+
*/
|
|
94
|
+
overrides: Overrides;
|
|
95
|
+
/**
|
|
96
|
+
* Declare the type of the wrapper to be used when there are multiple
|
|
97
|
+
* children to render. Set to `null` to get an array of children back
|
|
98
|
+
* without any wrapper, or use `React.Fragment` to get a React element
|
|
99
|
+
* that won't show up in the DOM.
|
|
100
|
+
*/
|
|
101
|
+
wrapper: React.ElementType | null;
|
|
102
|
+
/**
|
|
103
|
+
* Forces the compiler to wrap results, even if there is only a single
|
|
104
|
+
* child or no children.
|
|
105
|
+
*/
|
|
106
|
+
forceWrapper: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Override normalization of non-URI-safe characters for use in generating
|
|
109
|
+
* HTML IDs for anchor linking purposes.
|
|
110
|
+
*/
|
|
111
|
+
slugify: (source: string) => string;
|
|
112
|
+
/**
|
|
113
|
+
* Forces the compiler to have space between hash sign and the header text which
|
|
114
|
+
* is explicitly stated in the most of the markdown specs.
|
|
115
|
+
* https://github.github.com/gfm/#atx-heading
|
|
116
|
+
* `The opening sequence of # characters must be followed by a space or by the end of line.`
|
|
117
|
+
*/
|
|
118
|
+
enforceAtxHeadings: boolean;
|
|
119
|
+
}>;
|
|
120
|
+
export {};
|
|
121
|
+
}
|
|
122
|
+
declare enum Priority {
|
|
123
|
+
/**
|
|
124
|
+
* anything that must scan the tree before everything else
|
|
125
|
+
*/
|
|
126
|
+
MAX = 0,
|
|
127
|
+
/**
|
|
128
|
+
* scans for block-level constructs
|
|
129
|
+
*/
|
|
130
|
+
HIGH = 1,
|
|
131
|
+
/**
|
|
132
|
+
* inline w/ more priority than other inline
|
|
133
|
+
*/
|
|
134
|
+
MED = 2,
|
|
135
|
+
/**
|
|
136
|
+
* inline elements
|
|
137
|
+
*/
|
|
138
|
+
LOW = 3,
|
|
139
|
+
/**
|
|
140
|
+
* bare text and stuff that is considered leftovers
|
|
141
|
+
*/
|
|
142
|
+
MIN = 4
|
|
143
|
+
}
|
|
144
|
+
export declare function compiler(markdown: string, options?: MarkdownToJSX.Options): JSX.Element;
|
|
145
|
+
/**
|
|
146
|
+
* A simple HOC for easy React use. Feed the markdown content as a direct child
|
|
147
|
+
* and the rest is taken care of automatically.
|
|
148
|
+
*/
|
|
149
|
+
declare const Markdown: React.FC<{
|
|
150
|
+
[key: string]: any;
|
|
151
|
+
children: string;
|
|
152
|
+
options?: MarkdownToJSX.Options;
|
|
153
|
+
}>;
|
|
154
|
+
export default Markdown;
|
package/dist/index.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as t from"react";function n(){return n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},n.apply(this,arguments)}const e=["children","options"],r=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","className","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((t,n)=>(t[n.toLowerCase()]=n,t),{for:"htmlFor"}),o={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["style","script"],a=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,_=/mailto:/i,u=/\n{2,}$/,i=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,l=/^ *> ?/gm,s=/^ {2,}\n/,f=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,d=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,p=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,m=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,g=/^(?:\n *)*\n/,y=/\r\n?/g,h=/^\[\^([^\]]+)](:.*)\n/,k=/^\[\^([^\]]+)]/,x=/\f/g,b=/^\s*?\[(x|\s)\]/,$=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,v=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,S=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,z=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,w=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,A=/^<!--[\s\S]*?(?:-->)/,E=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,L=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,M=/^\{.*\}$/,I=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,O=/^<([^ >]+@[^ >]+)>/,B=/^<([^ >]+:\/[^ >]+)>/,R=/-([a-z])?/gi,T=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,j=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,C=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,D=/^\[([^\]]*)\] ?\[([^\]]*)\]/,F=/(\[|\])/g,N=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,P=/\t/g,Z=/^ *\| */,G=/(^ *\||\| *$)/g,H=/ *$/,q=/^ *:-+: *$/,U=/^ *:-+ *$/,V=/^ *-+: *$/,W=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,Q=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/,X=/^==((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)==/,J=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,K=/^\\([^0-9A-Za-z\s])/,Y=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,tt=/^\n+/,nt=/^([ \t]*)/,et=/\\([^\\])/g,rt=/ *\n+$/,ot=/(?:^|\n)( *)$/,ct="(?:\\d+\\.)",at="(?:[*+-])";function _t(t){return"( *)("+(1===t?ct:at)+") +"}const ut=_t(1),it=_t(2);function lt(t){return new RegExp("^"+(1===t?ut:it))}const st=lt(1),ft=lt(2);function dt(t){return new RegExp("^"+(1===t?ut:it)+"[^\\n]*(?:\\n(?!\\1"+(1===t?ct:at)+" )[^\\n]*)*(\\n|$)","gm")}const pt=dt(1),mt=dt(2);function gt(t){const n=1===t?ct:at;return new RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}const yt=gt(1),ht=gt(2);function kt(t,n){const e=1===n,r=e?yt:ht,o=e?pt:mt,c=e?st:ft;return{t(t,n,e){const o=ot.exec(e);return o&&(n.o||!n._&&!n.u)?r.exec(t=o[1]+t):null},i:Ht.HIGH,l(t,n,r){const a=e?+t[2]:void 0,_=t[0].replace(u,"\n").match(o);let i=!1;return{p:_.map(function(t,e){const o=c.exec(t)[0].length,a=new RegExp("^ {1,"+o+"}","gm"),u=t.replace(a,"").replace(c,""),l=e===_.length-1,s=-1!==u.indexOf("\n\n")||l&&i;i=s;const f=r._,d=r.o;let p;r.o=!0,s?(r._=!1,p=u.replace(rt,"\n\n")):(r._=!0,p=u.replace(rt,""));const m=n(p,r);return r._=f,r.o=d,m}),m:e,g:a}},h:(n,e,r)=>t(n.m?"ol":"ul",{key:r.k,start:n.g},n.p.map(function(n,o){return t("li",{key:o},e(n,r))}))}}const xt=/^\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,bt=/^!\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,$t=[i,d,p,$,S,v,A,T,pt,yt,mt,ht],vt=[...$t,/^[^\n]+(?: \n|\n{2,})/,z,L];function St(t){return t.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function zt(t){return V.test(t)?"right":q.test(t)?"center":U.test(t)?"left":null}function wt(t,n,e){const r=e.$;e.$=!0;const o=n(t.trim(),e);e.$=r;let c=[[]];return o.forEach(function(t,n){"tableSeparator"===t.type?0!==n&&n!==o.length-1&&c.push([]):("text"!==t.type||null!=o[n+1]&&"tableSeparator"!==o[n+1].type||(t.v=t.v.replace(H,"")),c[c.length-1].push(t))}),c}function At(t,n,e){e._=!0;const r=wt(t[1],n,e),o=t[2].replace(G,"").split("|").map(zt),c=function(t,n,e){return t.trim().split("\n").map(function(t){return wt(t,n,e)})}(t[3],n,e);return e._=!1,{S:o,A:c,L:r,type:"table"}}function Et(t,n){return null==t.S[n]?{}:{textAlign:t.S[n]}}function Lt(t){return function(n,e){return e._?t.exec(n):null}}function Mt(t){return function(n,e){return e._||e.u?t.exec(n):null}}function It(t){return function(n,e){return e._||e.u?null:t.exec(n)}}function Ot(t){return function(n){return t.exec(n)}}function Bt(t,n,e){if(n._||n.u)return null;if(e&&!e.endsWith("\n"))return null;let r="";t.split("\n").every(t=>!$t.some(n=>n.test(t))&&(r+=t+"\n",t.trim()));const o=r.trimEnd();return""==o?null:[r,o]}function Rt(t){try{if(decodeURIComponent(t).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch(t){return null}return t}function Tt(t){return t.replace(et,"$1")}function jt(t,n,e){const r=e._||!1,o=e.u||!1;e._=!0,e.u=!0;const c=t(n,e);return e._=r,e.u=o,c}function Ct(t,n,e){const r=e._||!1,o=e.u||!1;e._=!1,e.u=!0;const c=t(n,e);return e._=r,e.u=o,c}function Dt(t,n,e){return e._=!1,t(n,e)}const Ft=(t,n,e)=>({v:jt(n,t[1],e)});function Nt(){return{}}function Pt(){return null}function Zt(...t){return t.filter(Boolean).join(" ")}function Gt(t,n,e){let r=t;const o=n.split(".");for(;o.length&&(r=r[o[0]],void 0!==r);)o.shift();return r||e}var Ht;function qt(e,u={}){u.overrides=u.overrides||{},u.slugify=u.slugify||St,u.namedCodesToUnicode=u.namedCodesToUnicode?n({},o,u.namedCodesToUnicode):o;const G=u.createElement||t.createElement;function H(t,e,...r){const o=Gt(u.overrides,`${t}.props`,{});return G(function(t,n){const e=Gt(n,t);return e?"function"==typeof e||"object"==typeof e&&"render"in e?e:Gt(n,`${t}.component`,t):t}(t,u.overrides),n({},e,o,{className:Zt(null==e?void 0:e.className,o.className)||void 0}),...r)}function q(n){let e=!1;u.forceInline?e=!0:u.forceBlock||(e=!1===N.test(n));const r=ct(ot(e?n:`${n.trimEnd().replace(tt,"")}\n\n`,{_:e}));for(;"string"==typeof r[r.length-1]&&!r[r.length-1].trim();)r.pop();if(null===u.wrapper)return r;const o=u.wrapper||(e?"span":"div");let c;if(r.length>1||u.forceWrapper)c=r;else{if(1===r.length)return c=r[0],"string"==typeof c?H("span",{key:"outer"},c):c;c=null}return t.createElement(o,{key:"outer"},c)}function U(n){const e=n.match(a);return e?e.reduce(function(n,e,o){const c=e.indexOf("=");if(-1!==c){const a=function(t){return-1!==t.indexOf("-")&&null===t.match(E)&&(t=t.replace(R,function(t,n){return n.toUpperCase()})),t}(e.slice(0,c)).trim(),_=function(t){const n=t[0];return('"'===n||"'"===n)&&t.length>=2&&t[t.length-1]===n?t.slice(1,-1):t}(e.slice(c+1).trim()),u=r[a]||a,i=n[u]=function(t,n){return"style"===t?n.split(/;\s?/).reduce(function(t,n){const e=n.slice(0,n.indexOf(":"));return t[e.replace(/(-[a-z])/g,t=>t[1].toUpperCase())]=n.slice(e.length+1).trim(),t},{}):"href"===t?Rt(n):(n.match(M)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(a,_);"string"==typeof i&&(z.test(i)||L.test(i))&&(n[u]=t.cloneElement(q(i.trim()),{key:o}))}else"style"!==e&&(n[r[e]||e]=!0);return n},{}):null}const V=[],et={},rt={blockQuote:{t:It(i),i:Ht.HIGH,l:(t,n,e)=>({v:n(t[0].replace(l,""),e)}),h:(t,n,e)=>H("blockquote",{key:e.k},n(t.v,e))},breakLine:{t:Ot(s),i:Ht.HIGH,l:Nt,h:(t,n,e)=>H("br",{key:e.k})},breakThematic:{t:It(f),i:Ht.HIGH,l:Nt,h:(t,n,e)=>H("hr",{key:e.k})},codeBlock:{t:It(p),i:Ht.MAX,l:t=>({v:t[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),M:void 0}),h:(t,e,r)=>H("pre",{key:r.k},H("code",n({},t.I,{className:t.M?`lang-${t.M}`:""}),t.v))},codeFenced:{t:It(d),i:Ht.MAX,l:t=>({I:U(t[3]||""),v:t[4],M:t[2]||void 0,type:"codeBlock"})},codeInline:{t:Mt(m),i:Ht.LOW,l:t=>({v:t[2]}),h:(t,n,e)=>H("code",{key:e.k},t.v)},footnote:{t:It(h),i:Ht.MAX,l:t=>(V.push({O:t[2],B:t[1]}),{}),h:Pt},footnoteReference:{t:Lt(k),i:Ht.HIGH,l:t=>({v:t[1],R:`#${u.slugify(t[1])}`}),h:(t,n,e)=>H("a",{key:e.k,href:Rt(t.R)},H("sup",{key:e.k},t.v))},gfmTask:{t:Lt(b),i:Ht.HIGH,l:t=>({T:"x"===t[1].toLowerCase()}),h:(t,n,e)=>H("input",{checked:t.T,key:e.k,readOnly:!0,type:"checkbox"})},heading:{t:It(u.enforceAtxHeadings?v:$),i:Ht.HIGH,l:(t,n,e)=>({v:jt(n,t[2],e),j:u.slugify(t[2]),C:t[1].length}),h:(t,n,e)=>H(`h${t.C}`,{id:t.j,key:e.k},n(t.v,e))},headingSetext:{t:It(S),i:Ht.MAX,l:(t,n,e)=>({v:jt(n,t[1],e),C:"="===t[2]?1:2,type:"heading"})},htmlComment:{t:Ot(A),i:Ht.HIGH,l:()=>({}),h:Pt},image:{t:Mt(bt),i:Ht.HIGH,l:t=>({D:t[1],R:Tt(t[2]),F:t[3]}),h:(t,n,e)=>H("img",{key:e.k,alt:t.D||void 0,title:t.F||void 0,src:Rt(t.R)})},link:{t:Lt(xt),i:Ht.LOW,l:(t,n,e)=>({v:Ct(n,t[1],e),R:Tt(t[2]),F:t[3]}),h:(t,n,e)=>H("a",{key:e.k,href:Rt(t.R),title:t.F},n(t.v,e))},linkAngleBraceStyleDetector:{t:Lt(B),i:Ht.MAX,l:t=>({v:[{v:t[1],type:"text"}],R:t[1],type:"link"})},linkBareUrlDetector:{t:(t,n)=>n.N?null:Lt(I)(t,n),i:Ht.MAX,l:t=>({v:[{v:t[1],type:"text"}],R:t[1],F:void 0,type:"link"})},linkMailtoDetector:{t:Lt(O),i:Ht.MAX,l(t){let n=t[1],e=t[1];return _.test(e)||(e="mailto:"+e),{v:[{v:n.replace("mailto:",""),type:"text"}],R:e,type:"link"}}},orderedList:kt(H,1),unorderedList:kt(H,2),newlineCoalescer:{t:It(g),i:Ht.LOW,l:Nt,h:()=>"\n"},paragraph:{t:Bt,i:Ht.LOW,l:Ft,h:(t,n,e)=>H("p",{key:e.k},n(t.v,e))},ref:{t:Lt(j),i:Ht.MAX,l:t=>(et[t[1]]={R:t[2],F:t[4]},{}),h:Pt},refImage:{t:Mt(C),i:Ht.MAX,l:t=>({D:t[1]||void 0,P:t[2]}),h:(t,n,e)=>H("img",{key:e.k,alt:t.D,src:Rt(et[t.P].R),title:et[t.P].F})},refLink:{t:Lt(D),i:Ht.MAX,l:(t,n,e)=>({v:n(t[1],e),Z:n(t[0].replace(F,"\\$1"),e),P:t[2]}),h:(t,n,e)=>et[t.P]?H("a",{key:e.k,href:Rt(et[t.P].R),title:et[t.P].F},n(t.v,e)):H("span",{key:e.k},n(t.Z,e))},table:{t:It(T),i:Ht.HIGH,l:At,h:(t,n,e)=>H("table",{key:e.k},H("thead",null,H("tr",null,t.L.map(function(r,o){return H("th",{key:o,style:Et(t,o)},n(r,e))}))),H("tbody",null,t.A.map(function(r,o){return H("tr",{key:o},r.map(function(r,o){return H("td",{key:o,style:Et(t,o)},n(r,e))}))})))},tableSeparator:{t:function(t,n){return n.$?(n._=!0,Z.exec(t)):null},i:Ht.HIGH,l:function(){return{type:"tableSeparator"}},h:()=>" | "},text:{t:Ot(Y),i:Ht.MIN,l:t=>({v:t[0].replace(w,(t,n)=>u.namedCodesToUnicode[n]?u.namedCodesToUnicode[n]:t)}),h:t=>t.v},textBolded:{t:Mt(W),i:Ht.MED,l:(t,n,e)=>({v:n(t[2],e)}),h:(t,n,e)=>H("strong",{key:e.k},n(t.v,e))},textEmphasized:{t:Mt(Q),i:Ht.LOW,l:(t,n,e)=>({v:n(t[2],e)}),h:(t,n,e)=>H("em",{key:e.k},n(t.v,e))},textEscaped:{t:Mt(K),i:Ht.HIGH,l:t=>({v:t[1],type:"text"})},textMarked:{t:Mt(X),i:Ht.LOW,l:Ft,h:(t,n,e)=>H("mark",{key:e.k},n(t.v,e))},textStrikethroughed:{t:Mt(J),i:Ht.LOW,l:Ft,h:(t,n,e)=>H("del",{key:e.k},n(t.v,e))}};!0!==u.disableParsingRawHTML&&(rt.htmlBlock={t:Ot(z),i:Ht.HIGH,l(t,n,e){const[,r]=t[3].match(nt),o=new RegExp(`^${r}`,"gm"),a=t[3].replace(o,""),_=(u=a,vt.some(t=>t.test(u))?Dt:jt);var u;const i=t[1].toLowerCase(),l=-1!==c.indexOf(i);e.N=e.N||"a"===i;const s=l?t[3]:_(n,a,e);return e.N=!1,{I:U(t[2]),v:s,G:l,H:l?i:t[1]}},h:(t,e,r)=>H(t.H,n({key:r.k},t.I),t.G?t.v:e(t.v,r))},rt.htmlSelfClosing={t:Ot(L),i:Ht.HIGH,l:t=>({I:U(t[2]||""),H:t[1]}),h:(t,e,r)=>H(t.H,n({},t.I,{key:r.k}))});const ot=function(t){let n=Object.keys(t);function e(r,o){let c=[],a="";for(;r;){let _=0;for(;_<n.length;){const u=n[_],i=t[u],l=i.t(r,o,a);if(l){const t=l[0];r=r.substring(t.length);const n=i.l(l,e,o);null==n.type&&(n.type=u),c.push(n),a=t;break}_++}}return c}return n.sort(function(n,e){let r=t[n].i,o=t[e].i;return r!==o?r-o:n<e?-1:1}),function(t,n){return e(function(t){return t.replace(y,"\n").replace(x,"").replace(P," ")}(t),n)}}(rt),ct=(at=function(t){return function(n,e,r){return t[n.type].h(n,e,r)}}(rt),function t(n,e={}){if(Array.isArray(n)){const r=e.k,o=[];let c=!1;for(let r=0;r<n.length;r++){e.k=r;const a=t(n[r],e),_="string"==typeof a;_&&c?o[o.length-1]+=a:null!==a&&o.push(a),c=_}return e.k=r,o}return at(n,t,e)});var at;const _t=q(e);return V.length?H("div",null,_t,H("footer",{key:"footer"},V.map(function(t){return H("div",{id:u.slugify(t.B),key:t.B},t.B,ct(ot(t.O,{_:!0})))}))):_t}!function(t){t[t.MAX=0]="MAX",t[t.HIGH=1]="HIGH",t[t.MED=2]="MED",t[t.LOW=3]="LOW",t[t.MIN=4]="MIN"}(Ht||(Ht={}));export default n=>{let{children:r,options:o}=n,c=function(t,n){if(null==t)return{};var e,r,o={},c=Object.keys(t);for(r=0;r<c.length;r++)n.indexOf(e=c[r])>=0||(o[e]=t[e]);return o}(n,e);return t.cloneElement(qt(r,o),c)};export{qt as compiler};
|
|
1
|
+
import*as t from"react";function n(){return n=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},n.apply(this,arguments)}const e=["children","options"],r=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","className","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((t,n)=>(t[n.toLowerCase()]=n,t),{for:"htmlFor"}),o={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["style","script"],a=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,_=/mailto:/i,u=/\n{2,}$/,i=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,s=/^ *> ?/gm,l=/^ {2,}\n/,f=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,d=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,p=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,m=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,g=/^(?:\n *)*\n/,y=/\r\n?/g,h=/^\[\^([^\]]+)](:.*)\n/,k=/^\[\^([^\]]+)]/,x=/\f/g,b=/^\s*?\[(x|\s)\]/,$=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,v=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,S=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,z=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,w=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,A=/^<!--[\s\S]*?(?:-->)/,E=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,L=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,M=/^\{.*\}$/,O=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,I=/^<([^ >]+@[^ >]+)>/,j=/^<([^ >]+:\/[^ >]+)>/,B=/-([a-z])?/gi,R=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,T=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,C=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,D=/^\[([^\]]*)\] ?\[([^\]]*)\]/,F=/(\[|\])/g,N=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,P=/\t/g,Z=/^ *\| */,G=/(^ *\||\| *$)/g,H=/ *$/,q=/^ *:-+: *$/,U=/^ *:-+ *$/,V=/^ *-+: *$/,W=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,Q=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/,X=/^==((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)==/,J=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,K=/^\\([^0-9A-Za-z\s])/,Y=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,tt=/^\n+/,nt=/^([ \t]*)/,et=/\\([^\\])/g,rt=/ *\n+$/,ot=/(?:^|\n)( *)$/,ct="(?:\\d+\\.)",at="(?:[*+-])";function _t(t){return"( *)("+(1===t?ct:at)+") +"}const ut=_t(1),it=_t(2);function st(t){return new RegExp("^"+(1===t?ut:it))}const lt=st(1),ft=st(2);function dt(t){return new RegExp("^"+(1===t?ut:it)+"[^\\n]*(?:\\n(?!\\1"+(1===t?ct:at)+" )[^\\n]*)*(\\n|$)","gm")}const pt=dt(1),mt=dt(2);function gt(t){const n=1===t?ct:at;return new RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}const yt=gt(1),ht=gt(2);function kt(t,n){const e=1===n,r=e?yt:ht,o=e?pt:mt,c=e?lt:ft;return{t(t,n,e){const o=ot.exec(e);return o&&(n.o||!n._&&!n.u)?r.exec(t=o[1]+t):null},i:Ht.HIGH,l(t,n,r){const a=e?+t[2]:void 0,_=t[0].replace(u,"\n").match(o);let i=!1;return{p:_.map(function(t,e){const o=c.exec(t)[0].length,a=new RegExp("^ {1,"+o+"}","gm"),u=t.replace(a,"").replace(c,""),s=e===_.length-1,l=-1!==u.indexOf("\n\n")||s&&i;i=l;const f=r._,d=r.o;let p;r.o=!0,l?(r._=!1,p=u.replace(rt,"\n\n")):(r._=!0,p=u.replace(rt,""));const m=n(p,r);return r._=f,r.o=d,m}),m:e,g:a}},h:(n,e,r)=>t(n.m?"ol":"ul",{key:r.k,start:n.g},n.p.map(function(n,o){return t("li",{key:o},e(n,r))}))}}const xt=/^\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,bt=/^!\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,$t=[i,d,p,$,S,v,A,R,pt,yt,mt,ht],vt=[...$t,/^[^\n]+(?: \n|\n{2,})/,z,L];function St(t){return t.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function zt(t){return V.test(t)?"right":q.test(t)?"center":U.test(t)?"left":null}function wt(t,n,e){const r=e.$;e.$=!0;const o=n(t.trim(),e);e.$=r;let c=[[]];return o.forEach(function(t,n){"tableSeparator"===t.type?0!==n&&n!==o.length-1&&c.push([]):("text"!==t.type||null!=o[n+1]&&"tableSeparator"!==o[n+1].type||(t.v=t.v.replace(H,"")),c[c.length-1].push(t))}),c}function At(t,n,e){e._=!0;const r=wt(t[1],n,e),o=t[2].replace(G,"").split("|").map(zt),c=function(t,n,e){return t.trim().split("\n").map(function(t){return wt(t,n,e)})}(t[3],n,e);return e._=!1,{S:o,A:c,L:r,type:"table"}}function Et(t,n){return null==t.S[n]?{}:{textAlign:t.S[n]}}function Lt(t){return function(n,e){return e._?t.exec(n):null}}function Mt(t){return function(n,e){return e._||e.u?t.exec(n):null}}function Ot(t){return function(n,e){return e._||e.u?null:t.exec(n)}}function It(t){return function(n){return t.exec(n)}}function jt(t,n,e){if(n._||n.u)return null;if(e&&!e.endsWith("\n"))return null;let r="";t.split("\n").every(t=>!$t.some(n=>n.test(t))&&(r+=t+"\n",t.trim()));const o=r.trimEnd();return""==o?null:[r,o]}function Bt(t){try{if(decodeURIComponent(t).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return}catch(t){return null}return t}function Rt(t){return t.replace(et,"$1")}function Tt(t,n,e){const r=e._||!1,o=e.u||!1;e._=!0,e.u=!0;const c=t(n,e);return e._=r,e.u=o,c}function Ct(t,n,e){const r=e._||!1,o=e.u||!1;e._=!1,e.u=!0;const c=t(n,e);return e._=r,e.u=o,c}function Dt(t,n,e){return e._=!1,t(n,e)}const Ft=(t,n,e)=>({v:Tt(n,t[1],e)});function Nt(){return{}}function Pt(){return null}function Zt(...t){return t.filter(Boolean).join(" ")}function Gt(t,n,e){let r=t;const o=n.split(".");for(;o.length&&(r=r[o[0]],void 0!==r);)o.shift();return r||e}var Ht;function qt(e,u={}){u.overrides=u.overrides||{},u.slugify=u.slugify||St,u.namedCodesToUnicode=u.namedCodesToUnicode?n({},o,u.namedCodesToUnicode):o;const G=u.createElement||t.createElement;function H(t,e,...r){const o=Gt(u.overrides,`${t}.props`,{});return G(function(t,n){const e=Gt(n,t);return e?"function"==typeof e||"object"==typeof e&&"render"in e?e:Gt(n,`${t}.component`,t):t}(t,u.overrides),n({},e,o,{className:Zt(null==e?void 0:e.className,o.className)||void 0}),...r)}function q(n){let e=!1;u.forceInline?e=!0:u.forceBlock||(e=!1===N.test(n));const r=ct(ot(e?n:`${n.trimEnd().replace(tt,"")}\n\n`,{_:e}));for(;"string"==typeof r[r.length-1]&&!r[r.length-1].trim();)r.pop();if(null===u.wrapper)return r;const o=u.wrapper||(e?"span":"div");let c;if(r.length>1||u.forceWrapper)c=r;else{if(1===r.length)return c=r[0],"string"==typeof c?H("span",{key:"outer"},c):c;c=null}return t.createElement(o,{key:"outer"},c)}function U(n){const e=n.match(a);return e?e.reduce(function(n,e,o){const c=e.indexOf("=");if(-1!==c){const a=function(t){return-1!==t.indexOf("-")&&null===t.match(E)&&(t=t.replace(B,function(t,n){return n.toUpperCase()})),t}(e.slice(0,c)).trim(),_=function(t){const n=t[0];return('"'===n||"'"===n)&&t.length>=2&&t[t.length-1]===n?t.slice(1,-1):t}(e.slice(c+1).trim()),u=r[a]||a,i=n[u]=function(t,n){return"style"===t?n.split(/;\s?/).reduce(function(t,n){const e=n.slice(0,n.indexOf(":"));return t[e.replace(/(-[a-z])/g,t=>t[1].toUpperCase())]=n.slice(e.length+1).trim(),t},{}):"href"===t?Bt(n):(n.match(M)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(a,_);"string"==typeof i&&(z.test(i)||L.test(i))&&(n[u]=t.cloneElement(q(i.trim()),{key:o}))}else"style"!==e&&(n[r[e]||e]=!0);return n},{}):null}const V=[],et={},rt={blockQuote:{t:Ot(i),i:Ht.HIGH,l:(t,n,e)=>({v:n(t[0].replace(s,""),e)}),h:(t,n,e)=>H("blockquote",{key:e.k},n(t.v,e))},breakLine:{t:It(l),i:Ht.HIGH,l:Nt,h:(t,n,e)=>H("br",{key:e.k})},breakThematic:{t:Ot(f),i:Ht.HIGH,l:Nt,h:(t,n,e)=>H("hr",{key:e.k})},codeBlock:{t:Ot(p),i:Ht.MAX,l:t=>({v:t[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),M:void 0}),h:(t,e,r)=>H("pre",{key:r.k},H("code",n({},t.O,{className:t.M?`lang-${t.M}`:""}),t.v))},codeFenced:{t:Ot(d),i:Ht.MAX,l:t=>({O:U(t[3]||""),v:t[4],M:t[2]||void 0,type:"codeBlock"})},codeInline:{t:Mt(m),i:Ht.LOW,l:t=>({v:t[2]}),h:(t,n,e)=>H("code",{key:e.k},t.v)},footnote:{t:Ot(h),i:Ht.MAX,l:t=>(V.push({I:t[2],j:t[1]}),{}),h:Pt},footnoteReference:{t:Lt(k),i:Ht.HIGH,l:t=>({v:t[1],B:`#${u.slugify(t[1])}`}),h:(t,n,e)=>H("a",{key:e.k,href:Bt(t.B)},H("sup",{key:e.k},t.v))},gfmTask:{t:Lt(b),i:Ht.HIGH,l:t=>({R:"x"===t[1].toLowerCase()}),h:(t,n,e)=>H("input",{checked:t.R,key:e.k,readOnly:!0,type:"checkbox"})},heading:{t:Ot(u.enforceAtxHeadings?v:$),i:Ht.HIGH,l:(t,n,e)=>({v:Tt(n,t[2],e),T:u.slugify(t[2]),C:t[1].length}),h:(t,n,e)=>H(`h${t.C}`,{id:t.T,key:e.k},n(t.v,e))},headingSetext:{t:Ot(S),i:Ht.MAX,l:(t,n,e)=>({v:Tt(n,t[1],e),C:"="===t[2]?1:2,type:"heading"})},htmlComment:{t:It(A),i:Ht.HIGH,l:()=>({}),h:Pt},image:{t:Mt(bt),i:Ht.HIGH,l:t=>({D:t[1],B:Rt(t[2]),F:t[3]}),h:(t,n,e)=>H("img",{key:e.k,alt:t.D||void 0,title:t.F||void 0,src:Bt(t.B)})},link:{t:Lt(xt),i:Ht.LOW,l:(t,n,e)=>({v:Ct(n,t[1],e),B:Rt(t[2]),F:t[3]}),h:(t,n,e)=>H("a",{key:e.k,href:Bt(t.B),title:t.F},n(t.v,e))},linkAngleBraceStyleDetector:{t:Lt(j),i:Ht.MAX,l:t=>({v:[{v:t[1],type:"text"}],B:t[1],type:"link"})},linkBareUrlDetector:{t:(t,n)=>n.N?null:Lt(O)(t,n),i:Ht.MAX,l:t=>({v:[{v:t[1],type:"text"}],B:t[1],F:void 0,type:"link"})},linkMailtoDetector:{t:Lt(I),i:Ht.MAX,l(t){let n=t[1],e=t[1];return _.test(e)||(e="mailto:"+e),{v:[{v:n.replace("mailto:",""),type:"text"}],B:e,type:"link"}}},orderedList:kt(H,1),unorderedList:kt(H,2),newlineCoalescer:{t:Ot(g),i:Ht.LOW,l:Nt,h:()=>"\n"},paragraph:{t:jt,i:Ht.LOW,l:Ft,h:(t,n,e)=>H("p",{key:e.k},n(t.v,e))},ref:{t:Lt(T),i:Ht.MAX,l:t=>(et[t[1]]={B:t[2],F:t[4]},{}),h:Pt},refImage:{t:Mt(C),i:Ht.MAX,l:t=>({D:t[1]||void 0,P:t[2]}),h:(t,n,e)=>H("img",{key:e.k,alt:t.D,src:Bt(et[t.P].B),title:et[t.P].F})},refLink:{t:Lt(D),i:Ht.MAX,l:(t,n,e)=>({v:n(t[1],e),Z:n(t[0].replace(F,"\\$1"),e),P:t[2]}),h:(t,n,e)=>et[t.P]?H("a",{key:e.k,href:Bt(et[t.P].B),title:et[t.P].F},n(t.v,e)):H("span",{key:e.k},n(t.Z,e))},table:{t:Ot(R),i:Ht.HIGH,l:At,h:(t,n,e)=>H("table",{key:e.k},H("thead",null,H("tr",null,t.L.map(function(r,o){return H("th",{key:o,style:Et(t,o)},n(r,e))}))),H("tbody",null,t.A.map(function(r,o){return H("tr",{key:o},r.map(function(r,o){return H("td",{key:o,style:Et(t,o)},n(r,e))}))})))},tableSeparator:{t:function(t,n){return n.$?(n._=!0,Z.exec(t)):null},i:Ht.HIGH,l:function(){return{type:"tableSeparator"}},h:()=>" | "},text:{t:It(Y),i:Ht.MIN,l:t=>({v:t[0].replace(w,(t,n)=>u.namedCodesToUnicode[n]?u.namedCodesToUnicode[n]:t)}),h:t=>t.v},textBolded:{t:Mt(W),i:Ht.MED,l:(t,n,e)=>({v:n(t[2],e)}),h:(t,n,e)=>H("strong",{key:e.k},n(t.v,e))},textEmphasized:{t:Mt(Q),i:Ht.LOW,l:(t,n,e)=>({v:n(t[2],e)}),h:(t,n,e)=>H("em",{key:e.k},n(t.v,e))},textEscaped:{t:Mt(K),i:Ht.HIGH,l:t=>({v:t[1],type:"text"})},textMarked:{t:Mt(X),i:Ht.LOW,l:Ft,h:(t,n,e)=>H("mark",{key:e.k},n(t.v,e))},textStrikethroughed:{t:Mt(J),i:Ht.LOW,l:Ft,h:(t,n,e)=>H("del",{key:e.k},n(t.v,e))}};!0!==u.disableParsingRawHTML&&(rt.htmlBlock={t:It(z),i:Ht.HIGH,l(t,n,e){const[,r]=t[3].match(nt),o=new RegExp(`^${r}`,"gm"),a=t[3].replace(o,""),_=(u=a,vt.some(t=>t.test(u))?Dt:Tt);var u;const i=t[1].toLowerCase(),s=-1!==c.indexOf(i);e.N=e.N||"a"===i;const l=s?t[3]:_(n,a,e);return e.N=!1,{O:U(t[2]),v:l,G:s,H:s?i:t[1]}},h:(t,e,r)=>H(t.H,n({key:r.k},t.O),t.G?t.v:e(t.v,r))},rt.htmlSelfClosing={t:It(L),i:Ht.HIGH,l:t=>({O:U(t[2]||""),H:t[1]}),h:(t,e,r)=>H(t.H,n({},t.O,{key:r.k}))});const ot=function(t){let n=Object.keys(t);function e(r,o){let c=[],a="";for(;r;){let _=0;for(;_<n.length;){const u=n[_],i=t[u],s=i.t(r,o,a);if(s){const t=s[0];r=r.substring(t.length);const n=i.l(s,e,o);null==n.type&&(n.type=u),c.push(n),a=t;break}_++}}return c}return n.sort(function(n,e){let r=t[n].i,o=t[e].i;return r!==o?r-o:n<e?-1:1}),function(t,n){return e(function(t){return t.replace(y,"\n").replace(x,"").replace(P," ")}(t),n)}}(rt),ct=(at=function(t){return function(n,e,r){return t[n.type].h(n,e,r)}}(rt),function t(n,e={}){if(Array.isArray(n)){const r=e.k,o=[];let c=!1;for(let r=0;r<n.length;r++){e.k=r;const a=t(n[r],e),_="string"==typeof a;_&&c?o[o.length-1]+=a:null!==a&&o.push(a),c=_}return e.k=r,o}return at(n,t,e)});var at;const _t=q(e);return V.length?H("div",null,_t,H("footer",{key:"footer"},V.map(function(t){return H("div",{id:u.slugify(t.j),key:t.j},t.j,ct(ot(t.I,{_:!0})))}))):_t}!function(t){t[t.MAX=0]="MAX",t[t.HIGH=1]="HIGH",t[t.MED=2]="MED",t[t.LOW=3]="LOW",t[t.MIN=4]="MIN"}(Ht||(Ht={}));export default n=>{let{children:r,options:o}=n,c=function(t,n){if(null==t)return{};var e,r,o={},c=Object.keys(t);for(r=0;r<c.length;r++)n.indexOf(e=c[r])>=0||(o[e]=t[e]);return o}(n,e);return t.cloneElement(qt(r,o),c)};export{qt as compiler};
|
|
2
2
|
//# sourceMappingURL=index.modern.js.map
|