markdown-to-jsx 7.1.0 → 7.1.4
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 +99 -51
- package/dist/index.cjs.d.ts +22 -2
- package/dist/index.d.ts +12 -11
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- 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/package.json +21 -16
package/README.md
CHANGED
|
@@ -2,34 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
The most lightweight, customizable React markdown component.
|
|
4
4
|
|
|
5
|
-
[](https://badge.fury.io/js/markdown-to-jsx) <a href="https://bundlephobia.com/result?p=markdown-to-jsx" title="markdown-to-jsx latest minified+gzip size"><img src="https://badgen.net/bundlephobia/minzip/markdown-to-jsx" alt="gzip size"></a> [](https://travis-ci.org/probablyup/markdown-to-jsx) [](#backers) [](#sponsors)
|
|
5
|
+
[](https://badge.fury.io/js/markdown-to-jsx) <a href="https://bundlephobia.com/result?p=markdown-to-jsx" title="markdown-to-jsx latest minified+gzip size"><img src="https://badgen.net/bundlephobia/minzip/markdown-to-jsx" alt="gzip size"></a> [](https://travis-ci.org/probablyup/markdown-to-jsx) [](https://codecov.io/gh/probablyup/markdown-to-jsx) [](https://npm-stat.com/charts.html?package=markdown-to-jsx)
|
|
7
6
|
|
|
8
7
|
<!-- TOC -->
|
|
9
8
|
|
|
10
9
|
- [Installation](#installation)
|
|
11
10
|
- [Usage](#usage)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
11
|
+
- [Parsing Options](#parsing-options)
|
|
12
|
+
- [options.forceBlock](#optionsforceblock)
|
|
13
|
+
- [options.forceInline](#optionsforceinline)
|
|
14
|
+
- [options.wrapper](#optionswrapper)
|
|
15
|
+
- [Other useful recipes](#other-useful-recipes)
|
|
16
|
+
- [options.forceWrapper](#optionsforcewrapper)
|
|
17
|
+
- [options.overrides - Override Any HTML Tag's Representation](#optionsoverrides---override-any-html-tags-representation)
|
|
18
|
+
- [options.overrides - Rendering Arbitrary React Components](#optionsoverrides---rendering-arbitrary-react-components)
|
|
19
|
+
- [options.createElement - Custom React.createElement behavior](#optionscreateelement---custom-reactcreateelement-behavior)
|
|
20
|
+
- [options.slugify](#optionsslugify)
|
|
21
|
+
- [options.namedCodesToUnicode](#optionsnamedcodestounicode)
|
|
22
|
+
- [options.disableParsingRawHTML](#optionsdisableparsingrawhtml)
|
|
23
|
+
- [Syntax highlighting](#syntax-highlighting)
|
|
24
|
+
- [Getting the smallest possible bundle size](#getting-the-smallest-possible-bundle-size)
|
|
25
|
+
- [Usage with Preact](#usage-with-preact)
|
|
23
26
|
- [Gotchas](#gotchas)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- [Using The Compiler Directly](#using-the-compiler-directly)
|
|
27
|
+
- [Significant indentation inside arbitrary HTML](#significant-indentation-inside-arbitrary-html)
|
|
28
|
+
- [Code blocks](#code-blocks)
|
|
27
29
|
- [Changelog](#changelog)
|
|
28
30
|
- [Donate](#donate)
|
|
29
|
-
- [Credits](#credits)
|
|
30
|
-
- [Contributors](#contributors)
|
|
31
|
-
- [Backers](#backers)
|
|
32
|
-
- [Sponsors](#sponsors)
|
|
33
31
|
|
|
34
32
|
<!-- /TOC -->
|
|
35
33
|
|
|
@@ -127,6 +125,62 @@ compiler('# You got it babe!', { forceInline: true });
|
|
|
127
125
|
<span># You got it babe!</span>;
|
|
128
126
|
```
|
|
129
127
|
|
|
128
|
+
#### options.wrapper
|
|
129
|
+
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
```jsx
|
|
133
|
+
const str = '# Heck Yes\n\nThis is great!'
|
|
134
|
+
|
|
135
|
+
<Markdown options={{ wrapper: 'article' }}>
|
|
136
|
+
{str}
|
|
137
|
+
</Markdown>;
|
|
138
|
+
|
|
139
|
+
// or
|
|
140
|
+
|
|
141
|
+
compiler(str, { wrapper: 'article' });
|
|
142
|
+
|
|
143
|
+
// renders
|
|
144
|
+
|
|
145
|
+
<article>
|
|
146
|
+
<h1>Heck Yes</h1>
|
|
147
|
+
<p>This is great!</p>
|
|
148
|
+
</article>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
##### Other useful recipes
|
|
152
|
+
|
|
153
|
+
To get an array of children back without a wrapper, set `wrapper` to `null`. This is particularly useful when using `compiler(…)` directly.
|
|
154
|
+
|
|
155
|
+
```jsx
|
|
156
|
+
compiler('One\n\nTwo\n\nThree', { wrapper: null });
|
|
157
|
+
|
|
158
|
+
// returns
|
|
159
|
+
|
|
160
|
+
[
|
|
161
|
+
(<p>One</p>),
|
|
162
|
+
(<p>Two</p>),
|
|
163
|
+
(<p>Three</p>)
|
|
164
|
+
]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
#### options.forceWrapper
|
|
170
|
+
|
|
171
|
+
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`.
|
|
172
|
+
|
|
173
|
+
```jsx
|
|
174
|
+
// Using `forceWrapper` with a single, inline child…
|
|
175
|
+
<Markdown options={{ wrapper: 'aside', forceWrapper: true }}>
|
|
176
|
+
Mumble, mumble…
|
|
177
|
+
</Markdown>
|
|
178
|
+
|
|
179
|
+
// renders
|
|
180
|
+
|
|
181
|
+
<aside>Mumble, mumble…</aside>
|
|
182
|
+
```
|
|
183
|
+
|
|
130
184
|
#### options.overrides - Override Any HTML Tag's Representation
|
|
131
185
|
|
|
132
186
|
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.
|
|
@@ -189,6 +243,12 @@ Depending on the type of element, there are some props that must be preserved to
|
|
|
189
243
|
|
|
190
244
|
Any conflicts between passed `props` and the specific properties above will be resolved in favor of `markdown-to-jsx`'s code.
|
|
191
245
|
|
|
246
|
+
Some element mappings are a bit different from other libraries, in particular:
|
|
247
|
+
|
|
248
|
+
- `span`: Used for inline text.
|
|
249
|
+
- `code`: Used for inline code.
|
|
250
|
+
- `pre > code`: Code blocks are a `code` element with a `pre` as its direct ancestor.
|
|
251
|
+
|
|
192
252
|
#### options.overrides - Rendering Arbitrary React Components
|
|
193
253
|
|
|
194
254
|
One of the most interesting use cases enabled by the HTML syntax processing in `markdown-to-jsx` is the ability to use any kind of element, even ones that aren't real HTML tags like React component classes.
|
|
@@ -265,7 +325,7 @@ render(
|
|
|
265
325
|
);
|
|
266
326
|
```
|
|
267
327
|
|
|
268
|
-
Another possibility is to use something like [recompose's `withProps()` HOC](https://github.com/acdlite/recompose/blob/
|
|
328
|
+
Another possibility is to use something like [recompose's `withProps()` HOC](https://github.com/acdlite/recompose/blob/main/docs/API.md#withprops) to create various pregenerated scenarios and then reference them by name in the markdown:
|
|
269
329
|
|
|
270
330
|
```jsx
|
|
271
331
|
import Markdown from 'markdown-to-jsx';
|
|
@@ -409,6 +469,22 @@ compiler('This text has <span>html</span> in it but it won't be rendered', { dis
|
|
|
409
469
|
<span>This text has <span>html</span> in it but it won't be rendered</span>
|
|
410
470
|
```
|
|
411
471
|
|
|
472
|
+
### Syntax highlighting
|
|
473
|
+
|
|
474
|
+
Some syntax highlighters require you to specify the language. The language of the code fence is
|
|
475
|
+
forwarded in the className prop of the element used for `<code>`:
|
|
476
|
+
|
|
477
|
+
```jsx
|
|
478
|
+
const Code = ({className, children}) => {
|
|
479
|
+
const language = className.replace("lang-", "");
|
|
480
|
+
|
|
481
|
+
return (
|
|
482
|
+
<SyntaxHighlighter language={language}>
|
|
483
|
+
<code>{children}</code>
|
|
484
|
+
</SyntaxHighlighter>
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
```
|
|
412
488
|
### Getting the smallest possible bundle size
|
|
413
489
|
|
|
414
490
|
Many development conveniences are placed behind `process.env.NODE_ENV !== "production"` conditionals. When bundling your app, it's a good idea to replace these code snippets such that a minifier (like uglify) can sweep them away and leave a smaller overall bundle.
|
|
@@ -422,7 +498,7 @@ Here are instructions for some of the popular bundlers:
|
|
|
422
498
|
|
|
423
499
|
### Usage with Preact
|
|
424
500
|
|
|
425
|
-
Everything will work just fine! Simply [Alias `react` to `preact
|
|
501
|
+
Everything will work just fine! Simply [Alias `react` to `preact/compat`](https://preactjs.com/guide/v10/switching-to-preact#setting-up-compat) like you probably already are doing.
|
|
426
502
|
|
|
427
503
|
## Gotchas
|
|
428
504
|
|
|
@@ -502,34 +578,6 @@ See [Github Releases](https://github.com/probablyup/markdown-to-jsx/releases).
|
|
|
502
578
|
|
|
503
579
|
## Donate
|
|
504
580
|
|
|
505
|
-
Like this library? It's developed entirely on a volunteer basis; chip in a few bucks if you can at
|
|
506
|
-
|
|
507
|
-
## Credits
|
|
508
|
-
|
|
509
|
-
### Contributors
|
|
510
|
-
|
|
511
|
-
This project exists thanks to all the people who contribute.
|
|
512
|
-
<a href="https://github.com/probablyup/markdown-to-jsx/graphs/contributors"><img src="https://opencollective.com/markdown-to-jsx/contributors.svg?width=890&button=false" /></a>
|
|
513
|
-
|
|
514
|
-
### Backers
|
|
515
|
-
|
|
516
|
-
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/markdown-to-jsx#backer)]
|
|
517
|
-
|
|
518
|
-
<a href="https://opencollective.com/markdown-to-jsx#backers" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/backers.svg?width=890"></a>
|
|
519
|
-
|
|
520
|
-
### Sponsors
|
|
521
|
-
|
|
522
|
-
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/markdown-to-jsx#sponsor)]
|
|
523
|
-
|
|
524
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/0/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/0/avatar.svg"></a>
|
|
525
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/1/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/1/avatar.svg"></a>
|
|
526
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/2/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/2/avatar.svg"></a>
|
|
527
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/3/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/3/avatar.svg"></a>
|
|
528
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/4/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/4/avatar.svg"></a>
|
|
529
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/5/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/5/avatar.svg"></a>
|
|
530
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/6/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/6/avatar.svg"></a>
|
|
531
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/7/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/7/avatar.svg"></a>
|
|
532
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/8/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/8/avatar.svg"></a>
|
|
533
|
-
<a href="https://opencollective.com/markdown-to-jsx/sponsor/9/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/9/avatar.svg"></a>
|
|
581
|
+
Like this library? It's developed entirely on a volunteer basis; chip in a few bucks if you can at my [Patreon](https://www.patreon.com/bePatron?u=27436864).
|
|
534
582
|
|
|
535
583
|
MIT
|
package/dist/index.cjs.d.ts
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
@@ -14,11 +14,12 @@ export declare namespace MarkdownToJSX {
|
|
|
14
14
|
export type CreateElement = typeof React.createElement;
|
|
15
15
|
export type HTMLTags = keyof JSX.IntrinsicElements;
|
|
16
16
|
export type State = {
|
|
17
|
+
_inAnchor?: boolean;
|
|
18
|
+
_inline?: boolean;
|
|
19
|
+
_inTable?: boolean;
|
|
20
|
+
_key?: React.Key;
|
|
17
21
|
_list?: boolean;
|
|
18
|
-
|
|
19
|
-
inTable?: boolean;
|
|
20
|
-
key?: React.Key;
|
|
21
|
-
simple?: boolean;
|
|
22
|
+
_simple?: boolean;
|
|
22
23
|
};
|
|
23
24
|
export type ParserResult = {
|
|
24
25
|
[key: string]: any;
|
|
@@ -28,18 +29,18 @@ export declare namespace MarkdownToJSX {
|
|
|
28
29
|
export type Parser<ParserOutput> = (capture: RegExpMatchArray, nestedParse: NestedParser, state?: MarkdownToJSX.State) => ParserOutput;
|
|
29
30
|
export type RuleOutput = (ast: MarkdownToJSX.ParserResult, state: MarkdownToJSX.State) => JSX.Element;
|
|
30
31
|
export type Rule<ParserOutput = MarkdownToJSX.ParserResult> = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
35
36
|
};
|
|
36
37
|
export type Rules = {
|
|
37
38
|
[key: string]: Rule;
|
|
38
39
|
};
|
|
39
40
|
export type Override = RequireAtLeastOne<{
|
|
40
|
-
component: React.
|
|
41
|
+
component: React.ElementType;
|
|
41
42
|
props: Object;
|
|
42
|
-
}> | React.
|
|
43
|
+
}> | React.ElementType;
|
|
43
44
|
export type Overrides = {
|
|
44
45
|
[tag in HTMLTags]?: Override;
|
|
45
46
|
} & {
|
|
@@ -97,7 +98,7 @@ export declare namespace MarkdownToJSX {
|
|
|
97
98
|
* without any wrapper, or use `React.Fragment` to get a React element
|
|
98
99
|
* that won't show up in the DOM.
|
|
99
100
|
*/
|
|
100
|
-
wrapper: React.ElementType;
|
|
101
|
+
wrapper: React.ElementType | null;
|
|
101
102
|
/**
|
|
102
103
|
* Forces the compiler to wrap results, even if there is only a single
|
|
103
104
|
* child or no children.
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,n=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;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{0,2}/,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=/^<!--.*?-->/,w=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,E=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,C=/^\{.*\}$/,G=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,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 Ce(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Ge(e,n,t){for(var r=e,a=n.split(".");a.length&&void 0!==(r=r[a[0]]);)a.shift();return r||t}function Le(e,n){var t=Ge(n,e);return t?"function"==typeof t||"object"==typeof t&&"render"in t?t:Ge(n,e+".component",e):e}function $e(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.createElement;function q(e,n){var r=Ge(Z.overrides,e+".props",{});return F.apply(void 0,[Le(e,Z.overrides),t({},n,r,{className:Ce(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($e(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.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(C)&&(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.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($),order:Ae.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],type:"link"}}},linkBareUrlDetector:{match:he(G),order:Ae.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],title:void 0,type:"link"}}},linkMailtoDetector:{match:he(L),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,$e=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.replace(/<!--[\s\S]*?(?:-->)/g,""));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($e(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.cloneElement($e(t,r),a)};Object.assign(Te,{compiler:$e}),module.exports=Te;
|
|
1
|
+
function n(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var t=n(require("react"));function r(){return(r=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=r[e])}return n}).apply(this,arguments)}var e=/[\'\"]/,o=["children","options"],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:"“"},u=["style","script"],i=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,f=/mailto:/i,l=/\n{2,}$/,s=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,_=/^ *> ?/gm,d=/^ {2,}\n/,p=/^(?:( *[-*_]) *){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/,v=/\r\n?/g,k=/^\[\^([^\]]+)](:.*)\n/,b=/^\[\^([^\]]+)]/,x=/\f/g,S=/^\s*?\[(x|\s)\]/,$=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,w=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,z=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,E=/&([a-z]+);/g,A=/^<!--[\s\S]*?(?:-->)/,O=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,R=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,j=/^\{.*\}$/,I=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,M=/^<([^ >]+@[^ >]+)>/,B=/^<([^ >]+:\/[^ >]+)>/,L=/ *\n+$/,T=/(?:^|\n)( *)$/,C=/-([a-z])?/gi,D=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,N=/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/,Z=/^\[([^\]]*)\]:\s*(\S+)\s*("([^"]*)")?/,F=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,P=/^\[([^\]]*)\] ?\[([^\]]*)\]/,q=/(\[|\])/g,G=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,H=/\t/g,U=/^ *\| */,V=/(^ *\||\| *$)/g,W=/ *$/,K=/^ *:-+: *$/,Q=/^ *:-+ *$/,X=/^ *-+: *$/,J=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,Y=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/,nn=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,tn=/^\\([^0-9A-Za-z\s])/,rn=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,en=/(^\n+|\n+$|\s+$)/g,on=/^([ \t]*)/,an=/\\([^0-9A-Z\s])/gi,cn=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +"),un=new RegExp("( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\\n|$)","gm"),fn=new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) (?!(?:[*+-]|\\d+\\.) ))\\n*|\\s*\\n*$)"),ln="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",sn=new RegExp("^\\[("+ln+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),_n=new RegExp("^!\\[("+ln+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),dn=[s,g,m,$,w,z,A,R,un,fn,D,N];function pn(n){return n.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 mn(n){return X.test(n)?"right":K.test(n)?"center":Q.test(n)?"left":null}function gn(n,t,r){var e=r.t;r.t=!0;var o=t(n.trim(),r);r.t=e;var a=[[]];return o.forEach(function(n,t){"tableSeparator"===n.type?0!==t&&t!==o.length-1&&a.push([]):("text"!==n.type||null!=o[t+1]&&"tableSeparator"!==o[t+1].type||(n.content=n.content.replace(W,"")),a[a.length-1].push(n))}),a}function yn(n,t,r){r.o=!0;var e=gn(n[1],t,r),o=n[2].replace(V,"").split("|").map(mn),a=function(n,t,r){return n.trim().split("\n").map(function(n){return gn(n,t,r)})}(n[3],t,r);return r.o=!1,{align:o,cells:a,header:e,type:"table"}}function hn(n,t){return null==n.align[t]?{}:{textAlign:n.align[t]}}function vn(n){return function(t,r){return r.o?n.exec(t):null}}function kn(n){return function(t,r){return r.o||r.u?n.exec(t):null}}function bn(n){return function(t,r){return r.o||r.u?null:n.exec(t)}}function xn(n){return function(t){return n.exec(t)}}function Sn(n){try{if(decodeURIComponent(n).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data):/i))return null}catch(n){return null}return n}function $n(n){return n.replace(an,"$1")}function wn(n,t,r){var e=r.o||!1,o=r.u||!1;r.o=!0,r.u=!0;var a=n(t,r);return r.o=e,r.u=o,a}function zn(n,t,r){var e=r.o||!1,o=r.u||!1;r.o=!1,r.u=!0;var a=n(t,r);return r.o=e,r.u=o,a}function En(n,t,r){return r.o=!1,n(t+"\n\n",r)}var An,On=function(n,t,r){return{content:wn(t,n[1],r)}};function Rn(){return{}}function jn(){return null}function In(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Mn(n,t,r){for(var e=n,o=t.split(".");o.length&&void 0!==(e=e[o[0]]);)o.shift();return e||r}function Bn(n,t){var r=Mn(t,n);return r?"function"==typeof r||"object"==typeof r&&"render"in r?r:Mn(t,n+".component",n):n}function Ln(n,o){void 0===o&&(o={}),o.overrides=o.overrides||{},o.slugify=o.slugify||pn,o.namedCodesToUnicode=o.namedCodesToUnicode?r({},c,o.namedCodesToUnicode):c;var V=o.createElement||t.default.createElement;function W(n,t){var e=Mn(o.overrides,n+".props",{});return V.apply(void 0,[Bn(n,o.overrides),r({},t,e,{className:In(null==t?void 0:t.className,e.className)||void 0})].concat([].slice.call(arguments,2)))}function K(n){var r=!1;o.forceInline?r=!0:o.forceBlock||(r=!1===G.test(n));var e=Ln(gn(r?n:n.replace(en,"")+"\n\n",{o:r}));if(null===o.wrapper)return e;var a,c=o.wrapper||(r?"span":"div");if(e.length>1||o.forceWrapper)a=e;else{if(1===e.length)return"string"==typeof(a=e[0])?W("span",{key:"outer"},a):a;a=null}return t.default.createElement(c,{key:"outer"},a)}function Q(n){var r=n.match(i);return r?r.reduce(function(n,r,o){var c=r.indexOf("=");if(-1!==c){var u=function(n){return-1!==n.indexOf("-")&&null===n.match(O)&&(n=n.replace(C,function(n,t){return t.toUpperCase()})),n}(r.slice(0,c)).trim(),i=function(n){return n?(e.test(n.charAt(0))&&(n=n.substr(1)),e.test(n.charAt(n.length-1))&&(n=n.substr(0,n.length-1)),n):""}(r.slice(c+1).trim()),f=a[u]||u,l=n[f]=function(n,t){return"style"===n?t.split(/;\s?/).reduce(function(n,t){var r=t.slice(0,t.indexOf(":"));return n[r.replace(/(-[a-z])/g,function(n){return n[1].toUpperCase()})]=t.slice(r.length+1).trim(),n},{}):"href"===n?Sn(t):(t.match(j)&&(t=t.slice(1,t.length-1)),"true"===t||"false"!==t&&t)}(u,i);"string"==typeof l&&(z.test(l)||R.test(l))&&(n[f]=t.default.cloneElement(K(l.trim()),{key:o}))}else"style"!==r&&(n[a[r]||r]=!0);return n},{}):void 0}var X=[],an={},ln={blockQuote:{i:bn(s),l:An.HIGH,_:function(n,t,r){return{content:t(n[0].replace(_,""),r)}},p:function(n,t,r){return W("blockquote",{key:r.m},t(n.content,r))}},breakLine:{i:xn(d),l:An.HIGH,_:Rn,p:function(n,t,r){return W("br",{key:r.m})}},breakThematic:{i:bn(p),l:An.HIGH,_:Rn,p:function(n,t,r){return W("hr",{key:r.m})}},codeBlock:{i:bn(g),l:An.MAX,_:function(n){return{content:n[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),lang:void 0}},p:function(n,t,r){return W("pre",{key:r.m},W("code",{className:n.lang?"lang-"+n.lang:""},n.content))}},codeFenced:{i:bn(m),l:An.MAX,_:function(n){return{content:n[3],lang:n[2]||void 0,type:"codeBlock"}}},codeInline:{i:kn(y),l:An.LOW,_:function(n){return{content:n[2]}},p:function(n,t,r){return W("code",{key:r.m},n.content)}},footnote:{i:bn(k),l:An.MAX,_:function(n){return X.push({footnote:n[2],identifier:n[1]}),{}},p:jn},footnoteReference:{i:vn(b),l:An.HIGH,_:function(n){return{content:n[1],target:"#"+o.slugify(n[1])}},p:function(n,t,r){return W("a",{key:r.m,href:Sn(n.target)},W("sup",{key:r.m},n.content))}},gfmTask:{i:vn(S),l:An.HIGH,_:function(n){return{completed:"x"===n[1].toLowerCase()}},p:function(n,t,r){return W("input",{checked:n.completed,key:r.m,readOnly:!0,type:"checkbox"})}},heading:{i:bn($),l:An.HIGH,_:function(n,t,r){return{content:wn(t,n[2],r),id:o.slugify(n[2]),level:n[1].length}},p:function(n,t,r){return n.tag="h"+n.level,W(n.tag,{id:n.id,key:r.m},t(n.content,r))}},headingSetext:{i:bn(w),l:An.MAX,_:function(n,t,r){return{content:wn(t,n[1],r),level:"="===n[2]?1:2,type:"heading"}}},htmlComment:{i:xn(A),l:An.HIGH,_:function(){return{}},p:jn},image:{i:kn(_n),l:An.HIGH,_:function(n){return{alt:n[1],target:$n(n[2]),title:n[3]}},p:function(n,t,r){return W("img",{key:r.m,alt:n.alt||void 0,title:n.title||void 0,src:Sn(n.target)})}},link:{i:vn(sn),l:An.LOW,_:function(n,t,r){return{content:zn(t,n[1],r),target:$n(n[2]),title:n[3]}},p:function(n,t,r){return W("a",{key:r.m,href:Sn(n.target),title:n.title},t(n.content,r))}},linkAngleBraceStyleDetector:{i:vn(B),l:An.MAX,_:function(n){return{content:[{content:n[1],type:"text"}],target:n[1],type:"link"}}},linkBareUrlDetector:{i:function(n,t){return t.g?null:vn(I)(n,t)},l:An.MAX,_:function(n){return{content:[{content:n[1],type:"text"}],target:n[1],title:void 0,type:"link"}}},linkMailtoDetector:{i:vn(M),l:An.MAX,_:function(n){var t=n[1],r=n[1];return f.test(r)||(r="mailto:"+r),{content:[{content:t.replace("mailto:",""),type:"text"}],target:r,type:"link"}}},list:{i:function(n,t,r){var e=T.exec(r);return!e||!t.h&&t.o?null:fn.exec(n=e[1]+n)},l:An.HIGH,_:function(n,t,r){var e=n[2],o=e.length>1,a=o?+e:void 0,c=n[0].replace(l,"\n").match(un),u=!1;return{items:c.map(function(n,e){var o=cn.exec(n)[0].length,a=new RegExp("^ {1,"+o+"}","gm"),i=n.replace(a,"").replace(cn,""),f=e===c.length-1,l=-1!==i.indexOf("\n\n")||f&&u;u=l;var s,_=r.o,d=r.h;r.h=!0,l?(r.o=!1,s=i.replace(L,"\n\n")):(r.o=!0,s=i.replace(L,""));var p=t(s,r);return r.o=_,r.h=d,p}),ordered:o,start:a}},p:function(n,t,r){return W(n.ordered?"ol":"ul",{key:r.m,start:n.start},n.items.map(function(n,e){return W("li",{key:e},t(n,r))}))}},newlineCoalescer:{i:bn(h),l:An.LOW,_:Rn,p:function(){return"\n"}},paragraph:{i:bn(N),l:An.LOW,_:On,p:function(n,t,r){return W("p",{key:r.m},t(n.content,r))}},ref:{i:vn(Z),l:An.MAX,_:function(n){return an[n[1]]={target:n[2],title:n[4]},{}},p:jn},refImage:{i:kn(F),l:An.MAX,_:function(n){return{alt:n[1]||void 0,ref:n[2]}},p:function(n,t,r){return W("img",{key:r.m,alt:n.alt,src:Sn(an[n.ref].target),title:an[n.ref].title})}},refLink:{i:vn(P),l:An.MAX,_:function(n,t,r){return{content:t(n[1],r),fallbackContent:t(n[0].replace(q,"\\$1"),r),ref:n[2]}},p:function(n,t,r){return an[n.ref]?W("a",{key:r.m,href:Sn(an[n.ref].target),title:an[n.ref].title},t(n.content,r)):W("span",{key:r.m},t(n.fallbackContent,r))}},table:{i:bn(D),l:An.HIGH,_:yn,p:function(n,t,r){return W("table",{key:r.m},W("thead",null,W("tr",null,n.header.map(function(e,o){return W("th",{key:o,style:hn(n,o)},t(e,r))}))),W("tbody",null,n.cells.map(function(e,o){return W("tr",{key:o},e.map(function(e,o){return W("td",{key:o,style:hn(n,o)},t(e,r))}))})))}},tableSeparator:{i:function(n,t){return t.t?U.exec(n):null},l:An.HIGH,_:function(){return{type:"tableSeparator"}},p:function(){return" | "}},text:{i:xn(rn),l:An.MIN,_:function(n){return{content:n[0].replace(E,function(n,t){return o.namedCodesToUnicode[t]?o.namedCodesToUnicode[t]:n})}},p:function(n){return n.content}},textBolded:{i:kn(J),l:An.MED,_:function(n,t,r){return{content:t(n[2],r)}},p:function(n,t,r){return W("strong",{key:r.m},t(n.content,r))}},textEmphasized:{i:kn(Y),l:An.LOW,_:function(n,t,r){return{content:t(n[2],r)}},p:function(n,t,r){return W("em",{key:r.m},t(n.content,r))}},textEscaped:{i:kn(tn),l:An.HIGH,_:function(n){return{content:n[1],type:"text"}}},textStrikethroughed:{i:kn(nn),l:An.LOW,_:On,p:function(n,t,r){return W("del",{key:r.m},t(n.content,r))}}};!0!==o.disableParsingRawHTML&&(ln.htmlBlock={i:xn(z),l:An.HIGH,_:function(n,t,r){var e,o=n[3].match(on),a=new RegExp("^"+o[1],"gm"),c=n[3].replace(a,""),i=(e=c,dn.some(function(n){return n.test(e)})?En:wn),f=n[1].toLowerCase(),l=-1!==u.indexOf(f);r.g=r.g||"a"===f;var s=l?n[3]:i(t,c,r);return r.g=!1,{attrs:Q(n[2]),content:s,noInnerParse:l,tag:l?f:n[1]}},p:function(n,t,e){return W(n.tag,r({key:e.m},n.attrs),n.noInnerParse?n.content:t(n.content,e))}},ln.htmlSelfClosing={i:xn(R),l:An.HIGH,_:function(n){return{attrs:Q(n[2]||""),tag:n[1]}},p:function(n,t,e){return W(n.tag,r({},n.attrs,{key:e.m}))}});var mn,gn=function(n){var t=Object.keys(n);function r(e,o){for(var a=[],c="";e;)for(var u=0;u<t.length;){var i=t[u],f=n[i],l=f.i(e,o,c);if(l){var s=l[0];e=e.substring(s.length);var _=f._(l,r,o);null==_.type&&(_.type=i),a.push(_),c=s;break}u++}return a}return t.sort(function(t,r){var e=n[t].l,o=n[r].l;return e!==o?e-o:t<r?-1:1}),function(n,t){return r(function(n){return n.replace(v,"\n").replace(x,"").replace(H," ")}(n),t)}}(ln),Ln=(mn=function(n){return function(t,r,e){return n[t.type].p(t,r,e)}}(ln),function n(t,r){if(void 0===r&&(r={}),Array.isArray(t)){for(var e=r.m,o=[],a=!1,c=0;c<t.length;c++){r.m=c;var u=n(t[c],r),i="string"==typeof u;i&&a?o[o.length-1]+=u:o.push(u),a=i}return r.m=e,o}return mn(t,n,r)}),Tn=K(n);return X.length&&Tn.props.children.push(W("footer",{key:"footer"},X.map(function(n){return W("div",{id:o.slugify(n.identifier),key:n.identifier},n.identifier,Ln(gn(n.footnote,{o:!0})))}))),Tn}!function(n){n[n.MAX=0]="MAX",n[n.HIGH=1]="HIGH",n[n.MED=2]="MED",n[n.LOW=3]="LOW",n[n.MIN=4]="MIN"}(An||(An={}));var Tn=function(n){var r=n.children,e=n.options,a=function(n,t){if(null==n)return{};var r,e,o={},a=Object.keys(n);for(e=0;e<a.length;e++)t.indexOf(r=a[e])>=0||(o[r]=n[r]);return o}(n,o);return t.default.cloneElement(Ln(r,e),a)};Object.assign(Tn,{compiler:Ln}),module.exports=Tn;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|