markdown-to-jsx 7.0.0 → 7.1.2

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 CHANGED
@@ -12,6 +12,8 @@ The most lightweight, customizable React markdown component.
12
12
  - [Parsing Options](#parsing-options)
13
13
  - [options.forceBlock](#optionsforceblock)
14
14
  - [options.forceInline](#optionsforceinline)
15
+ - [options.wrapper](#optionswrapper)
16
+ - [options.forceWrapper](#optionsforcewrapper)
15
17
  - [options.overrides - Override Any HTML Tag's Representation](#optionsoverrides---override-any-html-tags-representation)
16
18
  - [options.overrides - Rendering Arbitrary React Components](#optionsoverrides---rendering-arbitrary-react-components)
17
19
  - [options.createElement - Custom React.createElement behavior](#optionscreateelement---custom-reactcreateelement-behavior)
@@ -127,6 +129,62 @@ compiler('# You got it babe!', { forceInline: true });
127
129
  <span># You got it babe!</span>;
128
130
  ```
129
131
 
132
+ #### options.wrapper
133
+
134
+ When there are multiple children to be rendered, the compiler will wrap the output in a `div` by default. You can override this default by setting the `wrapper` option to either a string (React Element) or a component.
135
+
136
+ ```jsx
137
+ const str = '# Heck Yes\n\nThis is great!'
138
+
139
+ <Markdown options={{ wrapper: 'article' }}>
140
+ {str}
141
+ </Markdown>;
142
+
143
+ // or
144
+
145
+ compiler(str, { wrapper: 'article' });
146
+
147
+ // renders
148
+
149
+ <article>
150
+ <h1>Heck Yes</h1>
151
+ <p>This is great!</p>
152
+ </article>
153
+ ```
154
+
155
+ ##### Other useful recipes
156
+
157
+ To get an array of children back without a wrapper, set `wrapper` to `null`. This is particularly useful when using `compiler(…)` directly.
158
+
159
+ ```jsx
160
+ compiler('One\n\nTwo\n\nThree', { wrapper: null });
161
+
162
+ // returns
163
+
164
+ [
165
+ (<p>One</p>),
166
+ (<p>Two</p>),
167
+ (<p>Three</p>)
168
+ ]
169
+ ```
170
+
171
+ To render children at the same DOM level as `<Markdown>` with no HTML wrapper, set `wrapper` to `React.Fragment`. This will still wrap your children in a React node for the purposes of rendering, but the wrapper element won't show up in the DOM.
172
+
173
+ #### options.forceWrapper
174
+
175
+ By default, the compiler does not wrap the rendered contents if there is only a single child. You can change this by setting `forceWrapper` to `true`. If the child is inline, it will not necessarily be wrapped in a `span`.
176
+
177
+ ```jsx
178
+ // Using `forceWrapper` with a single, inline child…
179
+ <Markdown options={{ wrapper: 'aside', forceWrapper: true }}>
180
+ Mumble, mumble…
181
+ </Markdown>
182
+
183
+ // renders
184
+
185
+ <aside>Mumble, mumble…</aside>
186
+ ```
187
+
130
188
  #### options.overrides - Override Any HTML Tag's Representation
131
189
 
132
190
  Pass the `options.overrides` prop to the compiler or `<Markdown>` component to seamlessly revise the rendered representation of any HTML tag. You can choose to change the component itself, add/change props, or both.
@@ -1,2 +1,22 @@
1
- import Markdown from './';
2
- export default Markdown;
1
+ /// <reference types="react" />
2
+ import { compiler } from './';
3
+ declare const _default: import("react").FC<{
4
+ [key: string]: any;
5
+ children: string;
6
+ options?: Partial<{
7
+ createElement: (tag: string | import("react").FunctionComponent<{}> | import("react").ComponentClass<{}, any>, props: import("react").Props<any>, ...children: import("react").ReactChild[]) => JSX.Element;
8
+ disableParsingRawHTML: boolean;
9
+ forceBlock: boolean;
10
+ forceInline: boolean;
11
+ namedCodesToUnicode: {
12
+ [key: string]: string;
13
+ };
14
+ overrides: import(".").MarkdownToJSX.Overrides;
15
+ wrapper: import("react").ElementType<any>;
16
+ forceWrapper: boolean;
17
+ slugify: (source: string) => string;
18
+ }>;
19
+ }> & {
20
+ compiler: typeof compiler;
21
+ };
22
+ export default _default;
package/dist/index.d.ts CHANGED
@@ -4,76 +4,136 @@
4
4
  * parsing infra... without it, half of the optimizations here wouldn't be feasible. 🙏🏼
5
5
  */
6
6
  import React from 'react';
7
- declare type CreateElement = typeof React.createElement;
8
- declare type HTMLTags = keyof JSX.IntrinsicElements;
9
- /**
10
- * RequireAtLeastOne<{ ... }> <- only requires at least one key
11
- */
12
- declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
13
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
14
- }[Keys];
15
- declare type Override = RequireAtLeastOne<{
16
- component: React.ComponentType<any>;
17
- props: Object;
18
- }> | React.ComponentType<any>;
19
- declare type Overrides = {
20
- [tag in HTMLTags]?: Override;
21
- } & {
22
- [customComponent: string]: Override;
23
- };
24
- declare type Options = Partial<{
25
- /**
26
- * Ultimate control over the output of all rendered JSX.
27
- */
28
- createElement: (tag: Parameters<CreateElement>[0], props: React.Props<any>, ...children: React.ReactChild[]) => JSX.Element;
7
+ export declare namespace MarkdownToJSX {
29
8
  /**
30
- * Disable the compiler's best-effort transcription of provided raw HTML
31
- * into JSX-equivalent. This is the functionality that prevents the need to
32
- * use `dangerouslySetInnerHTML` in React.
9
+ * RequireAtLeastOne<{ ... }> <- only requires at least one key
33
10
  */
34
- disableParsingRawHTML: boolean;
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
+ _list?: boolean;
18
+ inline?: boolean;
19
+ inTable?: boolean;
20
+ key?: React.Key;
21
+ simple?: boolean;
22
+ };
23
+ export type ParserResult = {
24
+ [key: string]: any;
25
+ type?: string;
26
+ };
27
+ export type NestedParser = (input: string, state?: MarkdownToJSX.State) => MarkdownToJSX.ParserResult;
28
+ export type Parser<ParserOutput> = (capture: RegExpMatchArray, nestedParse: NestedParser, state?: MarkdownToJSX.State) => ParserOutput;
29
+ export type RuleOutput = (ast: MarkdownToJSX.ParserResult, state: MarkdownToJSX.State) => JSX.Element;
30
+ export type Rule<ParserOutput = MarkdownToJSX.ParserResult> = {
31
+ match: (source: string, state: MarkdownToJSX.State, prevCapturedString?: string) => RegExpMatchArray;
32
+ order: Priority;
33
+ parse: MarkdownToJSX.Parser<ParserOutput>;
34
+ react?: (node: ParserOutput, output: RuleOutput, state?: MarkdownToJSX.State) => React.ReactChild;
35
+ };
36
+ export type Rules = {
37
+ [key: string]: Rule;
38
+ };
39
+ export type Override = RequireAtLeastOne<{
40
+ component: React.ElementType;
41
+ props: Object;
42
+ }> | React.ElementType;
43
+ export type Overrides = {
44
+ [tag in HTMLTags]?: Override;
45
+ } & {
46
+ [customComponent: string]: Override;
47
+ };
48
+ export type Options = Partial<{
49
+ /**
50
+ * Ultimate control over the output of all rendered JSX.
51
+ */
52
+ createElement: (tag: Parameters<CreateElement>[0], props: React.Props<any>, ...children: React.ReactChild[]) => JSX.Element;
53
+ /**
54
+ * Disable the compiler's best-effort transcription of provided raw HTML
55
+ * into JSX-equivalent. This is the functionality that prevents the need to
56
+ * use `dangerouslySetInnerHTML` in React.
57
+ */
58
+ disableParsingRawHTML: boolean;
59
+ /**
60
+ * Forces the compiler to always output content with a block-level wrapper
61
+ * (`<p>` or any block-level syntax your markdown already contains.)
62
+ */
63
+ forceBlock: boolean;
64
+ /**
65
+ * Forces the compiler to always output content with an inline wrapper (`<span>`)
66
+ */
67
+ forceInline: boolean;
68
+ /**
69
+ * Supply additional HTML entity: unicode replacement mappings.
70
+ *
71
+ * Pass only the inner part of the entity as the key,
72
+ * e.g. `&le;` -> `{ "le": "\u2264" }`
73
+ *
74
+ * By default
75
+ * the following entites are replaced with their unicode equivalents:
76
+ *
77
+ * ```
78
+ * &amp;
79
+ * &apos;
80
+ * &gt;
81
+ * &lt;
82
+ * &nbsp;
83
+ * &quot;
84
+ * ```
85
+ */
86
+ namedCodesToUnicode: {
87
+ [key: string]: string;
88
+ };
89
+ /**
90
+ * Selectively control the output of particular HTML tags as they would be
91
+ * emitted by the compiler.
92
+ */
93
+ overrides: Overrides;
94
+ /**
95
+ * Declare the type of the wrapper to be used when there are multiple
96
+ * children to render. Set to `null` to get an array of children back
97
+ * without any wrapper, or use `React.Fragment` to get a React element
98
+ * that won't show up in the DOM.
99
+ */
100
+ wrapper: React.ElementType | null;
101
+ /**
102
+ * Forces the compiler to wrap results, even if there is only a single
103
+ * child or no children.
104
+ */
105
+ forceWrapper: boolean;
106
+ /**
107
+ * Override normalization of non-URI-safe characters for use in generating
108
+ * HTML IDs for anchor linking purposes.
109
+ */
110
+ slugify: (source: string) => string;
111
+ }>;
112
+ export {};
113
+ }
114
+ declare enum Priority {
35
115
  /**
36
- * Forces the compiler to always output content with a block-level wrapper
37
- * (`<p>` or any block-level syntax your markdown already contains.)
116
+ * anything that must scan the tree before everything else
38
117
  */
39
- forceBlock: boolean;
118
+ MAX = 0,
40
119
  /**
41
- * Forces the compiler to always output content with an inline wrapper (`<span>`)
120
+ * scans for block-level constructs
42
121
  */
43
- forceInline: boolean;
122
+ HIGH = 1,
44
123
  /**
45
- * Supply additional HTML entity: unicode replacement mappings.
46
- *
47
- * Pass only the inner part of the entity as the key,
48
- * e.g. `&le;` -> `{ "le": "\u2264" }`
49
- *
50
- * By default
51
- * the following entites are replaced with their unicode equivalents:
52
- *
53
- * ```
54
- * &amp;
55
- * &apos;
56
- * &gt;
57
- * &lt;
58
- * &nbsp;
59
- * &quot;
60
- * ```
124
+ * inline w/ more priority than other inline
61
125
  */
62
- namedCodesToUnicode: {
63
- [key: string]: string;
64
- };
126
+ MED = 2,
65
127
  /**
66
- * Selectively control the output of particular HTML tags as they would be
67
- * emitted by the compiler.
128
+ * inline elements
68
129
  */
69
- overrides: Overrides;
130
+ LOW = 3,
70
131
  /**
71
- * Override normalization of non-URI-safe characters for use in generating
72
- * HTML IDs for anchor linking purposes.
132
+ * bare text and stuff that is considered leftovers
73
133
  */
74
- slugify: (source: string) => string;
75
- }>;
76
- export declare function compiler(markdown: string, options?: Options): JSX.Element;
134
+ MIN = 4
135
+ }
136
+ export declare function compiler(markdown: string, options?: MarkdownToJSX.Options): JSX.Element;
77
137
  /**
78
138
  * A simple HOC for easy React use. Feed the markdown content as a direct child
79
139
  * and the rest is taken care of automatically.
@@ -81,6 +141,6 @@ export declare function compiler(markdown: string, options?: Options): JSX.Eleme
81
141
  declare const Markdown: React.FC<{
82
142
  [key: string]: any;
83
143
  children: string;
84
- options?: Options;
144
+ options?: MarkdownToJSX.Options;
85
145
  }>;
86
146
  export default Markdown;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach(function(t){n(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var c=/[\'\"]/,o={accesskey:"accessKey",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},i={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},l=["style","script"],u=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,s=/mailto:/i,f=/\n{2,}$/,p=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,d=/^ *> ?/gm,g=/^ {2,}\n/,m=/^(?:( *[-*_]) *){3,}(?:\n *)+\n/,y=/^\s*(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n *)+\n?/,h=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,k=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,v=/^(?:\n *)*\n/,b=/\r\n?/g,x=/^\[\^([^\]]+)](:.*)\n/,O=/^\[\^([^\]]+)]/,H=/\f/g,S=/^\s*?\[(x|\s)\]/,w=/^ *(#{1,6}) *([^\n]+)\n{0,2}/,I=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,A=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,M=/&([a-z]+);/g,j=/^<!--.*?-->/,E=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,C=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,G=/^\{.*\}$/,L=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,$=/^<([^ >]+@[^ >]+)>/,T=/^<([^ >]+:\/[^ >]+)>/,P=/ *\n+$/,z=/(?:^|\n)( *)$/,X=/-([a-z])?/gi,D=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,R=/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/,_=/^\[([^\]]*)\]:\s*(\S+)\s*("([^"]*)")?/,B=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,N=/^\[([^\]]*)\] ?\[([^\]]*)\]/,U=/(\[|\])/g,W=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Z=/\t/g,F=/^ *\| */,q=/(^ *\||\| *$)/g,V=/ *$/,K=/^ *:-+: *$/,Q=/^ *:-+ *$/,J=/^ *-+: *$/,Y=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,ee=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1)/,te=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,ne=/^\\([^0-9A-Za-z\s])/,re=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ae=/(^\n+|\n+$|\s+$)/g,ce=/^([ \t]*)/,oe=/\\([^0-9A-Z\s])/gi,ie=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +"),le=new RegExp("( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\\n|$)","gm"),ue=new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) (?!(?:[*+-]|\\d+\\.) ))\\n*|\\s*\\n*$)"),se="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",fe=new RegExp("^\\[("+se+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),pe=new RegExp("^!\\[("+se+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),de=[p,h,y,w,I,A,j,C,le,ue,D,R];function ge(e){return e.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 me(e){return J.test(e)?"right":K.test(e)?"center":Q.test(e)?"left":null}function ye(e,t,n){var r=n.inTable;n.inTable=!0;var a=t(e.trim(),n);n.inTable=r;var c=[[]];return a.forEach(function(e,t){"tableSeparator"===e.type?0!==t&&t!==a.length-1&&c.push([]):("text"!==e.type||null!=a[t+1]&&"tableSeparator"!==a[t+1].type||(e.content=e.content.replace(V,"")),c[c.length-1].push(e))}),c}function he(e,t,n){n.inline=!0;var r=ye(e[1],t,n),a=e[2].replace(q,"").split("|").map(me),c=function(e,t,n){return e.trim().split("\n").map(function(e){return ye(e,t,n)})}(e[3],t,n);return n.inline=!1,{align:a,cells:c,header:r,type:"table"}}function ke(e,t){return null==e.align[t]?{}:{textAlign:e.align[t]}}function ve(e){return function(t,n){return n.inline?e.exec(t):null}}function be(e){return function(t,n){return n.inline||n.simple?e.exec(t):null}}function xe(e){return function(t,n){return n.inline||n.simple?null:e.exec(t)}}function Oe(e){return function(t){return e.exec(t)}}function He(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data):/i))return null}catch(e){return null}return e}function Se(e){return e.replace(oe,"$1")}function we(e,t,n){var r=n.inline||!1,a=n.simple||!1;n.inline=!0,n.simple=!0;var c=e(t,n);return n.inline=r,n.simple=a,c}function Ie(e,t,n){var r=n.inline||!1,a=n.simple||!1;n.inline=!1,n.simple=!0;var c=e(t,n);return n.inline=r,n.simple=a,c}function Ae(e,t,n){return n.inline=!1,e(t+"\n\n",n)}var Me,je=function(e,t,n){return{content:we(t,e[1],n)}};function Ee(){return{}}function Ce(){return null}function Ge(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Le(e,t,n){for(var r=e,a=t.split(".");a.length&&void 0!==(r=r[a[0]]);)a.shift();return r||n}function $e(e,t){var n=Le(t,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:Le(t,e+".component",e):e}function Te(e,n){void 0===n&&(n={}),n.overrides=n.overrides||{},n.slugify=n.slugify||ge,n.namedCodesToUnicode=n.namedCodesToUnicode?a(a({},i),n.namedCodesToUnicode):i;var r=n.createElement||t.createElement;function q(e,t){var c=Le(n.overrides,e+".props",{});return r.apply(void 0,[$e(e,n.overrides),a(a(a({},t),c),{},{className:Ge(null==t?void 0:t.className,c.className)||void 0})].concat([].slice.call(arguments,2)))}function V(e){var t=!1;n.forceInline?t=!0:n.forceBlock||(t=!1===W.test(e));var r,a=ye(me(t?e:e.replace(ae,"")+"\n\n",{inline:t}));return a.length>1?r=q(t?"span":"div",{key:"outer"},a):1===a.length?"string"==typeof(r=a[0])&&(r=q("span",{key:"outer"},r)):r=q("span",{key:"outer"}),r}function K(e){var n=e.match(u);return n?n.reduce(function(e,n,r){var a=n.indexOf("=");if(-1!==a){var i=function(e){return-1!==e.indexOf("-")&&null===e.match(E)&&(e=e.replace(X,function(e,t){return t.toUpperCase()})),e}(n.slice(0,a)).trim(),l=function(e){return e?(c.test(e.charAt(0))&&(e=e.substr(1)),c.test(e.charAt(e.length-1))&&(e=e.substr(0,e.length-1)),e):""}(n.slice(a+1).trim()),u=o[i]||i,s=e[u]=function(e,t){return"style"===e?t.split(/;\s?/).reduce(function(e,t){var n=t.slice(0,t.indexOf(":"));return e[n.replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=t.slice(n.length+1).trim(),e},{}):"href"===e?He(t):(t.match(G)&&(t=t.slice(1,t.length-1)),"true"===t||"false"!==t&&t)}(i,l);"string"==typeof s&&(A.test(s)||C.test(s))&&(e[u]=t.cloneElement(V(s.trim()),{key:r}))}else"style"!==n&&(e[o[n]||n]=!0);return e},{}):void 0}var Q=[],J={},oe={blockQuote:{match:xe(p),order:Me.HIGH,parse:function(e,t,n){return{content:t(e[0].replace(d,""),n)}},react:function(e,t,n){return q("blockquote",{key:n.key},t(e.content,n))}},breakLine:{match:Oe(g),order:Me.HIGH,parse:Ee,react:function(e,t,n){return q("br",{key:n.key})}},breakThematic:{match:xe(m),order:Me.HIGH,parse:Ee,react:function(e,t,n){return q("hr",{key:n.key})}},codeBlock:{match:xe(h),order:Me.MAX,parse:function(e){return{content:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),lang:void 0}},react:function(e,t,n){return q("pre",{key:n.key},q("code",{className:e.lang?"lang-"+e.lang:""},e.content))}},codeFenced:{match:xe(y),order:Me.MAX,parse:function(e){return{content:e[3],lang:e[2]||void 0,type:"codeBlock"}}},codeInline:{match:be(k),order:Me.LOW,parse:function(e){return{content:e[2]}},react:function(e,t,n){return q("code",{key:n.key},e.content)}},footnote:{match:xe(x),order:Me.MAX,parse:function(e){return Q.push({footnote:e[2],identifier:e[1]}),{}},react:Ce},footnoteReference:{match:ve(O),order:Me.HIGH,parse:function(e){return{content:e[1],target:"#"+n.slugify(e[1])}},react:function(e,t,n){return q("a",{key:n.key,href:He(e.target)},q("sup",{key:n.key},e.content))}},gfmTask:{match:ve(S),order:Me.HIGH,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},react:function(e,t,n){return q("input",{checked:e.completed,key:n.key,readOnly:!0,type:"checkbox"})}},heading:{match:xe(w),order:Me.HIGH,parse:function(e,t,r){return{content:we(t,e[2],r),id:n.slugify(e[2]),level:e[1].length}},react:function(e,t,n){return e.tag="h"+e.level,q(e.tag,{id:e.id,key:n.key},t(e.content,n))}},headingSetext:{match:xe(I),order:Me.MAX,parse:function(e,t,n){return{content:we(t,e[1],n),level:"="===e[2]?1:2,type:"heading"}}},htmlComment:{match:Oe(j),order:Me.HIGH,parse:function(){return{}},react:Ce},image:{match:be(pe),order:Me.HIGH,parse:function(e){return{alt:e[1],target:Se(e[2]),title:e[3]}},react:function(e,t,n){return q("img",{key:n.key,alt:e.alt||void 0,title:e.title||void 0,src:He(e.target)})}},link:{match:ve(fe),order:Me.LOW,parse:function(e,t,n){return{content:Ie(t,e[1],n),target:Se(e[2]),title:e[3]}},react:function(e,t,n){return q("a",{key:n.key,href:He(e.target),title:e.title},t(e.content,n))}},linkAngleBraceStyleDetector:{match:ve(T),order:Me.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],type:"link"}}},linkBareUrlDetector:{match:ve(L),order:Me.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],title:void 0,type:"link"}}},linkMailtoDetector:{match:ve($),order:Me.MAX,parse:function(e){var t=e[1],n=e[1];return s.test(n)||(n="mailto:"+n),{content:[{content:t.replace("mailto:",""),type:"text"}],target:n,type:"link"}}},list:{match:function(e,t,n){var r=z.exec(n);return!r||!t._list&&t.inline?null:ue.exec(e=r[1]+e)},order:Me.HIGH,parse:function(e,t,n){var r=e[2],a=r.length>1,c=a?+r:void 0,o=e[0].replace(f,"\n").match(le),i=!1;return{items:o.map(function(e,r){var a=ie.exec(e)[0].length,c=new RegExp("^ {1,"+a+"}","gm"),l=e.replace(c,"").replace(ie,""),u=r===o.length-1,s=-1!==l.indexOf("\n\n")||u&&i;i=s;var f,p=n.inline,d=n._list;n._list=!0,s?(n.inline=!1,f=l.replace(P,"\n\n")):(n.inline=!0,f=l.replace(P,""));var g=t(f,n);return n.inline=p,n._list=d,g}),ordered:a,start:c}},react:function(e,t,n){return q(e.ordered?"ol":"ul",{key:n.key,start:e.start},e.items.map(function(e,r){return q("li",{key:r},t(e,n))}))}},newlineCoalescer:{match:xe(v),order:Me.LOW,parse:Ee,react:function(){return"\n"}},paragraph:{match:xe(R),order:Me.LOW,parse:je,react:function(e,t,n){return q("p",{key:n.key},t(e.content,n))}},ref:{match:ve(_),order:Me.MAX,parse:function(e){return J[e[1]]={target:e[2],title:e[4]},{}},react:Ce},refImage:{match:be(B),order:Me.MAX,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},react:function(e,t,n){return q("img",{key:n.key,alt:e.alt,src:He(J[e.ref].target),title:J[e.ref].title})}},refLink:{match:ve(N),order:Me.MAX,parse:function(e,t,n){return{content:t(e[1],n),fallbackContent:t(e[0].replace(U,"\\$1"),n),ref:e[2]}},react:function(e,t,n){return J[e.ref]?q("a",{key:n.key,href:He(J[e.ref].target),title:J[e.ref].title},t(e.content,n)):q("span",{key:n.key},t(e.fallbackContent,n))}},table:{match:xe(D),order:Me.HIGH,parse:he,react:function(e,t,n){return q("table",{key:n.key},q("thead",null,q("tr",null,e.header.map(function(r,a){return q("th",{key:a,style:ke(e,a)},t(r,n))}))),q("tbody",null,e.cells.map(function(r,a){return q("tr",{key:a},r.map(function(r,a){return q("td",{key:a,style:ke(e,a)},t(r,n))}))})))}},tableSeparator:{match:function(e,t){return t.inTable?F.exec(e):null},order:Me.HIGH,parse:function(){return{type:"tableSeparator"}},react:function(){return" | "}},text:{match:Oe(re),order:Me.MIN,parse:function(e){return{content:e[0].replace(M,function(e,t){return n.namedCodesToUnicode[t]?n.namedCodesToUnicode[t]:e})}},react:function(e){return e.content}},textBolded:{match:be(Y),order:Me.MED,parse:function(e,t,n){return{content:t(e[2],n)}},react:function(e,t,n){return q("strong",{key:n.key},t(e.content,n))}},textEmphasized:{match:be(ee),order:Me.LOW,parse:function(e,t,n){return{content:t(e[2],n)}},react:function(e,t,n){return q("em",{key:n.key},t(e.content,n))}},textEscaped:{match:be(ne),order:Me.HIGH,parse:function(e){return{content:e[1],type:"text"}}},textStrikethroughed:{match:be(te),order:Me.LOW,parse:je,react:function(e,t,n){return q("del",{key:n.key},t(e.content,n))}}};!0!==n.disableParsingRawHTML&&(oe.htmlBlock={match:Oe(A),order:Me.HIGH,parse:function(e,t,n){var r,a=e[3].match(ce),c=new RegExp("^"+a[1],"gm"),o=e[3].replace(c,""),i=(r=o,de.some(function(e){return e.test(r)})?Ae:we),u=e[1].toLowerCase(),s=-1!==l.indexOf(u);return{attrs:K(e[2]),content:s?e[3]:i(t,o,n),noInnerParse:s,tag:s?u:e[1]}},react:function(e,t,n){return q(e.tag,Object.assign({key:n.key},e.attrs),e.noInnerParse?e.content:t(e.content,n))}},oe.htmlSelfClosing={match:Oe(C),order:Me.HIGH,parse:function(e){return{attrs:K(e[2]||""),tag:e[1]}},react:function(e,t,n){return q(e.tag,Object.assign({},e.attrs,{key:n.key}))}});var se,me=function(e){var t=Object.keys(e);function n(r,a){for(var c=[],o="";r;)for(var i=0;i<t.length;){var l=t[i],u=e[l],s=u.match(r,a,o);if(s){var f=s[0];r=r.substring(f.length);var p=u.parse(s,n,a);null==p.type&&(p.type=l),c.push(p),o=f;break}i++}return c}return t.sort(function(t,n){var r=e[t].order,a=e[n].order;return r!==a?r-a:t<n?-1:1}),function(e,t){return n(function(e){return e.replace(b,"\n").replace(H,"").replace(Z," ")}(e),t)}}(oe),ye=(se=function(e){return function(t,n,r){return e[t.type].react(t,n,r)}}(oe),function e(t,n){if(void 0===n&&(n={}),Array.isArray(t)){for(var r=n.key,a=[],c=!1,o=0;o<t.length;o++){n.key=o;var i=e(t[o],n),l="string"==typeof i;l&&c?a[a.length-1]+=i:a.push(i),c=l}return n.key=r,a}return se(t,e,n)}),Te=V(e.replace(/<!--[\s\S]*?(?:-->)/g,""));return Q.length&&Te.props.children.push(q("footer",{key:"footer"},Q.map(function(e){return q("div",{id:n.slugify(e.identifier),key:e.identifier},e.identifier,ye(me(e.footnote,{inline:!0})))}))),Te}!function(e){e[e.MAX=0]="MAX",e[e.HIGH=1]="HIGH",e[e.MED=2]="MED",e[e.LOW=3]="LOW",e[e.MIN=4]="MIN"}(Me||(Me={}));var Pe=function(e){var n=e.children,r=e.options,a=function(e,t){if(null==e)return{};var n,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)t.indexOf(n=c[r])>=0||(a[n]=e[n]);return a}(e,["children","options"]);return t.cloneElement(Te(n,r),a)};Object.assign(Pe,{compiler:Te}),module.exports=Pe;
1
+ function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=e(require("react"));function t(){return(t=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var r=/[\'\"]/,a={accesskey:"accessKey",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},c={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},o=["style","script"],i=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,l=/mailto:/i,u=/\n{2,}$/,s=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,f=/^ *> ?/gm,p=/^ {2,}\n/,d=/^(?:( *[-*_]) *){3,}(?:\n *)+\n/,m=/^\s*(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n *)+\n?/,g=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,y=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,h=/^(?:\n *)*\n/,k=/\r\n?/g,v=/^\[\^([^\]]+)](:.*)\n/,x=/^\[\^([^\]]+)]/,b=/\f/g,H=/^\s*?\[(x|\s)\]/,I=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,S=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,O=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,A=/&([a-z]+);/g,M=/^<!--[\s\S]*?(?:-->)/,w=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,E=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,$=/^\{.*\}$/,C=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,G=/^<([^ >]+@[^ >]+)>/,L=/^<([^ >]+:\/[^ >]+)>/,T=/ *\n+$/,z=/(?:^|\n)( *)$/,X=/-([a-z])?/gi,j=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,R=/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/,W=/^\[([^\]]*)\]:\s*(\S+)\s*("([^"]*)")?/,_=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,B=/^\[([^\]]*)\] ?\[([^\]]*)\]/,N=/(\[|\])/g,U=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,D=/\t/g,P=/^ *\| */,Z=/(^ *\||\| *$)/g,F=/ *$/,q=/^ *:-+: *$/,V=/^ *:-+ *$/,K=/^ *-+: *$/,Q=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,J=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1)/,Y=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,ee=/^\\([^0-9A-Za-z\s])/,ne=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,te=/(^\n+|\n+$|\s+$)/g,re=/^([ \t]*)/,ae=/\\([^0-9A-Z\s])/gi,ce=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +"),oe=new RegExp("( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\\n|$)","gm"),ie=new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) (?!(?:[*+-]|\\d+\\.) ))\\n*|\\s*\\n*$)"),le="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",ue=new RegExp("^\\[("+le+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),se=new RegExp("^!\\[("+le+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),fe=[s,g,m,I,S,O,M,E,oe,ie,j,R];function pe(e){return e.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 de(e){return K.test(e)?"right":q.test(e)?"center":V.test(e)?"left":null}function me(e,n,t){var r=t.inTable;t.inTable=!0;var a=n(e.trim(),t);t.inTable=r;var c=[[]];return a.forEach(function(e,n){"tableSeparator"===e.type?0!==n&&n!==a.length-1&&c.push([]):("text"!==e.type||null!=a[n+1]&&"tableSeparator"!==a[n+1].type||(e.content=e.content.replace(F,"")),c[c.length-1].push(e))}),c}function ge(e,n,t){t.inline=!0;var r=me(e[1],n,t),a=e[2].replace(Z,"").split("|").map(de),c=function(e,n,t){return e.trim().split("\n").map(function(e){return me(e,n,t)})}(e[3],n,t);return t.inline=!1,{align:a,cells:c,header:r,type:"table"}}function ye(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function he(e){return function(n,t){return t.inline?e.exec(n):null}}function ke(e){return function(n,t){return t.inline||t.simple?e.exec(n):null}}function ve(e){return function(n,t){return t.inline||t.simple?null:e.exec(n)}}function xe(e){return function(n){return e.exec(n)}}function be(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data):/i))return null}catch(e){return null}return e}function He(e){return e.replace(ae,"$1")}function Ie(e,n,t){var r=t.inline||!1,a=t.simple||!1;t.inline=!0,t.simple=!0;var c=e(n,t);return t.inline=r,t.simple=a,c}function Se(e,n,t){var r=t.inline||!1,a=t.simple||!1;t.inline=!1,t.simple=!0;var c=e(n,t);return t.inline=r,t.simple=a,c}function Oe(e,n,t){return t.inline=!1,e(n+"\n\n",t)}var Ae,Me=function(e,n,t){return{content:Ie(n,e[1],t)}};function we(){return{}}function Ee(){return null}function $e(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Ce(e,n,t){for(var r=e,a=n.split(".");a.length&&void 0!==(r=r[a[0]]);)a.shift();return r||t}function Ge(e,n){var t=Ce(n,e);return t?"function"==typeof t||"object"==typeof t&&"render"in t?t:Ce(n,e+".component",e):e}function Le(e,Z){void 0===Z&&(Z={}),Z.overrides=Z.overrides||{},Z.slugify=Z.slugify||pe,Z.namedCodesToUnicode=Z.namedCodesToUnicode?t({},c,Z.namedCodesToUnicode):c;var F=Z.createElement||n.default.createElement;function q(e,n){var r=Ce(Z.overrides,e+".props",{});return F.apply(void 0,[Ge(e,Z.overrides),t({},n,r,{className:$e(null==n?void 0:n.className,r.className)||void 0})].concat([].slice.call(arguments,2)))}function V(e){var t=!1;Z.forceInline?t=!0:Z.forceBlock||(t=!1===U.test(e));var r=Te(Le(t?e:e.replace(te,"")+"\n\n",{inline:t}));if(null===Z.wrapper)return r;var a,c=Z.wrapper||(t?"span":"div");if(r.length>1||Z.forceWrapper)a=r;else{if(1===r.length)return"string"==typeof(a=r[0])?q("span",{key:"outer"},a):a;a=null}return n.default.createElement(c,{key:"outer"},a)}function K(e){var t=e.match(i);return t?t.reduce(function(e,t,c){var o=t.indexOf("=");if(-1!==o){var i=function(e){return-1!==e.indexOf("-")&&null===e.match(w)&&(e=e.replace(X,function(e,n){return n.toUpperCase()})),e}(t.slice(0,o)).trim(),l=function(e){return e?(r.test(e.charAt(0))&&(e=e.substr(1)),r.test(e.charAt(e.length-1))&&(e=e.substr(0,e.length-1)),e):""}(t.slice(o+1).trim()),u=a[i]||i,s=e[u]=function(e,n){return"style"===e?n.split(/;\s?/).reduce(function(e,n){var t=n.slice(0,n.indexOf(":"));return e[t.replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=n.slice(t.length+1).trim(),e},{}):"href"===e?be(n):(n.match($)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(i,l);"string"==typeof s&&(O.test(s)||E.test(s))&&(e[u]=n.default.cloneElement(V(s.trim()),{key:c}))}else"style"!==t&&(e[a[t]||t]=!0);return e},{}):void 0}var ae=[],le={},de={blockQuote:{match:ve(s),order:Ae.HIGH,parse:function(e,n,t){return{content:n(e[0].replace(f,""),t)}},react:function(e,n,t){return q("blockquote",{key:t.key},n(e.content,t))}},breakLine:{match:xe(p),order:Ae.HIGH,parse:we,react:function(e,n,t){return q("br",{key:t.key})}},breakThematic:{match:ve(d),order:Ae.HIGH,parse:we,react:function(e,n,t){return q("hr",{key:t.key})}},codeBlock:{match:ve(g),order:Ae.MAX,parse:function(e){return{content:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),lang:void 0}},react:function(e,n,t){return q("pre",{key:t.key},q("code",{className:e.lang?"lang-"+e.lang:""},e.content))}},codeFenced:{match:ve(m),order:Ae.MAX,parse:function(e){return{content:e[3],lang:e[2]||void 0,type:"codeBlock"}}},codeInline:{match:ke(y),order:Ae.LOW,parse:function(e){return{content:e[2]}},react:function(e,n,t){return q("code",{key:t.key},e.content)}},footnote:{match:ve(v),order:Ae.MAX,parse:function(e){return ae.push({footnote:e[2],identifier:e[1]}),{}},react:Ee},footnoteReference:{match:he(x),order:Ae.HIGH,parse:function(e){return{content:e[1],target:"#"+Z.slugify(e[1])}},react:function(e,n,t){return q("a",{key:t.key,href:be(e.target)},q("sup",{key:t.key},e.content))}},gfmTask:{match:he(H),order:Ae.HIGH,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},react:function(e,n,t){return q("input",{checked:e.completed,key:t.key,readOnly:!0,type:"checkbox"})}},heading:{match:ve(I),order:Ae.HIGH,parse:function(e,n,t){return{content:Ie(n,e[2],t),id:Z.slugify(e[2]),level:e[1].length}},react:function(e,n,t){return e.tag="h"+e.level,q(e.tag,{id:e.id,key:t.key},n(e.content,t))}},headingSetext:{match:ve(S),order:Ae.MAX,parse:function(e,n,t){return{content:Ie(n,e[1],t),level:"="===e[2]?1:2,type:"heading"}}},htmlComment:{match:xe(M),order:Ae.HIGH,parse:function(){return{}},react:Ee},image:{match:ke(se),order:Ae.HIGH,parse:function(e){return{alt:e[1],target:He(e[2]),title:e[3]}},react:function(e,n,t){return q("img",{key:t.key,alt:e.alt||void 0,title:e.title||void 0,src:be(e.target)})}},link:{match:he(ue),order:Ae.LOW,parse:function(e,n,t){return{content:Se(n,e[1],t),target:He(e[2]),title:e[3]}},react:function(e,n,t){return q("a",{key:t.key,href:be(e.target),title:e.title},n(e.content,t))}},linkAngleBraceStyleDetector:{match:he(L),order:Ae.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],type:"link"}}},linkBareUrlDetector:{match:he(C),order:Ae.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],title:void 0,type:"link"}}},linkMailtoDetector:{match:he(G),order:Ae.MAX,parse:function(e){var n=e[1],t=e[1];return l.test(t)||(t="mailto:"+t),{content:[{content:n.replace("mailto:",""),type:"text"}],target:t,type:"link"}}},list:{match:function(e,n,t){var r=z.exec(t);return!r||!n._list&&n.inline?null:ie.exec(e=r[1]+e)},order:Ae.HIGH,parse:function(e,n,t){var r=e[2],a=r.length>1,c=a?+r:void 0,o=e[0].replace(u,"\n").match(oe),i=!1;return{items:o.map(function(e,r){var a=ce.exec(e)[0].length,c=new RegExp("^ {1,"+a+"}","gm"),l=e.replace(c,"").replace(ce,""),u=r===o.length-1,s=-1!==l.indexOf("\n\n")||u&&i;i=s;var f,p=t.inline,d=t._list;t._list=!0,s?(t.inline=!1,f=l.replace(T,"\n\n")):(t.inline=!0,f=l.replace(T,""));var m=n(f,t);return t.inline=p,t._list=d,m}),ordered:a,start:c}},react:function(e,n,t){return q(e.ordered?"ol":"ul",{key:t.key,start:e.start},e.items.map(function(e,r){return q("li",{key:r},n(e,t))}))}},newlineCoalescer:{match:ve(h),order:Ae.LOW,parse:we,react:function(){return"\n"}},paragraph:{match:ve(R),order:Ae.LOW,parse:Me,react:function(e,n,t){return q("p",{key:t.key},n(e.content,t))}},ref:{match:he(W),order:Ae.MAX,parse:function(e){return le[e[1]]={target:e[2],title:e[4]},{}},react:Ee},refImage:{match:ke(_),order:Ae.MAX,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},react:function(e,n,t){return q("img",{key:t.key,alt:e.alt,src:be(le[e.ref].target),title:le[e.ref].title})}},refLink:{match:he(B),order:Ae.MAX,parse:function(e,n,t){return{content:n(e[1],t),fallbackContent:n(e[0].replace(N,"\\$1"),t),ref:e[2]}},react:function(e,n,t){return le[e.ref]?q("a",{key:t.key,href:be(le[e.ref].target),title:le[e.ref].title},n(e.content,t)):q("span",{key:t.key},n(e.fallbackContent,t))}},table:{match:ve(j),order:Ae.HIGH,parse:ge,react:function(e,n,t){return q("table",{key:t.key},q("thead",null,q("tr",null,e.header.map(function(r,a){return q("th",{key:a,style:ye(e,a)},n(r,t))}))),q("tbody",null,e.cells.map(function(r,a){return q("tr",{key:a},r.map(function(r,a){return q("td",{key:a,style:ye(e,a)},n(r,t))}))})))}},tableSeparator:{match:function(e,n){return n.inTable?P.exec(e):null},order:Ae.HIGH,parse:function(){return{type:"tableSeparator"}},react:function(){return" | "}},text:{match:xe(ne),order:Ae.MIN,parse:function(e){return{content:e[0].replace(A,function(e,n){return Z.namedCodesToUnicode[n]?Z.namedCodesToUnicode[n]:e})}},react:function(e){return e.content}},textBolded:{match:ke(Q),order:Ae.MED,parse:function(e,n,t){return{content:n(e[2],t)}},react:function(e,n,t){return q("strong",{key:t.key},n(e.content,t))}},textEmphasized:{match:ke(J),order:Ae.LOW,parse:function(e,n,t){return{content:n(e[2],t)}},react:function(e,n,t){return q("em",{key:t.key},n(e.content,t))}},textEscaped:{match:ke(ee),order:Ae.HIGH,parse:function(e){return{content:e[1],type:"text"}}},textStrikethroughed:{match:ke(Y),order:Ae.LOW,parse:Me,react:function(e,n,t){return q("del",{key:t.key},n(e.content,t))}}};!0!==Z.disableParsingRawHTML&&(de.htmlBlock={match:xe(O),order:Ae.HIGH,parse:function(e,n,t){var r,a=e[3].match(re),c=new RegExp("^"+a[1],"gm"),i=e[3].replace(c,""),l=(r=i,fe.some(function(e){return e.test(r)})?Oe:Ie),u=e[1].toLowerCase(),s=-1!==o.indexOf(u);return{attrs:K(e[2]),content:s?e[3]:l(n,i,t),noInnerParse:s,tag:s?u:e[1]}},react:function(e,n,t){return q(e.tag,Object.assign({key:t.key},e.attrs),e.noInnerParse?e.content:n(e.content,t))}},de.htmlSelfClosing={match:xe(E),order:Ae.HIGH,parse:function(e){return{attrs:K(e[2]||""),tag:e[1]}},react:function(e,n,t){return q(e.tag,Object.assign({},e.attrs,{key:t.key}))}});var me,Le=function(e){var n=Object.keys(e);function t(r,a){for(var c=[],o="";r;)for(var i=0;i<n.length;){var l=n[i],u=e[l],s=u.match(r,a,o);if(s){var f=s[0];r=r.substring(f.length);var p=u.parse(s,t,a);null==p.type&&(p.type=l),c.push(p),o=f;break}i++}return c}return n.sort(function(n,t){var r=e[n].order,a=e[t].order;return r!==a?r-a:n<t?-1:1}),function(e,n){return t(function(e){return e.replace(k,"\n").replace(b,"").replace(D," ")}(e),n)}}(de),Te=(me=function(e){return function(n,t,r){return e[n.type].react(n,t,r)}}(de),function e(n,t){if(void 0===t&&(t={}),Array.isArray(n)){for(var r=t.key,a=[],c=!1,o=0;o<n.length;o++){t.key=o;var i=e(n[o],t),l="string"==typeof i;l&&c?a[a.length-1]+=i:a.push(i),c=l}return t.key=r,a}return me(n,e,t)}),ze=V(e);return ae.length&&ze.props.children.push(q("footer",{key:"footer"},ae.map(function(e){return q("div",{id:Z.slugify(e.identifier),key:e.identifier},e.identifier,Te(Le(e.footnote,{inline:!0})))}))),ze}!function(e){e[e.MAX=0]="MAX",e[e.HIGH=1]="HIGH",e[e.MED=2]="MED",e[e.LOW=3]="LOW",e[e.MIN=4]="MIN"}(Ae||(Ae={}));var Te=function(e){var t=e.children,r=e.options,a=function(e,n){if(null==e)return{};var t,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)n.indexOf(t=c[r])>=0||(a[t]=e[t]);return a}(e,["children","options"]);return n.default.cloneElement(Le(t,r),a)};Object.assign(Te,{compiler:Le}),module.exports=Te;
2
2
  //# sourceMappingURL=index.js.map