markdown-to-jsx 7.1.2 → 7.1.6
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 +43 -53
- package/dist/index.cjs.d.ts +1 -1
- package/dist/index.d.ts +9 -8
- 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 +18 -10
package/README.md
CHANGED
|
@@ -2,36 +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
|
-
|
|
23
|
-
- [
|
|
24
|
-
|
|
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)
|
|
25
26
|
- [Gotchas](#gotchas)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- [Using The Compiler Directly](#using-the-compiler-directly)
|
|
27
|
+
- [Significant indentation inside arbitrary HTML](#significant-indentation-inside-arbitrary-html)
|
|
28
|
+
- [Code blocks](#code-blocks)
|
|
29
29
|
- [Changelog](#changelog)
|
|
30
30
|
- [Donate](#donate)
|
|
31
|
-
- [Credits](#credits)
|
|
32
|
-
- [Contributors](#contributors)
|
|
33
|
-
- [Backers](#backers)
|
|
34
|
-
- [Sponsors](#sponsors)
|
|
35
31
|
|
|
36
32
|
<!-- /TOC -->
|
|
37
33
|
|
|
@@ -247,6 +243,12 @@ Depending on the type of element, there are some props that must be preserved to
|
|
|
247
243
|
|
|
248
244
|
Any conflicts between passed `props` and the specific properties above will be resolved in favor of `markdown-to-jsx`'s code.
|
|
249
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
|
+
|
|
250
252
|
#### options.overrides - Rendering Arbitrary React Components
|
|
251
253
|
|
|
252
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.
|
|
@@ -323,7 +325,7 @@ render(
|
|
|
323
325
|
);
|
|
324
326
|
```
|
|
325
327
|
|
|
326
|
-
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:
|
|
327
329
|
|
|
328
330
|
```jsx
|
|
329
331
|
import Markdown from 'markdown-to-jsx';
|
|
@@ -467,6 +469,22 @@ compiler('This text has <span>html</span> in it but it won't be rendered', { dis
|
|
|
467
469
|
<span>This text has <span>html</span> in it but it won't be rendered</span>
|
|
468
470
|
```
|
|
469
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
|
+
```
|
|
470
488
|
### Getting the smallest possible bundle size
|
|
471
489
|
|
|
472
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.
|
|
@@ -480,7 +498,7 @@ Here are instructions for some of the popular bundlers:
|
|
|
480
498
|
|
|
481
499
|
### Usage with Preact
|
|
482
500
|
|
|
483
|
-
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.
|
|
484
502
|
|
|
485
503
|
## Gotchas
|
|
486
504
|
|
|
@@ -560,34 +578,6 @@ See [Github Releases](https://github.com/probablyup/markdown-to-jsx/releases).
|
|
|
560
578
|
|
|
561
579
|
## Donate
|
|
562
580
|
|
|
563
|
-
Like this library? It's developed entirely on a volunteer basis; chip in a few bucks if you can at
|
|
564
|
-
|
|
565
|
-
## Credits
|
|
566
|
-
|
|
567
|
-
### Contributors
|
|
568
|
-
|
|
569
|
-
This project exists thanks to all the people who contribute.
|
|
570
|
-
<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>
|
|
571
|
-
|
|
572
|
-
### Backers
|
|
573
|
-
|
|
574
|
-
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/markdown-to-jsx#backer)]
|
|
575
|
-
|
|
576
|
-
<a href="https://opencollective.com/markdown-to-jsx#backers" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/backers.svg?width=890"></a>
|
|
577
|
-
|
|
578
|
-
### Sponsors
|
|
579
|
-
|
|
580
|
-
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)]
|
|
581
|
-
|
|
582
|
-
<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>
|
|
583
|
-
<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>
|
|
584
|
-
<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>
|
|
585
|
-
<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>
|
|
586
|
-
<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>
|
|
587
|
-
<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>
|
|
588
|
-
<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>
|
|
589
|
-
<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>
|
|
590
|
-
<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>
|
|
591
|
-
<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).
|
|
592
582
|
|
|
593
583
|
MIT
|
package/dist/index.cjs.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const _default: import("react").FC<{
|
|
|
11
11
|
namedCodesToUnicode: {
|
|
12
12
|
[key: string]: string;
|
|
13
13
|
};
|
|
14
|
-
overrides: import("
|
|
14
|
+
overrides: import("./").MarkdownToJSX.Overrides;
|
|
15
15
|
wrapper: import("react").ElementType<any>;
|
|
16
16
|
forceWrapper: boolean;
|
|
17
17
|
slugify: (source: string) => string;
|
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,10 +29,10 @@ 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;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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;
|
|
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"],u=["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(function(n,t){return n[t.toLowerCase()]=t,n},{for:"htmlFor"}),a={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["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/,g=/^\s*(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n *)+\n?/,m=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,v=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,y=/^(?:\n *)*\n/,h=/\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=/^\[([^\]]*)\]:\s*(\S+)\s*("([^"]*)")?/,Z=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,F=/^\[([^\]]*)\] ?\[([^\]]*)\]/,P=/(\[|\])/g,q=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,G=/\t/g,H=/^ *\| */,U=/(^ *\||\| *$)/g,V=/ *$/,W=/^ *:-+: *$/,Q=/^ *:-+ *$/,X=/^ *-+: *$/,J=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,K=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/,Y=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,nn=/^\\([^0-9A-Za-z\s])/,tn=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,rn=/^\n+/,en=/^([ \t]*)/,on=/\\([^0-9A-Z\s])/gi,un=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +"),an=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\\n|$)","gm"),cn=new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) (?!(?:[*+-]|\\d+\\.) ))\\n*|\\s*\\n*$)"),fn="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",ln=new RegExp("^\\[("+fn+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),sn=new RegExp("^!\\[("+fn+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),_n=[s,m,g,$,w,A,an,cn,D],dn=[].concat(_n,[/^[^\n]+(?: \n|\n{2,})/,z,R]);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 gn(n){return X.test(n)?"right":W.test(n)?"center":Q.test(n)?"left":null}function mn(n,t,r){var e=r.t;r.t=!0;var o=t(n.trim(),r);r.t=e;var u=[[]];return o.forEach(function(n,t){"tableSeparator"===n.type?0!==t&&t!==o.length-1&&u.push([]):("text"!==n.type||null!=o[t+1]&&"tableSeparator"!==o[t+1].type||(n.content=n.content.replace(V,"")),u[u.length-1].push(n))}),u}function vn(n,t,r){r.o=!0;var e=mn(n[1],t,r),o=n[2].replace(U,"").split("|").map(gn),u=function(n,t,r){return n.trim().split("\n").map(function(n){return mn(n,t,r)})}(n[3],t,r);return r.o=!1,{align:o,cells:u,header:e,type:"table"}}function yn(n,t){return null==n.align[t]?{}:{textAlign:n.align[t]}}function hn(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,t,r){if(t.o||t.u)return null;if(r&&!r.endsWith("\n"))return null;var e="";n.split("\n").every(function(n){return!_n.some(function(t){return t.test(n)})&&(e+=n+"\n",n.trim())});var o=e.trimEnd();return""==o?null:[e,o]}function $n(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 wn(n){return n.replace(on,"$1")}function zn(n,t,r){var e=r.o||!1,o=r.u||!1;r.o=!0,r.u=!0;var u=n(t,r);return r.o=e,r.u=o,u}function En(n,t,r){var e=r.o||!1,o=r.u||!1;r.o=!1,r.u=!0;var u=n(t,r);return r.o=e,r.u=o,u}function An(n,t,r){return r.o=!1,n(t+"\n\n",r)}var On,Rn=function(n,t,r){return{content:zn(t,n[1],r)}};function jn(){return{}}function In(){return null}function Mn(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Bn(n,t,r){for(var e=n,o=t.split(".");o.length&&void 0!==(e=e[o[0]]);)o.shift();return e||r}function Ln(n,t){var r=Bn(t,n);return r?"function"==typeof r||"object"==typeof r&&"render"in r?r:Bn(t,n+".component",n):n}function Tn(n,o){void 0===o&&(o={}),o.overrides=o.overrides||{},o.slugify=o.slugify||pn,o.namedCodesToUnicode=o.namedCodesToUnicode?r({},a,o.namedCodesToUnicode):a;var U=o.createElement||t.default.createElement;function V(n,t){var e=Bn(o.overrides,n+".props",{});return U.apply(void 0,[Ln(n,o.overrides),r({},t,e,{className:Mn(null==t?void 0:t.className,e.className)||void 0})].concat([].slice.call(arguments,2)))}function W(n){var r=!1;o.forceInline?r=!0:o.forceBlock||(r=!1===q.test(n));for(var e=mn(gn(r?n:n.trimEnd().replace(rn,"")+"\n\n",{o:r}));"string"==typeof e[e.length-1]&&!e[e.length-1].trim();)e.pop();if(null===o.wrapper)return e;var u,a=o.wrapper||(r?"span":"div");if(e.length>1||o.forceWrapper)u=e;else{if(1===e.length)return"string"==typeof(u=e[0])?V("span",{key:"outer"},u):u;u=null}return t.default.createElement(a,{key:"outer"},u)}function Q(n){var r=n.match(i);return r?r.reduce(function(n,r,o){var a=r.indexOf("=");if(-1!==a){var c=function(n){return-1!==n.indexOf("-")&&null===n.match(O)&&(n=n.replace(C,function(n,t){return t.toUpperCase()})),n}(r.slice(0,a)).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(a+1).trim()),f=u[c]||c,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?$n(t):(t.match(j)&&(t=t.slice(1,t.length-1)),"true"===t||"false"!==t&&t)}(c,i);"string"==typeof l&&(z.test(l)||R.test(l))&&(n[f]=t.default.cloneElement(W(l.trim()),{key:o}))}else"style"!==r&&(n[u[r]||r]=!0);return n},{}):void 0}var X=[],on={},fn={blockQuote:{i:bn(s),l:On.HIGH,_:function(n,t,r){return{content:t(n[0].replace(_,""),r)}},p:function(n,t,r){return V("blockquote",{key:r.g},t(n.content,r))}},breakLine:{i:xn(d),l:On.HIGH,_:jn,p:function(n,t,r){return V("br",{key:r.g})}},breakThematic:{i:bn(p),l:On.HIGH,_:jn,p:function(n,t,r){return V("hr",{key:r.g})}},codeBlock:{i:bn(m),l:On.MAX,_:function(n){return{content:n[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),lang:void 0}},p:function(n,t,r){return V("pre",{key:r.g},V("code",{className:n.lang?"lang-"+n.lang:""},n.content))}},codeFenced:{i:bn(g),l:On.MAX,_:function(n){return{content:n[3],lang:n[2]||void 0,type:"codeBlock"}}},codeInline:{i:kn(v),l:On.LOW,_:function(n){return{content:n[2]}},p:function(n,t,r){return V("code",{key:r.g},n.content)}},footnote:{i:bn(k),l:On.MAX,_:function(n){return X.push({footnote:n[2],identifier:n[1]}),{}},p:In},footnoteReference:{i:hn(b),l:On.HIGH,_:function(n){return{content:n[1],target:"#"+o.slugify(n[1])}},p:function(n,t,r){return V("a",{key:r.g,href:$n(n.target)},V("sup",{key:r.g},n.content))}},gfmTask:{i:hn(S),l:On.HIGH,_:function(n){return{completed:"x"===n[1].toLowerCase()}},p:function(n,t,r){return V("input",{checked:n.completed,key:r.g,readOnly:!0,type:"checkbox"})}},heading:{i:bn($),l:On.HIGH,_:function(n,t,r){return{content:zn(t,n[2],r),id:o.slugify(n[2]),level:n[1].length}},p:function(n,t,r){return n.tag="h"+n.level,V(n.tag,{id:n.id,key:r.g},t(n.content,r))}},headingSetext:{i:bn(w),l:On.MAX,_:function(n,t,r){return{content:zn(t,n[1],r),level:"="===n[2]?1:2,type:"heading"}}},htmlComment:{i:xn(A),l:On.HIGH,_:function(){return{}},p:In},image:{i:kn(sn),l:On.HIGH,_:function(n){return{alt:n[1],target:wn(n[2]),title:n[3]}},p:function(n,t,r){return V("img",{key:r.g,alt:n.alt||void 0,title:n.title||void 0,src:$n(n.target)})}},link:{i:hn(ln),l:On.LOW,_:function(n,t,r){return{content:En(t,n[1],r),target:wn(n[2]),title:n[3]}},p:function(n,t,r){return V("a",{key:r.g,href:$n(n.target),title:n.title},t(n.content,r))}},linkAngleBraceStyleDetector:{i:hn(B),l:On.MAX,_:function(n){return{content:[{content:n[1],type:"text"}],target:n[1],type:"link"}}},linkBareUrlDetector:{i:function(n,t){return t.m?null:hn(I)(n,t)},l:On.MAX,_:function(n){return{content:[{content:n[1],type:"text"}],target:n[1],title:void 0,type:"link"}}},linkMailtoDetector:{i:hn(M),l:On.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.v&&t.o?null:cn.exec(n=e[1]+n)},l:On.HIGH,_:function(n,t,r){var e=n[2],o=e.length>1,u=o?+e:void 0,a=n[0].replace(l,"\n").match(an),c=!1;return{items:a.map(function(n,e){var o=un.exec(n)[0].length,u=new RegExp("^ {1,"+o+"}","gm"),i=n.replace(u,"").replace(un,""),f=e===a.length-1,l=-1!==i.indexOf("\n\n")||f&&c;c=l;var s,_=r.o,d=r.v;r.v=!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.v=d,p}),ordered:o,start:u}},p:function(n,t,r){return V(n.ordered?"ol":"ul",{key:r.g,start:n.start},n.items.map(function(n,e){return V("li",{key:e},t(n,r))}))}},newlineCoalescer:{i:bn(y),l:On.LOW,_:jn,p:function(){return"\n"}},paragraph:{i:Sn,l:On.LOW,_:Rn,p:function(n,t,r){return V("p",{key:r.g},t(n.content,r))}},ref:{i:hn(N),l:On.MAX,_:function(n){return on[n[1]]={target:n[2],title:n[4]},{}},p:In},refImage:{i:kn(Z),l:On.MAX,_:function(n){return{alt:n[1]||void 0,ref:n[2]}},p:function(n,t,r){return V("img",{key:r.g,alt:n.alt,src:$n(on[n.ref].target),title:on[n.ref].title})}},refLink:{i:hn(F),l:On.MAX,_:function(n,t,r){return{content:t(n[1],r),fallbackContent:t(n[0].replace(P,"\\$1"),r),ref:n[2]}},p:function(n,t,r){return on[n.ref]?V("a",{key:r.g,href:$n(on[n.ref].target),title:on[n.ref].title},t(n.content,r)):V("span",{key:r.g},t(n.fallbackContent,r))}},table:{i:bn(D),l:On.HIGH,_:vn,p:function(n,t,r){return V("table",{key:r.g},V("thead",null,V("tr",null,n.header.map(function(e,o){return V("th",{key:o,style:yn(n,o)},t(e,r))}))),V("tbody",null,n.cells.map(function(e,o){return V("tr",{key:o},e.map(function(e,o){return V("td",{key:o,style:yn(n,o)},t(e,r))}))})))}},tableSeparator:{i:function(n,t){return t.t?H.exec(n):null},l:On.HIGH,_:function(){return{type:"tableSeparator"}},p:function(){return" | "}},text:{i:xn(tn),l:On.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:On.MED,_:function(n,t,r){return{content:t(n[2],r)}},p:function(n,t,r){return V("strong",{key:r.g},t(n.content,r))}},textEmphasized:{i:kn(K),l:On.LOW,_:function(n,t,r){return{content:t(n[2],r)}},p:function(n,t,r){return V("em",{key:r.g},t(n.content,r))}},textEscaped:{i:kn(nn),l:On.HIGH,_:function(n){return{content:n[1],type:"text"}}},textStrikethroughed:{i:kn(Y),l:On.LOW,_:Rn,p:function(n,t,r){return V("del",{key:r.g},t(n.content,r))}}};!0!==o.disableParsingRawHTML&&(fn.htmlBlock={i:xn(z),l:On.HIGH,_:function(n,t,r){var e,o=n[3].match(en),u=new RegExp("^"+o[1],"gm"),a=n[3].replace(u,""),i=(e=a,dn.some(function(n){return n.test(e)})?An:zn),f=n[1].toLowerCase(),l=-1!==c.indexOf(f);r.m=r.m||"a"===f;var s=l?n[3]:i(t,a,r);return r.m=!1,{attrs:Q(n[2]),content:s,noInnerParse:l,tag:l?f:n[1]}},p:function(n,t,e){return V(n.tag,r({key:e.g},n.attrs),n.noInnerParse?n.content:t(n.content,e))}},fn.htmlSelfClosing={i:xn(R),l:On.HIGH,_:function(n){return{attrs:Q(n[2]||""),tag:n[1]}},p:function(n,t,e){return V(n.tag,r({},n.attrs,{key:e.g}))}});var _n,gn=function(n){var t=Object.keys(n);function r(e,o){for(var u=[],a="";e;)for(var c=0;c<t.length;){var i=t[c],f=n[i],l=f.i(e,o,a);if(l){var s=l[0];e=e.substring(s.length);var _=f._(l,r,o);null==_.type&&(_.type=i),u.push(_),a=s;break}c++}return u}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(h,"\n").replace(x,"").replace(G," ")}(n),t)}}(fn),mn=(_n=function(n){return function(t,r,e){return n[t.type].p(t,r,e)}}(fn),function n(t,r){if(void 0===r&&(r={}),Array.isArray(t)){for(var e=r.g,o=[],u=!1,a=0;a<t.length;a++){r.g=a;var c=n(t[a],r),i="string"==typeof c;i&&u?o[o.length-1]+=c:null!==c&&o.push(c),u=i}return r.g=e,o}return _n(t,n,r)}),Tn=W(n);return X.length?V("div",null,Tn,V("footer",{key:"footer"},X.map(function(n){return V("div",{id:o.slugify(n.identifier),key:n.identifier},n.identifier,mn(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"}(On||(On={}));var Cn=function(n){var r=n.children,e=n.options,u=function(n,t){if(null==n)return{};var r,e,o={},u=Object.keys(n);for(e=0;e<u.length;e++)t.indexOf(r=u[e])>=0||(o[r]=n[r]);return o}(n,o);return t.default.cloneElement(Tn(r,e),u)};Object.assign(Cn,{compiler:Tn}),module.exports=Cn;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|