markdown-to-jsx
Advanced tools
Comparing version 7.4.7 to 7.5.0
/// <reference types="react" /> | ||
import { compiler } from './'; | ||
import { compiler, RuleType } from './index.tsx'; | ||
declare const _default: import("react").FC<{ | ||
@@ -16,5 +16,6 @@ [key: string]: any; | ||
}; | ||
overrides: import("./").MarkdownToJSX.Overrides; | ||
renderRule: (next: () => import("react").ReactChild, node: import("./").MarkdownToJSX.ParserResult, renderChildren: import("./").MarkdownToJSX.RuleOutput, state: import("./").MarkdownToJSX.State) => import("react").ReactChild; | ||
slugify: (source: string) => string; | ||
overrides: import("./index.tsx").MarkdownToJSX.Overrides; | ||
renderRule: (next: () => import("react").ReactChild, node: import("./index.tsx").MarkdownToJSX.ParserResult, renderChildren: import("./index.tsx").MarkdownToJSX.RuleOutput, state: import("./index.tsx").MarkdownToJSX.State) => import("react").ReactChild; | ||
sanitizer: (value: string, tag: keyof JSX.IntrinsicElements, attribute: string) => string; | ||
slugify: (input: string, defaultFn: (input: string) => string) => string; | ||
wrapper: import("react").ElementType<any>; | ||
@@ -24,3 +25,4 @@ }>; | ||
compiler: typeof compiler; | ||
RuleType: typeof RuleType; | ||
}; | ||
export default _default; |
@@ -13,43 +13,44 @@ /** | ||
*/ | ||
export declare const enum RuleType { | ||
blockQuote = "0", | ||
breakLine = "1", | ||
breakThematic = "2", | ||
codeBlock = "3", | ||
codeFenced = "4", | ||
codeInline = "5", | ||
footnote = "6", | ||
footnoteReference = "7", | ||
gfmTask = "8", | ||
heading = "9", | ||
headingSetext = "10", | ||
export declare const RuleType: { | ||
readonly blockQuote: "0"; | ||
readonly breakLine: "1"; | ||
readonly breakThematic: "2"; | ||
readonly codeBlock: "3"; | ||
readonly codeFenced: "4"; | ||
readonly codeInline: "5"; | ||
readonly footnote: "6"; | ||
readonly footnoteReference: "7"; | ||
readonly gfmTask: "8"; | ||
readonly heading: "9"; | ||
readonly headingSetext: "10"; | ||
/** only available if not `disableHTMLParsing` */ | ||
htmlBlock = "11", | ||
htmlComment = "12", | ||
readonly htmlBlock: "11"; | ||
readonly htmlComment: "12"; | ||
/** only available if not `disableHTMLParsing` */ | ||
htmlSelfClosing = "13", | ||
image = "14", | ||
link = "15", | ||
readonly htmlSelfClosing: "13"; | ||
readonly image: "14"; | ||
readonly link: "15"; | ||
/** emits a `link` 'node', does not render directly */ | ||
linkAngleBraceStyleDetector = "16", | ||
readonly linkAngleBraceStyleDetector: "16"; | ||
/** emits a `link` 'node', does not render directly */ | ||
linkBareUrlDetector = "17", | ||
readonly linkBareUrlDetector: "17"; | ||
/** emits a `link` 'node', does not render directly */ | ||
linkMailtoDetector = "18", | ||
newlineCoalescer = "19", | ||
orderedList = "20", | ||
paragraph = "21", | ||
ref = "22", | ||
refImage = "23", | ||
refLink = "24", | ||
table = "25", | ||
tableSeparator = "26", | ||
text = "27", | ||
textBolded = "28", | ||
textEmphasized = "29", | ||
textEscaped = "30", | ||
textMarked = "31", | ||
textStrikethroughed = "32", | ||
unorderedList = "33" | ||
} | ||
readonly linkMailtoDetector: "18"; | ||
readonly newlineCoalescer: "19"; | ||
readonly orderedList: "20"; | ||
readonly paragraph: "21"; | ||
readonly ref: "22"; | ||
readonly refImage: "23"; | ||
readonly refLink: "24"; | ||
readonly table: "25"; | ||
readonly tableSeparator: "26"; | ||
readonly text: "27"; | ||
readonly textBolded: "28"; | ||
readonly textEmphasized: "29"; | ||
readonly textEscaped: "30"; | ||
readonly textMarked: "31"; | ||
readonly textStrikethroughed: "32"; | ||
readonly unorderedList: "33"; | ||
}; | ||
export type RuleType = (typeof RuleType)[keyof typeof RuleType]; | ||
declare const enum Priority { | ||
@@ -78,2 +79,3 @@ /** | ||
export declare function slugify(str: string): string; | ||
export declare function sanitizer(url: string): string; | ||
export declare function compiler(markdown?: string, options?: MarkdownToJSX.Options): JSX.Element; | ||
@@ -114,12 +116,12 @@ /** | ||
children: MarkdownToJSX.ParserResult[]; | ||
type: RuleType.blockQuote; | ||
type: typeof RuleType.blockQuote; | ||
} | ||
export interface BreakLineNode { | ||
type: RuleType.breakLine; | ||
type: typeof RuleType.breakLine; | ||
} | ||
export interface BreakThematicNode { | ||
type: RuleType.breakThematic; | ||
type: typeof RuleType.breakThematic; | ||
} | ||
export interface CodeBlockNode { | ||
type: RuleType.codeBlock; | ||
type: typeof RuleType.codeBlock; | ||
attrs?: JSX.IntrinsicAttributes; | ||
@@ -130,13 +132,13 @@ lang?: string; | ||
export interface CodeFencedNode { | ||
type: RuleType.codeFenced; | ||
type: typeof RuleType.codeFenced; | ||
} | ||
export interface CodeInlineNode { | ||
type: RuleType.codeInline; | ||
type: typeof RuleType.codeInline; | ||
text: string; | ||
} | ||
export interface FootnoteNode { | ||
type: RuleType.footnote; | ||
type: typeof RuleType.footnote; | ||
} | ||
export interface FootnoteReferenceNode { | ||
type: RuleType.footnoteReference; | ||
type: typeof RuleType.footnoteReference; | ||
target: string; | ||
@@ -146,7 +148,7 @@ text: string; | ||
export interface GFMTaskNode { | ||
type: RuleType.gfmTask; | ||
type: typeof RuleType.gfmTask; | ||
completed: boolean; | ||
} | ||
export interface HeadingNode { | ||
type: RuleType.heading; | ||
type: typeof RuleType.heading; | ||
children: MarkdownToJSX.ParserResult[]; | ||
@@ -157,9 +159,9 @@ id: string; | ||
export interface HeadingSetextNode { | ||
type: RuleType.headingSetext; | ||
type: typeof RuleType.headingSetext; | ||
} | ||
export interface HTMLCommentNode { | ||
type: RuleType.htmlComment; | ||
type: typeof RuleType.htmlComment; | ||
} | ||
export interface ImageNode { | ||
type: RuleType.image; | ||
type: typeof RuleType.image; | ||
alt?: string; | ||
@@ -170,3 +172,3 @@ target: string; | ||
export interface LinkNode { | ||
type: RuleType.link; | ||
type: typeof RuleType.link; | ||
children: MarkdownToJSX.ParserResult[]; | ||
@@ -177,12 +179,12 @@ target: string; | ||
export interface LinkAngleBraceNode { | ||
type: RuleType.linkAngleBraceStyleDetector; | ||
type: typeof RuleType.linkAngleBraceStyleDetector; | ||
} | ||
export interface LinkBareURLNode { | ||
type: RuleType.linkBareUrlDetector; | ||
type: typeof RuleType.linkBareUrlDetector; | ||
} | ||
export interface LinkMailtoNode { | ||
type: RuleType.linkMailtoDetector; | ||
type: typeof RuleType.linkMailtoDetector; | ||
} | ||
export interface OrderedListNode { | ||
type: RuleType.orderedList; | ||
type: typeof RuleType.orderedList; | ||
items: MarkdownToJSX.ParserResult[][]; | ||
@@ -193,3 +195,3 @@ ordered: true; | ||
export interface UnorderedListNode { | ||
type: RuleType.unorderedList; | ||
type: typeof RuleType.unorderedList; | ||
items: MarkdownToJSX.ParserResult[][]; | ||
@@ -199,13 +201,13 @@ ordered: false; | ||
export interface NewlineNode { | ||
type: RuleType.newlineCoalescer; | ||
type: typeof RuleType.newlineCoalescer; | ||
} | ||
export interface ParagraphNode { | ||
type: RuleType.paragraph; | ||
type: typeof RuleType.paragraph; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface ReferenceNode { | ||
type: RuleType.ref; | ||
type: typeof RuleType.ref; | ||
} | ||
export interface ReferenceImageNode { | ||
type: RuleType.refImage; | ||
type: typeof RuleType.refImage; | ||
alt?: string; | ||
@@ -215,3 +217,3 @@ ref: string; | ||
export interface ReferenceLinkNode { | ||
type: RuleType.refLink; | ||
type: typeof RuleType.refLink; | ||
children: MarkdownToJSX.ParserResult[]; | ||
@@ -222,3 +224,3 @@ fallbackChildren: MarkdownToJSX.ParserResult[]; | ||
export interface TableNode { | ||
type: RuleType.table; | ||
type: typeof RuleType.table; | ||
/** | ||
@@ -232,29 +234,29 @@ * alignment for each table column | ||
export interface TableSeparatorNode { | ||
type: RuleType.tableSeparator; | ||
type: typeof RuleType.tableSeparator; | ||
} | ||
export interface TextNode { | ||
type: RuleType.text; | ||
type: typeof RuleType.text; | ||
text: string; | ||
} | ||
export interface BoldTextNode { | ||
type: RuleType.textBolded; | ||
type: typeof RuleType.textBolded; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface ItalicTextNode { | ||
type: RuleType.textEmphasized; | ||
type: typeof RuleType.textEmphasized; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface EscapedTextNode { | ||
type: RuleType.textEscaped; | ||
type: typeof RuleType.textEscaped; | ||
} | ||
export interface MarkedTextNode { | ||
type: RuleType.textMarked; | ||
type: typeof RuleType.textMarked; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface StrikethroughTextNode { | ||
type: RuleType.textStrikethroughed; | ||
type: typeof RuleType.textStrikethroughed; | ||
children: MarkdownToJSX.ParserResult[]; | ||
} | ||
export interface HTMLNode { | ||
type: RuleType.htmlBlock; | ||
type: typeof RuleType.htmlBlock; | ||
attrs: JSX.IntrinsicAttributes; | ||
@@ -267,3 +269,3 @@ children?: ReturnType<MarkdownToJSX.NestedParser> | undefined; | ||
export interface HTMLSelfClosingNode { | ||
type: RuleType.htmlSelfClosing; | ||
type: typeof RuleType.htmlSelfClosing; | ||
attrs: JSX.IntrinsicAttributes; | ||
@@ -287,4 +289,4 @@ tag: string; | ||
export type Rules = { | ||
[K in ParserResult['type']]: K extends RuleType.table ? Rule<Extract<ParserResult, { | ||
type: K | RuleType.paragraph; | ||
[K in ParserResult['type']]: K extends typeof RuleType.table ? Rule<Extract<ParserResult, { | ||
type: K | typeof RuleType.paragraph; | ||
}>> : Rule<Extract<ParserResult, { | ||
@@ -393,6 +395,10 @@ type: K; | ||
/** | ||
* Override the built-in sanitizer function for URLs, etc if desired. The built-in version is available as a library export called `sanitizer`. | ||
*/ | ||
sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null; | ||
/** | ||
* Override normalization of non-URI-safe characters for use in generating | ||
* HTML IDs for anchor linking purposes. | ||
*/ | ||
slugify: (source: string) => string; | ||
slugify: (input: string, defaultFn: (input: string) => string) => string; | ||
/** | ||
@@ -399,0 +405,0 @@ * Declare the type of the wrapper to be used when there are multiple |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";function n(){return n=Object.assign?Object.assign.bind():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},n.apply(this,arguments)}const t=["children","options"];var r,i;!function(e){e.blockQuote="0",e.breakLine="1",e.breakThematic="2",e.codeBlock="3",e.codeFenced="4",e.codeInline="5",e.footnote="6",e.footnoteReference="7",e.gfmTask="8",e.heading="9",e.headingSetext="10",e.htmlBlock="11",e.htmlComment="12",e.htmlSelfClosing="13",e.image="14",e.link="15",e.linkAngleBraceStyleDetector="16",e.linkBareUrlDetector="17",e.linkMailtoDetector="18",e.newlineCoalescer="19",e.orderedList="20",e.paragraph="21",e.ref="22",e.refImage="23",e.refLink="24",e.table="25",e.tableSeparator="26",e.text="27",e.textBolded="28",e.textEmphasized="29",e.textEscaped="30",e.textMarked="31",e.textStrikethroughed="32",e.unorderedList="33"}(r||(r={})),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"}(i||(i={}));const l=["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((e,n)=>(e[n.toLowerCase()]=n,e),{for:"htmlFor"}),o={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["style","script"],a=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,s=/mailto:/i,d=/\n{2,}$/,u=/^(\s*>[\s\S]*?)(?=\n{2,})/,p=/^ *> ?/gm,f=/^ {2,}\n/,h=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,m=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,g=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,y=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,k=/^(?:\n *)*\n/,x=/\r\n?/g,v=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,b=/^\[\^([^\]]+)]/,$=/\f/g,E=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,w=/^\s*?\[(x|\s)\]/,S=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,C=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,A=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,O=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,T=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,L=/^<!--[\s\S]*?(?:-->)/,R=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,z=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,M=/^\{.*\}$/,I=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,U=/^<([^ >]+@[^ >]+)>/,j=/^<([^ >]+:\/[^ >]+)>/,B=/-([a-z])?/gi,N=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,H=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,D=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,P=/^\[([^\]]*)\] ?\[([^\]]*)\]/,_=/(\[|\])/g,F=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,W=/\t/g,G=/(^ *\||\| *$)/g,Z=/^ *:-+: *$/,q=/^ *:-+ *$/,V=/^ *-+: *$/,X="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",Q=new RegExp(`^([*_])\\1${X}\\1\\1(?!\\1)`),J=new RegExp(`^([*_])${X}\\1(?!\\1|\\w)`),K=new RegExp(`^==${X}==`),Y=new RegExp(`^~~${X}~~`),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+/,re=/^([ \t]*)/,ie=/\\([^\\])/g,le=/ *\n+$/,oe=/(?:^|\n)( *)$/,ce="(?:\\d+\\.)",ae="(?:[*+-])";function se(e){return"( *)("+(1===e?ce:ae)+") +"}const de=se(1),ue=se(2);function pe(e){return new RegExp("^"+(1===e?de:ue))}const fe=pe(1),he=pe(2);function me(e){return new RegExp("^"+(1===e?de:ue)+"[^\\n]*(?:\\n(?!\\1"+(1===e?ce:ae)+" )[^\\n]*)*(\\n|$)","gm")}const ge=me(1),ye=me(2);function ke(e){const n=1===e?ce:ae;return new RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}const xe=ke(1),ve=ke(2);function be(e,n){const t=1===n,r=t?xe:ve,i=t?ge:ye,l=t?fe:he;return{match(e,n,t){const i=oe.exec(t);return i&&(n.list||!n.inline&&!n.simple)?r.exec(e=i[1]+e):null},order:1,parse(e,n,r){const o=t?+e[2]:void 0,c=e[0].replace(d,"\n").match(i);let a=!1;return{items:c.map(function(e,t){const i=l.exec(e)[0].length,o=new RegExp("^ {1,"+i+"}","gm"),s=e.replace(o,"").replace(l,""),d=t===c.length-1,u=-1!==s.indexOf("\n\n")||d&&a;a=u;const p=r.inline,f=r.list;let h;r.list=!0,u?(r.inline=!1,h=s.replace(le,"\n\n")):(r.inline=!0,h=s.replace(le,""));const m=n(h,r);return r.inline=p,r.list=f,m}),ordered:t,start:o}},render:(n,t,r)=>e(n.ordered?"ol":"ul",{key:r.key,start:"20"===n.type?n.start:void 0},n.items.map(function(n,i){return e("li",{key:i},t(n,r))}))}}const $e=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ee=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,we=[u,m,g,S,A,C,L,N,ge,xe,ye,ve],Se=[...we,/^[^\n]+(?: \n|\n{2,})/,O,z];function Ce(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 Ae(e){return V.test(e)?"right":Z.test(e)?"center":q.test(e)?"left":null}function Oe(e,n,t,r){const i=t.inTable;t.inTable=!0;let l=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce((e,i)=>("|"===i.trim()?e.push(r?{type:"26"}:{type:"27",text:i}):""!==i&&e.push.apply(e,n(i,t)),e),[]);t.inTable=i;let o=[[]];return l.forEach(function(e,n){"26"===e.type?0!==n&&n!==l.length-1&&o.push([]):("27"!==e.type||null!=l[n+1]&&"26"!==l[n+1].type||(e.text=e.text.trimEnd()),o[o.length-1].push(e))}),o}function Te(e,n,t){t.inline=!0;const r=e[2]?e[2].replace(G,"").split("|").map(Ae):[],i=e[3]?function(e,n,t){return e.trim().split("\n").map(function(e){return Oe(e,n,t,!0)})}(e[3],n,t):[],l=Oe(e[1],n,t,!!i.length);return t.inline=!1,i.length?{align:r,cells:i,header:l,type:"25"}:{children:l,type:"21"}}function Le(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function Re(e){return function(n,t){return t.inline?e.exec(n):null}}function ze(e){return function(n,t){return t.inline||t.simple?e.exec(n):null}}function Me(e){return function(n,t){return t.inline||t.simple?null:e.exec(n)}}function Ie(e){return function(n){return e.exec(n)}}function Ue(e,n,t){if(n.inline||n.simple)return null;if(t&&!t.endsWith("\n"))return null;let r="";e.split("\n").every(e=>!we.some(n=>n.test(e))&&(r+=e+"\n",e.trim()));const i=r.trimEnd();return""==i?null:[r,i]}function je(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return}catch(e){return null}return e}function Be(e){return e.replace(ie,"$1")}function Ne(e,n,t){const r=t.inline||!1,i=t.simple||!1;t.inline=!0,t.simple=!0;const l=e(n,t);return t.inline=r,t.simple=i,l}function He(e,n,t){const r=t.inline||!1,i=t.simple||!1;t.inline=!1,t.simple=!0;const l=e(n,t);return t.inline=r,t.simple=i,l}function De(e,n,t){const r=t.inline||!1;t.inline=!1;const i=e(n,t);return t.inline=r,i}const Pe=(e,n,t)=>({children:Ne(n,e[1],t)});function _e(){return{}}function Fe(){return null}function We(...e){return e.filter(Boolean).join(" ")}function Ge(e,n,t){let r=e;const i=n.split(".");for(;i.length&&(r=r[i[0]],void 0!==r);)i.shift();return r||t}function Ze(t="",r={}){r.overrides=r.overrides||{},r.slugify=r.slugify||Ce,r.namedCodesToUnicode=r.namedCodesToUnicode?n({},o,r.namedCodesToUnicode):o;const i=r.createElement||e.createElement;function d(e,t,...l){const o=Ge(r.overrides,`${e}.props`,{});return i(function(e,n){const t=Ge(n,e);return t?"function"==typeof t||"object"==typeof t&&"render"in t?t:Ge(n,`${e}.component`,e):e}(e,r.overrides),n({},t,o,{className:We(null==t?void 0:t.className,o.className)||void 0}),...l)}function G(n){n=n.replace(E,"");let t=!1;r.forceInline?t=!0:r.forceBlock||(t=!1===F.test(n));const i=le(ie(t?n:`${n.trimEnd().replace(te,"")}\n\n`,{inline:t}));for(;"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===r.wrapper)return i;const l=r.wrapper||(t?"span":"div");let o;if(i.length>1||r.forceWrapper)o=i;else{if(1===i.length)return o=i[0],"string"==typeof o?d("span",{key:"outer"},o):o;o=null}return e.createElement(l,{key:"outer"},o)}function Z(n){const t=n.match(a);return t?t.reduce(function(n,t,r){const i=t.indexOf("=");if(-1!==i){const o=function(e){return-1!==e.indexOf("-")&&null===e.match(R)&&(e=e.replace(B,function(e,n){return n.toUpperCase()})),e}(t.slice(0,i)).trim(),c=function(e){const n=e[0];return('"'===n||"'"===n)&&e.length>=2&&e[e.length-1]===n?e.slice(1,-1):e}(t.slice(i+1).trim()),a=l[o]||o,s=n[a]=function(e,n){return"style"===e?n.split(/;\s?/).reduce(function(e,n){const t=n.slice(0,n.indexOf(":"));return e[t.trim().replace(/(-[a-z])/g,e=>e[1].toUpperCase())]=n.slice(t.length+1).trim(),e},{}):"href"===e||"src"===e?je(n):(n.match(M)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(o,c);"string"==typeof s&&(O.test(s)||z.test(s))&&(n[a]=e.cloneElement(G(s.trim()),{key:r}))}else"style"!==t&&(n[l[t]||t]=!0);return n},{}):null}const q=[],V={},X={0:{match:Me(u),order:1,parse:(e,n,t)=>({children:n(e[0].replace(p,""),t)}),render:(e,n,t)=>d("blockquote",{key:t.key},n(e.children,t))},1:{match:Ie(f),order:1,parse:_e,render:(e,n,t)=>d("br",{key:t.key})},2:{match:Me(h),order:1,parse:_e,render:(e,n,t)=>d("hr",{key:t.key})},3:{match:Me(g),order:0,parse:e=>({lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}),render:(e,t,r)=>d("pre",{key:r.key},d("code",n({},e.attrs,{className:e.lang?`lang-${e.lang}`:""}),e.text))},4:{match:Me(m),order:0,parse:e=>({attrs:Z(e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"})},5:{match:ze(y),order:3,parse:e=>({text:e[2]}),render:(e,n,t)=>d("code",{key:t.key},e.text)},6:{match:Me(v),order:0,parse:e=>(q.push({footnote:e[2],identifier:e[1]}),{}),render:Fe},7:{match:Re(b),order:1,parse:e=>({target:`#${r.slugify(e[1])}`,text:e[1]}),render:(e,n,t)=>d("a",{key:t.key,href:je(e.target)},d("sup",{key:t.key},e.text))},8:{match:Re(w),order:1,parse:e=>({completed:"x"===e[1].toLowerCase()}),render:(e,n,t)=>d("input",{checked:e.completed,key:t.key,readOnly:!0,type:"checkbox"})},9:{match:Me(r.enforceAtxHeadings?C:S),order:1,parse:(e,n,t)=>({children:Ne(n,e[2],t),id:r.slugify(e[2]),level:e[1].length}),render:(e,n,t)=>d(`h${e.level}`,{id:e.id,key:t.key},n(e.children,t))},10:{match:Me(A),order:0,parse:(e,n,t)=>({children:Ne(n,e[1],t),level:"="===e[2]?1:2,type:"9"})},11:{match:Ie(O),order:1,parse(e,n,t){const[,r]=e[3].match(re),i=new RegExp(`^${r}`,"gm"),l=e[3].replace(i,""),o=(a=l,Se.some(e=>e.test(a))?De:Ne);var a;const s=e[1].toLowerCase(),d=-1!==c.indexOf(s),u={attrs:Z(e[2]),noInnerParse:d,tag:(d?s:e[1]).trim()};return t.inAnchor=t.inAnchor||"a"===s,d?u.text=e[3]:u.children=o(n,l,t),t.inAnchor=!1,u},render:(e,t,r)=>d(e.tag,n({key:r.key},e.attrs),e.text||t(e.children,r))},13:{match:Ie(z),order:1,parse:e=>({attrs:Z(e[2]||""),tag:e[1].trim()}),render:(e,t,r)=>d(e.tag,n({},e.attrs,{key:r.key}))},12:{match:Ie(L),order:1,parse:()=>({}),render:Fe},14:{match:ze(Ee),order:1,parse:e=>({alt:e[1],target:Be(e[2]),title:e[3]}),render:(e,n,t)=>d("img",{key:t.key,alt:e.alt||void 0,title:e.title||void 0,src:je(e.target)})},15:{match:Re($e),order:3,parse:(e,n,t)=>({children:He(n,e[1],t),target:Be(e[2]),title:e[3]}),render:(e,n,t)=>d("a",{key:t.key,href:je(e.target),title:e.title},n(e.children,t))},16:{match:Re(j),order:0,parse:e=>({children:[{text:e[1],type:"27"}],target:e[1],type:"15"})},17:{match:(e,n)=>n.inAnchor?null:Re(I)(e,n),order:0,parse:e=>({children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"})},18:{match:Re(U),order:0,parse(e){let n=e[1],t=e[1];return s.test(t)||(t="mailto:"+t),{children:[{text:n.replace("mailto:",""),type:"27"}],target:t,type:"15"}}},20:be(d,1),33:be(d,2),19:{match:Me(k),order:3,parse:_e,render:()=>"\n"},21:{match:Ue,order:3,parse:Pe,render:(e,n,t)=>d("p",{key:t.key},n(e.children,t))},22:{match:Re(H),order:0,parse:e=>(V[e[1]]={target:e[2],title:e[4]},{}),render:Fe},23:{match:ze(D),order:0,parse:e=>({alt:e[1]||void 0,ref:e[2]}),render:(e,n,t)=>V[e.ref]?d("img",{key:t.key,alt:e.alt,src:je(V[e.ref].target),title:V[e.ref].title}):null},24:{match:Re(P),order:0,parse:(e,n,t)=>({children:n(e[1],t),fallbackChildren:n(e[0].replace(_,"\\$1"),t),ref:e[2]}),render:(e,n,t)=>V[e.ref]?d("a",{key:t.key,href:je(V[e.ref].target),title:V[e.ref].title},n(e.children,t)):d("span",{key:t.key},n(e.fallbackChildren,t))},25:{match:Me(N),order:1,parse:Te,render(e,n,t){const r=e;return d("table",{key:t.key},d("thead",null,d("tr",null,r.header.map(function(e,i){return d("th",{key:i,style:Le(r,i)},n(e,t))}))),d("tbody",null,r.cells.map(function(e,i){return d("tr",{key:i},e.map(function(e,i){return d("td",{key:i,style:Le(r,i)},n(e,t))}))})))}},27:{match:Ie(ne),order:4,parse:e=>({text:e[0].replace(T,(e,n)=>r.namedCodesToUnicode[n]?r.namedCodesToUnicode[n]:e)}),render:e=>e.text},28:{match:ze(Q),order:2,parse:(e,n,t)=>({children:n(e[2],t)}),render:(e,n,t)=>d("strong",{key:t.key},n(e.children,t))},29:{match:ze(J),order:3,parse:(e,n,t)=>({children:n(e[2],t)}),render:(e,n,t)=>d("em",{key:t.key},n(e.children,t))},30:{match:ze(ee),order:1,parse:e=>({text:e[1],type:"27"})},31:{match:ze(K),order:3,parse:Pe,render:(e,n,t)=>d("mark",{key:t.key},n(e.children,t))},32:{match:ze(Y),order:3,parse:Pe,render:(e,n,t)=>d("del",{key:t.key},n(e.children,t))}};!0===r.disableParsingRawHTML&&(delete X[11],delete X[13]);const ie=function(e){let n=Object.keys(e);function t(r,i){let l=[],o="";for(;r;){let c=0;for(;c<n.length;){const a=n[c],s=e[a],d=s.match(r,i,o);if(d){const e=d[0];r=r.substring(e.length);const n=s.parse(d,t,i);null==n.type&&(n.type=a),l.push(n),o=e;break}c++}}return l}return n.sort(function(n,t){let r=e[n].order,i=e[t].order;return r!==i?r-i:n<t?-1:1}),function(e,n){return t(function(e){return e.replace(x,"\n").replace($,"").replace(W," ")}(e),n)}}(X),le=(oe=function(e,n){return function(t,r,i){const l=e[t.type].render;return n?n(()=>l(t,r,i),t,r,i):l(t,r,i)}}(X,r.renderRule),function e(n,t={}){if(Array.isArray(n)){const r=t.key,i=[];let l=!1;for(let r=0;r<n.length;r++){t.key=r;const o=e(n[r],t),c="string"==typeof o;c&&l?i[i.length-1]+=o:null!==o&&i.push(o),l=c}return t.key=r,i}return oe(n,e,t)});var oe;const ce=G(t);return q.length?d("div",null,ce,d("footer",{key:"footer"},q.map(function(e){return d("div",{id:r.slugify(e.identifier),key:e.identifier},e.identifier,le(ie(e.footnote,{inline:!0})))}))):ce}export default n=>{let{children:r="",options:i}=n,l=function(e,n){if(null==e)return{};var t,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n.indexOf(t=l[r])>=0||(i[t]=e[t]);return i}(n,t);return e.cloneElement(Ze(r,i),l)};export{r as RuleType,Ze as compiler,Ce as slugify}; | ||
import*as e from"react";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}const n=["children","options"],r={blockQuote:"0",breakLine:"1",breakThematic:"2",codeBlock:"3",codeFenced:"4",codeInline:"5",footnote:"6",footnoteReference:"7",gfmTask:"8",heading:"9",headingSetext:"10",htmlBlock:"11",htmlComment:"12",htmlSelfClosing:"13",image:"14",link:"15",linkAngleBraceStyleDetector:"16",linkBareUrlDetector:"17",linkMailtoDetector:"18",newlineCoalescer:"19",orderedList:"20",paragraph:"21",ref:"22",refImage:"23",refLink:"24",table:"25",tableSeparator:"26",text:"27",textBolded:"28",textEmphasized:"29",textEscaped:"30",textMarked:"31",textStrikethroughed:"32",unorderedList:"33"};var i;!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"}(i||(i={}));const l=["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((e,t)=>(e[t.toLowerCase()]=t,e),{for:"htmlFor"}),a={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},o=["style","script"],c=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,s=/mailto:/i,d=/\n{2,}$/,u=/^(\s*>[\s\S]*?)(?=\n{2,})/,p=/^ *> ?/gm,f=/^ {2,}\n/,h=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,m=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,g=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,y=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,k=/^(?:\n *)*\n/,x=/\r\n?/g,b=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,v=/^\[\^([^\]]+)]/,S=/\f/g,E=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,$=/^\s*?\[(x|\s)\]/,w=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,C=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,z=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,L=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,A=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,T=/^<!--[\s\S]*?(?:-->)/,O=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,B=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,M=/^\{.*\}$/,R=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,I=/^<([^ >]+@[^ >]+)>/,U=/^<([^ >]+:\/[^ >]+)>/,D=/-([a-z])?/gi,j=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,N=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,H=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,F=/^\[([^\]]*)\] ?\[([^\]]*)\]/,P=/(\[|\])/g,_=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,W=/\t/g,G=/(^ *\||\| *$)/g,Z=/^ *:-+: *$/,q=/^ *:-+ *$/,Q=/^ *-+: *$/,V="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",X=new RegExp(`^([*_])\\1${V}\\1\\1(?!\\1)`),J=new RegExp(`^([*_])${V}\\1(?!\\1|\\w)`),K=new RegExp(`^==${V}==`),Y=new RegExp(`^~~${V}~~`),ee=/^\\([^0-9A-Za-z\s])/,te=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ne=/^\n+/,re=/^([ \t]*)/,ie=/\\([^\\])/g,le=/ *\n+$/,ae=/(?:^|\n)( *)$/,oe="(?:\\d+\\.)",ce="(?:[*+-])";function se(e){return"( *)("+(1===e?oe:ce)+") +"}const de=se(1),ue=se(2);function pe(e){return new RegExp("^"+(1===e?de:ue))}const fe=pe(1),he=pe(2);function me(e){return new RegExp("^"+(1===e?de:ue)+"[^\\n]*(?:\\n(?!\\1"+(1===e?oe:ce)+" )[^\\n]*)*(\\n|$)","gm")}const ge=me(1),ye=me(2);function ke(e){const t=1===e?oe:ce;return new RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const xe=ke(1),be=ke(2);function ve(e,t){const n=1===t,i=n?xe:be,l=n?ge:ye,a=n?fe:he;return{match(e,t,n){const r=ae.exec(n);return r&&(t.list||!t.inline&&!t.simple)?i.exec(e=r[1]+e):null},order:1,parse(e,t,r){const i=n?+e[2]:void 0,o=e[0].replace(d,"\n").match(l);let c=!1;return{items:o.map(function(e,n){const i=a.exec(e)[0].length,l=new RegExp("^ {1,"+i+"}","gm"),s=e.replace(l,"").replace(a,""),d=n===o.length-1,u=-1!==s.indexOf("\n\n")||d&&c;c=u;const p=r.inline,f=r.list;let h;r.list=!0,u?(r.inline=!1,h=s.replace(le,"\n\n")):(r.inline=!0,h=s.replace(le,""));const m=t(h,r);return r.inline=p,r.list=f,m}),ordered:n,start:i}},render:(t,n,i)=>e(t.ordered?"ol":"ul",{key:i.key,start:t.type===r.orderedList?t.start:void 0},t.items.map(function(t,r){return e("li",{key:r},n(t,i))}))}}const Se=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ee=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,$e=[u,m,g,w,z,C,T,j,ge,xe,ye,be],we=[...$e,/^[^\n]+(?: \n|\n{2,})/,L,B];function Ce(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 ze(e){return Q.test(e)?"right":Z.test(e)?"center":q.test(e)?"left":null}function Le(e,t,n,i){const l=n.inTable;n.inTable=!0;let a=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce((e,l)=>("|"===l.trim()?e.push(i?{type:r.tableSeparator}:{type:r.text,text:l}):""!==l&&e.push.apply(e,t(l,n)),e),[]);n.inTable=l;let o=[[]];return a.forEach(function(e,t){e.type===r.tableSeparator?0!==t&&t!==a.length-1&&o.push([]):(e.type!==r.text||null!=a[t+1]&&a[t+1].type!==r.tableSeparator||(e.text=e.text.trimEnd()),o[o.length-1].push(e))}),o}function Ae(e,t,n){n.inline=!0;const i=e[2]?e[2].replace(G,"").split("|").map(ze):[],l=e[3]?function(e,t,n){return e.trim().split("\n").map(function(e){return Le(e,t,n,!0)})}(e[3],t,n):[],a=Le(e[1],t,n,!!l.length);return n.inline=!1,l.length?{align:i,cells:l,header:a,type:r.table}:{children:a,type:r.paragraph}}function Te(e,t){return null==e.align[t]?{}:{textAlign:e.align[t]}}function Oe(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 Me(e){return function(t,n){return n.inline||n.simple?null:e.exec(t)}}function Re(e){return function(t){return e.exec(t)}}function Ie(e,t,n){if(t.inline||t.simple)return null;if(n&&!n.endsWith("\n"))return null;let r="";e.split("\n").every(e=>!$e.some(t=>t.test(e))&&(r+=e+"\n",e.trim()));const i=r.trimEnd();return""==i?null:[r,i]}function Ue(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch(e){return null}return e}function De(e){return e.replace(ie,"$1")}function je(e,t,n){const r=n.inline||!1,i=n.simple||!1;n.inline=!0,n.simple=!0;const l=e(t,n);return n.inline=r,n.simple=i,l}function Ne(e,t,n){const r=n.inline||!1,i=n.simple||!1;n.inline=!1,n.simple=!0;const l=e(t,n);return n.inline=r,n.simple=i,l}function He(e,t,n){const r=n.inline||!1;n.inline=!1;const i=e(t,n);return n.inline=r,i}const Fe=(e,t,n)=>({children:je(t,e[1],n)});function Pe(){return{}}function _e(){return null}function We(...e){return e.filter(Boolean).join(" ")}function Ge(e,t,n){let r=e;const i=t.split(".");for(;i.length&&(r=r[i[0]],void 0!==r);)i.shift();return r||n}function Ze(n="",i={}){function d(e,n,...r){const l=Ge(i.overrides,`${e}.props`,{});return i.createElement(function(e,t){const n=Ge(t,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:Ge(t,`${e}.component`,e):e}(e,i.overrides),t({},n,l,{className:We(null==n?void 0:n.className,l.className)||void 0}),...r)}function G(t){t=t.replace(E,"");let n=!1;i.forceInline?n=!0:i.forceBlock||(n=!1===_.test(t));const r=le(ie(n?t:`${t.trimEnd().replace(ne,"")}\n\n`,{inline:n}));for(;"string"==typeof r[r.length-1]&&!r[r.length-1].trim();)r.pop();if(null===i.wrapper)return r;const l=i.wrapper||(n?"span":"div");let a;if(r.length>1||i.forceWrapper)a=r;else{if(1===r.length)return a=r[0],"string"==typeof a?d("span",{key:"outer"},a):a;a=null}return e.createElement(l,{key:"outer"},a)}function Z(t,n){const r=n.match(c);return r?r.reduce(function(n,r,a){const o=r.indexOf("=");if(-1!==o){const c=function(e){return-1!==e.indexOf("-")&&null===e.match(O)&&(e=e.replace(D,function(e,t){return t.toUpperCase()})),e}(r.slice(0,o)).trim(),s=function(e){const t=e[0];return('"'===t||"'"===t)&&e.length>=2&&e[e.length-1]===t?e.slice(1,-1):e}(r.slice(o+1).trim()),d=l[c]||c,u=n[d]=function(e,t,n,r){return"style"===t?n.split(/;\s?/).reduce(function(e,t){const n=t.slice(0,t.indexOf(":"));return e[n.trim().replace(/(-[a-z])/g,e=>e[1].toUpperCase())]=t.slice(n.length+1).trim(),e},{}):"href"===t||"src"===t?r(n,e,t):(n.match(M)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(t,c,s,i.sanitizer);"string"==typeof u&&(L.test(u)||B.test(u))&&(n[d]=e.cloneElement(G(u.trim()),{key:a}))}else"style"!==r&&(n[l[r]||r]=!0);return n},{}):null}i.overrides=i.overrides||{},i.sanitizer=i.sanitizer||Ue,i.slugify=i.slugify||Ce,i.namedCodesToUnicode=i.namedCodesToUnicode?t({},a,i.namedCodesToUnicode):a,i.createElement=i.createElement||e.createElement;const q=[],Q={},V={[r.blockQuote]:{match:Me(u),order:1,parse:(e,t,n)=>({children:t(e[0].replace(p,""),n)}),render:(e,t,n)=>d("blockquote",{key:n.key},t(e.children,n))},[r.breakLine]:{match:Re(f),order:1,parse:Pe,render:(e,t,n)=>d("br",{key:n.key})},[r.breakThematic]:{match:Me(h),order:1,parse:Pe,render:(e,t,n)=>d("hr",{key:n.key})},[r.codeBlock]:{match:Me(g),order:0,parse:e=>({lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}),render:(e,n,r)=>d("pre",{key:r.key},d("code",t({},e.attrs,{className:e.lang?`lang-${e.lang}`:""}),e.text))},[r.codeFenced]:{match:Me(m),order:0,parse:e=>({attrs:Z("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:r.codeBlock})},[r.codeInline]:{match:Be(y),order:3,parse:e=>({text:e[2]}),render:(e,t,n)=>d("code",{key:n.key},e.text)},[r.footnote]:{match:Me(b),order:0,parse:e=>(q.push({footnote:e[2],identifier:e[1]}),{}),render:_e},[r.footnoteReference]:{match:Oe(v),order:1,parse:e=>({target:`#${i.slugify(e[1],Ce)}`,text:e[1]}),render:(e,t,n)=>d("a",{key:n.key,href:i.sanitizer(e.target,"a","href")},d("sup",{key:n.key},e.text))},[r.gfmTask]:{match:Oe($),order:1,parse:e=>({completed:"x"===e[1].toLowerCase()}),render:(e,t,n)=>d("input",{checked:e.completed,key:n.key,readOnly:!0,type:"checkbox"})},[r.heading]:{match:Me(i.enforceAtxHeadings?C:w),order:1,parse:(e,t,n)=>({children:je(t,e[2],n),id:i.slugify(e[2],Ce),level:e[1].length}),render:(e,t,n)=>d(`h${e.level}`,{id:e.id,key:n.key},t(e.children,n))},[r.headingSetext]:{match:Me(z),order:0,parse:(e,t,n)=>({children:je(t,e[1],n),level:"="===e[2]?1:2,type:r.heading})},[r.htmlBlock]:{match:Re(L),order:1,parse(e,t,n){const[,r]=e[3].match(re),i=new RegExp(`^${r}`,"gm"),l=e[3].replace(i,""),a=(c=l,we.some(e=>e.test(c))?He:je);var c;const s=e[1].toLowerCase(),d=-1!==o.indexOf(s),u=(d?s:e[1]).trim(),p={attrs:Z(u,e[2]),noInnerParse:d,tag:u};return n.inAnchor=n.inAnchor||"a"===s,d?p.text=e[3]:p.children=a(t,l,n),n.inAnchor=!1,p},render:(e,n,r)=>d(e.tag,t({key:r.key},e.attrs),e.text||n(e.children,r))},[r.htmlSelfClosing]:{match:Re(B),order:1,parse(e){const t=e[1].trim();return{attrs:Z(t,e[2]||""),tag:t}},render:(e,n,r)=>d(e.tag,t({},e.attrs,{key:r.key}))},[r.htmlComment]:{match:Re(T),order:1,parse:()=>({}),render:_e},[r.image]:{match:Be(Ee),order:1,parse:e=>({alt:e[1],target:De(e[2]),title:e[3]}),render:(e,t,n)=>d("img",{key:n.key,alt:e.alt||void 0,title:e.title||void 0,src:i.sanitizer(e.target,"img","src")})},[r.link]:{match:Oe(Se),order:3,parse:(e,t,n)=>({children:Ne(t,e[1],n),target:De(e[2]),title:e[3]}),render:(e,t,n)=>d("a",{key:n.key,href:i.sanitizer(e.target,"a","href"),title:e.title},t(e.children,n))},[r.linkAngleBraceStyleDetector]:{match:Oe(U),order:0,parse:e=>({children:[{text:e[1],type:r.text}],target:e[1],type:r.link})},[r.linkBareUrlDetector]:{match:(e,t)=>t.inAnchor?null:Oe(R)(e,t),order:0,parse:e=>({children:[{text:e[1],type:r.text}],target:e[1],title:void 0,type:r.link})},[r.linkMailtoDetector]:{match:Oe(I),order:0,parse(e){let t=e[1],n=e[1];return s.test(n)||(n="mailto:"+n),{children:[{text:t.replace("mailto:",""),type:r.text}],target:n,type:r.link}}},[r.orderedList]:ve(d,1),[r.unorderedList]:ve(d,2),[r.newlineCoalescer]:{match:Me(k),order:3,parse:Pe,render:()=>"\n"},[r.paragraph]:{match:Ie,order:3,parse:Fe,render:(e,t,n)=>d("p",{key:n.key},t(e.children,n))},[r.ref]:{match:Oe(N),order:0,parse:e=>(Q[e[1]]={target:e[2],title:e[4]},{}),render:_e},[r.refImage]:{match:Be(H),order:0,parse:e=>({alt:e[1]||void 0,ref:e[2]}),render:(e,t,n)=>Q[e.ref]?d("img",{key:n.key,alt:e.alt,src:i.sanitizer(Q[e.ref].target,"img","src"),title:Q[e.ref].title}):null},[r.refLink]:{match:Oe(F),order:0,parse:(e,t,n)=>({children:t(e[1],n),fallbackChildren:t(e[0].replace(P,"\\$1"),n),ref:e[2]}),render:(e,t,n)=>Q[e.ref]?d("a",{key:n.key,href:i.sanitizer(Q[e.ref].target,"a","href"),title:Q[e.ref].title},t(e.children,n)):d("span",{key:n.key},t(e.fallbackChildren,n))},[r.table]:{match:Me(j),order:1,parse:Ae,render(e,t,n){const r=e;return d("table",{key:n.key},d("thead",null,d("tr",null,r.header.map(function(e,i){return d("th",{key:i,style:Te(r,i)},t(e,n))}))),d("tbody",null,r.cells.map(function(e,i){return d("tr",{key:i},e.map(function(e,i){return d("td",{key:i,style:Te(r,i)},t(e,n))}))})))}},[r.text]:{match:Re(te),order:4,parse:e=>({text:e[0].replace(A,(e,t)=>i.namedCodesToUnicode[t]?i.namedCodesToUnicode[t]:e)}),render:e=>e.text},[r.textBolded]:{match:Be(X),order:2,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,n)=>d("strong",{key:n.key},t(e.children,n))},[r.textEmphasized]:{match:Be(J),order:3,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,n)=>d("em",{key:n.key},t(e.children,n))},[r.textEscaped]:{match:Be(ee),order:1,parse:e=>({text:e[1],type:r.text})},[r.textMarked]:{match:Be(K),order:3,parse:Fe,render:(e,t,n)=>d("mark",{key:n.key},t(e.children,n))},[r.textStrikethroughed]:{match:Be(Y),order:3,parse:Fe,render:(e,t,n)=>d("del",{key:n.key},t(e.children,n))}};!0===i.disableParsingRawHTML&&(delete V[r.htmlBlock],delete V[r.htmlSelfClosing]);const ie=function(e){let t=Object.keys(e);function n(r,i){let l=[],a="";for(;r;){let o=0;for(;o<t.length;){const c=t[o],s=e[c],d=s.match(r,i,a);if(d){const e=d[0];r=r.substring(e.length);const t=s.parse(d,n,i);null==t.type&&(t.type=c),l.push(t),a=e;break}o++}}return l}return t.sort(function(t,n){let r=e[t].order,i=e[n].order;return r!==i?r-i:t<n?-1:1}),function(e,t){return n(function(e){return e.replace(x,"\n").replace(S,"").replace(W," ")}(e),t)}}(V),le=(ae=function(e,t){return function(n,r,i){const l=e[n.type].render;return t?t(()=>l(n,r,i),n,r,i):l(n,r,i)}}(V,i.renderRule),function e(t,n={}){if(Array.isArray(t)){const r=n.key,i=[];let l=!1;for(let r=0;r<t.length;r++){n.key=r;const a=e(t[r],n),o="string"==typeof a;o&&l?i[i.length-1]+=a:null!==a&&i.push(a),l=o}return n.key=r,i}return ae(t,e,n)});var ae;const oe=G(n);return q.length?d("div",null,oe,d("footer",{key:"footer"},q.map(function(e){return d("div",{id:i.slugify(e.identifier,Ce),key:e.identifier},e.identifier,le(ie(e.footnote,{inline:!0})))}))):oe}export default t=>{let{children:r="",options:i}=t,l=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)t.indexOf(n=l[r])>=0||(i[n]=e[n]);return i}(t,n);return e.cloneElement(Ze(r,i),l)};export{r as RuleType,Ze as compiler,Ue as sanitizer,Ce as slugify}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";function n(){return n=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},n.apply(this,arguments)}var r,t,i=["children","options"];!function(e){e.blockQuote="0",e.breakLine="1",e.breakThematic="2",e.codeBlock="3",e.codeFenced="4",e.codeInline="5",e.footnote="6",e.footnoteReference="7",e.gfmTask="8",e.heading="9",e.headingSetext="10",e.htmlBlock="11",e.htmlComment="12",e.htmlSelfClosing="13",e.image="14",e.link="15",e.linkAngleBraceStyleDetector="16",e.linkBareUrlDetector="17",e.linkMailtoDetector="18",e.newlineCoalescer="19",e.orderedList="20",e.paragraph="21",e.ref="22",e.refImage="23",e.refLink="24",e.table="25",e.tableSeparator="26",e.text="27",e.textBolded="28",e.textEmphasized="29",e.textEscaped="30",e.textMarked="31",e.textStrikethroughed="32",e.unorderedList="33"}(r||(r={})),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"}(t||(t={}));var a=["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(e,n){return e[n.toLowerCase()]=n,e},{for:"htmlFor"}),o={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["style","script"],l=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,u=/mailto:/i,s=/\n{2,}$/,f=/^(\s*>[\s\S]*?)(?=\n{2,})/,d=/^ *> ?/gm,p=/^ {2,}\n/,h=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,m=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,g=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,y=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,v=/^(?:\n *)*\n/,k=/\r\n?/g,x=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,b=/^\[\^([^\]]+)]/,E=/\f/g,w=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,S=/^\s*?\[(x|\s)\]/,C=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,A=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,O=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,$=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,T=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,L=/^<!--[\s\S]*?(?:-->)/,R=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,z=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,M=/^\{.*\}$/,I=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,U=/^<([^ >]+@[^ >]+)>/,j=/^<([^ >]+:\/[^ >]+)>/,B=/-([a-z])?/gi,N=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,H=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,D=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,P=/^\[([^\]]*)\] ?\[([^\]]*)\]/,_=/(\[|\])/g,F=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,W=/\t/g,G=/(^ *\||\| *$)/g,Z=/^ *:-+: *$/,q=/^ *:-+ *$/,V=/^ *-+: *$/,X="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",Q=new RegExp("^([*_])\\1"+X+"\\1\\1(?!\\1)"),J=new RegExp("^([*_])"+X+"\\1(?!\\1|\\w)"),K=new RegExp("^=="+X+"=="),Y=new RegExp("^~~"+X+"~~"),ee=/^\\([^0-9A-Za-z\s])/,ne=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,re=/^\n+/,te=/^([ \t]*)/,ie=/\\([^\\])/g,ae=/ *\n+$/,oe=/(?:^|\n)( *)$/,ce="(?:\\d+\\.)",le="(?:[*+-])";function ue(e){return"( *)("+(1===e?ce:le)+") +"}var se=ue(1),fe=ue(2);function de(e){return new RegExp("^"+(1===e?se:fe))}var pe=de(1),he=de(2);function me(e){return new RegExp("^"+(1===e?se:fe)+"[^\\n]*(?:\\n(?!\\1"+(1===e?ce:le)+" )[^\\n]*)*(\\n|$)","gm")}var ge=me(1),ye=me(2);function ve(e){var n=1===e?ce:le;return new RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}var ke=ve(1),xe=ve(2);function be(e,n){var r=1===n,t=r?ke:xe,i=r?ge:ye,a=r?pe:he;return{match:function(e,n,r){var i=oe.exec(r);return i&&(n.list||!n.inline&&!n.simple)?t.exec(e=i[1]+e):null},order:1,parse:function(e,n,t){var o=r?+e[2]:void 0,c=e[0].replace(s,"\n").match(i),l=!1;return{items:c.map(function(e,r){var i=a.exec(e)[0].length,o=new RegExp("^ {1,"+i+"}","gm"),u=e.replace(o,"").replace(a,""),s=r===c.length-1,f=-1!==u.indexOf("\n\n")||s&&l;l=f;var d,p=t.inline,h=t.list;t.list=!0,f?(t.inline=!1,d=u.replace(ae,"\n\n")):(t.inline=!0,d=u.replace(ae,""));var m=n(d,t);return t.inline=p,t.list=h,m}),ordered:r,start:o}},render:function(n,r,t){return e(n.ordered?"ol":"ul",{key:t.key,start:"20"===n.type?n.start:void 0},n.items.map(function(n,i){return e("li",{key:i},r(n,t))}))}}}var Ee=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),we=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Se=[f,m,g,C,O,A,L,N,ge,ke,ye,xe],Ce=[].concat(Se,[/^[^\n]+(?: \n|\n{2,})/,$,z]);function Ae(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 Oe(e){return V.test(e)?"right":Z.test(e)?"center":q.test(e)?"left":null}function $e(e,n,r,t){var i=r.inTable;r.inTable=!0;var a=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(function(e,i){return"|"===i.trim()?e.push(t?{type:"26"}:{type:"27",text:i}):""!==i&&e.push.apply(e,n(i,r)),e},[]);r.inTable=i;var o=[[]];return a.forEach(function(e,n){"26"===e.type?0!==n&&n!==a.length-1&&o.push([]):("27"!==e.type||null!=a[n+1]&&"26"!==a[n+1].type||(e.text=e.text.trimEnd()),o[o.length-1].push(e))}),o}function Te(e,n,r){r.inline=!0;var t=e[2]?e[2].replace(G,"").split("|").map(Oe):[],i=e[3]?function(e,n,r){return e.trim().split("\n").map(function(e){return $e(e,n,r,!0)})}(e[3],n,r):[],a=$e(e[1],n,r,!!i.length);return r.inline=!1,i.length?{align:t,cells:i,header:a,type:"25"}:{children:a,type:"21"}}function Le(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function Re(e){return function(n,r){return r.inline?e.exec(n):null}}function ze(e){return function(n,r){return r.inline||r.simple?e.exec(n):null}}function Me(e){return function(n,r){return r.inline||r.simple?null:e.exec(n)}}function Ie(e){return function(n){return e.exec(n)}}function Ue(e,n,r){if(n.inline||n.simple)return null;if(r&&!r.endsWith("\n"))return null;var t="";e.split("\n").every(function(e){return!Se.some(function(n){return n.test(e)})&&(t+=e+"\n",e.trim())});var i=t.trimEnd();return""==i?null:[t,i]}function je(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return}catch(e){return null}return e}function Be(e){return e.replace(ie,"$1")}function Ne(e,n,r){var t=r.inline||!1,i=r.simple||!1;r.inline=!0,r.simple=!0;var a=e(n,r);return r.inline=t,r.simple=i,a}function He(e,n,r){var t=r.inline||!1,i=r.simple||!1;r.inline=!1,r.simple=!0;var a=e(n,r);return r.inline=t,r.simple=i,a}function De(e,n,r){var t=r.inline||!1;r.inline=!1;var i=e(n,r);return r.inline=t,i}var Pe=function(e,n,r){return{children:Ne(n,e[1],r)}};function _e(){return{}}function Fe(){return null}function We(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Ge(e,n,r){for(var t=e,i=n.split(".");i.length&&void 0!==(t=t[i[0]]);)i.shift();return t||r}function Ze(e,n){var r=Ge(n,e);return r?"function"==typeof r||"object"==typeof r&&"render"in r?r:Ge(n,e+".component",e):e}function qe(r,t){var i;void 0===r&&(r=""),void 0===t&&(t={}),t.overrides=t.overrides||{},t.slugify=t.slugify||Ae,t.namedCodesToUnicode=t.namedCodesToUnicode?n({},o,t.namedCodesToUnicode):o;var s=t.createElement||e.createElement;function G(e,r){var i=Ge(t.overrides,e+".props",{});return s.apply(void 0,[Ze(e,t.overrides),n({},r,i,{className:We(null==r?void 0:r.className,i.className)||void 0})].concat([].slice.call(arguments,2)))}function Z(n){n=n.replace(w,"");var r=!1;t.forceInline?r=!0:t.forceBlock||(r=!1===F.test(n));for(var i=ce(oe(r?n:n.trimEnd().replace(re,"")+"\n\n",{inline:r}));"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===t.wrapper)return i;var a,o=t.wrapper||(r?"span":"div");if(i.length>1||t.forceWrapper)a=i;else{if(1===i.length)return"string"==typeof(a=i[0])?G("span",{key:"outer"},a):a;a=null}return e.createElement(o,{key:"outer"},a)}function q(n){var r=n.match(l);return r?r.reduce(function(n,r,t){var i=r.indexOf("=");if(-1!==i){var o=function(e){return-1!==e.indexOf("-")&&null===e.match(R)&&(e=e.replace(B,function(e,n){return n.toUpperCase()})),e}(r.slice(0,i)).trim(),c=function(e){var n=e[0];return('"'===n||"'"===n)&&e.length>=2&&e[e.length-1]===n?e.slice(1,-1):e}(r.slice(i+1).trim()),l=a[o]||o,u=n[l]=function(e,n){return"style"===e?n.split(/;\s?/).reduce(function(e,n){var r=n.slice(0,n.indexOf(":"));return e[r.trim().replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=n.slice(r.length+1).trim(),e},{}):"href"===e||"src"===e?je(n):(n.match(M)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(o,c);"string"==typeof u&&($.test(u)||z.test(u))&&(n[l]=e.cloneElement(Z(u.trim()),{key:t}))}else"style"!==r&&(n[a[r]||r]=!0);return n},{}):null}var V=[],X={},ie=((i={})[0]={match:Me(f),order:1,parse:function(e,n,r){return{children:n(e[0].replace(d,""),r)}},render:function(e,n,r){return G("blockquote",{key:r.key},n(e.children,r))}},i[1]={match:Ie(p),order:1,parse:_e,render:function(e,n,r){return G("br",{key:r.key})}},i[2]={match:Me(h),order:1,parse:_e,render:function(e,n,r){return G("hr",{key:r.key})}},i[3]={match:Me(g),order:0,parse:function(e){return{lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}},render:function(e,r,t){return G("pre",{key:t.key},G("code",n({},e.attrs,{className:e.lang?"lang-"+e.lang:""}),e.text))}},i[4]={match:Me(m),order:0,parse:function(e){return{attrs:q(e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"}}},i[5]={match:ze(y),order:3,parse:function(e){return{text:e[2]}},render:function(e,n,r){return G("code",{key:r.key},e.text)}},i[6]={match:Me(x),order:0,parse:function(e){return V.push({footnote:e[2],identifier:e[1]}),{}},render:Fe},i[7]={match:Re(b),order:1,parse:function(e){return{target:"#"+t.slugify(e[1]),text:e[1]}},render:function(e,n,r){return G("a",{key:r.key,href:je(e.target)},G("sup",{key:r.key},e.text))}},i[8]={match:Re(S),order:1,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},render:function(e,n,r){return G("input",{checked:e.completed,key:r.key,readOnly:!0,type:"checkbox"})}},i[9]={match:Me(t.enforceAtxHeadings?A:C),order:1,parse:function(e,n,r){return{children:Ne(n,e[2],r),id:t.slugify(e[2]),level:e[1].length}},render:function(e,n,r){return G("h"+e.level,{id:e.id,key:r.key},n(e.children,r))}},i[10]={match:Me(O),order:0,parse:function(e,n,r){return{children:Ne(n,e[1],r),level:"="===e[2]?1:2,type:"9"}}},i[11]={match:Ie($),order:1,parse:function(e,n,r){var t,i=e[3].match(te),a=new RegExp("^"+i[1],"gm"),o=e[3].replace(a,""),l=(t=o,Ce.some(function(e){return e.test(t)})?De:Ne),u=e[1].toLowerCase(),s=-1!==c.indexOf(u),f={attrs:q(e[2]),noInnerParse:s,tag:(s?u:e[1]).trim()};return r.inAnchor=r.inAnchor||"a"===u,s?f.text=e[3]:f.children=l(n,o,r),r.inAnchor=!1,f},render:function(e,r,t){return G(e.tag,n({key:t.key},e.attrs),e.text||r(e.children,t))}},i[13]={match:Ie(z),order:1,parse:function(e){return{attrs:q(e[2]||""),tag:e[1].trim()}},render:function(e,r,t){return G(e.tag,n({},e.attrs,{key:t.key}))}},i[12]={match:Ie(L),order:1,parse:function(){return{}},render:Fe},i[14]={match:ze(we),order:1,parse:function(e){return{alt:e[1],target:Be(e[2]),title:e[3]}},render:function(e,n,r){return G("img",{key:r.key,alt:e.alt||void 0,title:e.title||void 0,src:je(e.target)})}},i[15]={match:Re(Ee),order:3,parse:function(e,n,r){return{children:He(n,e[1],r),target:Be(e[2]),title:e[3]}},render:function(e,n,r){return G("a",{key:r.key,href:je(e.target),title:e.title},n(e.children,r))}},i[16]={match:Re(j),order:0,parse:function(e){return{children:[{text:e[1],type:"27"}],target:e[1],type:"15"}}},i[17]={match:function(e,n){return n.inAnchor?null:Re(I)(e,n)},order:0,parse:function(e){return{children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"}}},i[18]={match:Re(U),order:0,parse:function(e){var n=e[1],r=e[1];return u.test(r)||(r="mailto:"+r),{children:[{text:n.replace("mailto:",""),type:"27"}],target:r,type:"15"}}},i[20]=be(G,1),i[33]=be(G,2),i[19]={match:Me(v),order:3,parse:_e,render:function(){return"\n"}},i[21]={match:Ue,order:3,parse:Pe,render:function(e,n,r){return G("p",{key:r.key},n(e.children,r))}},i[22]={match:Re(H),order:0,parse:function(e){return X[e[1]]={target:e[2],title:e[4]},{}},render:Fe},i[23]={match:ze(D),order:0,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},render:function(e,n,r){return X[e.ref]?G("img",{key:r.key,alt:e.alt,src:je(X[e.ref].target),title:X[e.ref].title}):null}},i[24]={match:Re(P),order:0,parse:function(e,n,r){return{children:n(e[1],r),fallbackChildren:n(e[0].replace(_,"\\$1"),r),ref:e[2]}},render:function(e,n,r){return X[e.ref]?G("a",{key:r.key,href:je(X[e.ref].target),title:X[e.ref].title},n(e.children,r)):G("span",{key:r.key},n(e.fallbackChildren,r))}},i[25]={match:Me(N),order:1,parse:Te,render:function(e,n,r){var t=e;return G("table",{key:r.key},G("thead",null,G("tr",null,t.header.map(function(e,i){return G("th",{key:i,style:Le(t,i)},n(e,r))}))),G("tbody",null,t.cells.map(function(e,i){return G("tr",{key:i},e.map(function(e,i){return G("td",{key:i,style:Le(t,i)},n(e,r))}))})))}},i[27]={match:Ie(ne),order:4,parse:function(e){return{text:e[0].replace(T,function(e,n){return t.namedCodesToUnicode[n]?t.namedCodesToUnicode[n]:e})}},render:function(e){return e.text}},i[28]={match:ze(Q),order:2,parse:function(e,n,r){return{children:n(e[2],r)}},render:function(e,n,r){return G("strong",{key:r.key},n(e.children,r))}},i[29]={match:ze(J),order:3,parse:function(e,n,r){return{children:n(e[2],r)}},render:function(e,n,r){return G("em",{key:r.key},n(e.children,r))}},i[30]={match:ze(ee),order:1,parse:function(e){return{text:e[1],type:"27"}}},i[31]={match:ze(K),order:3,parse:Pe,render:function(e,n,r){return G("mark",{key:r.key},n(e.children,r))}},i[32]={match:ze(Y),order:3,parse:Pe,render:function(e,n,r){return G("del",{key:r.key},n(e.children,r))}},i);!0===t.disableParsingRawHTML&&(delete ie[11],delete ie[13]);var ae,oe=function(e){var n=Object.keys(e);function r(t,i){for(var a=[],o="";t;)for(var c=0;c<n.length;){var l=n[c],u=e[l],s=u.match(t,i,o);if(s){var f=s[0];t=t.substring(f.length);var d=u.parse(s,r,i);null==d.type&&(d.type=l),a.push(d),o=f;break}c++}return a}return n.sort(function(n,r){var t=e[n].order,i=e[r].order;return t!==i?t-i:n<r?-1:1}),function(e,n){return r(function(e){return e.replace(k,"\n").replace(E,"").replace(W," ")}(e),n)}}(ie),ce=(ae=function(e,n){return function(r,t,i){var a=e[r.type].render;return n?n(function(){return a(r,t,i)},r,t,i):a(r,t,i)}}(ie,t.renderRule),function e(n,r){if(void 0===r&&(r={}),Array.isArray(n)){for(var t=r.key,i=[],a=!1,o=0;o<n.length;o++){r.key=o;var c=e(n[o],r),l="string"==typeof c;l&&a?i[i.length-1]+=c:null!==c&&i.push(c),a=l}return r.key=t,i}return ae(n,e,r)}),le=Z(r);return V.length?G("div",null,le,G("footer",{key:"footer"},V.map(function(e){return G("div",{id:t.slugify(e.identifier),key:e.identifier},e.identifier,ce(oe(e.footnote,{inline:!0})))}))):le}export default function(n){var r=n.children,t=void 0===r?"":r,a=n.options,o=function(e,n){if(null==e)return{};var r,t,i={},a=Object.keys(e);for(t=0;t<a.length;t++)n.indexOf(r=a[t])>=0||(i[r]=e[r]);return i}(n,i);return e.cloneElement(qe(t,a),o)}export{r as RuleType,qe as compiler,Ae as slugify}; | ||
import*as e from"react";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},r.apply(this,arguments)}var n,t=["children","options"],i={blockQuote:"0",breakLine:"1",breakThematic:"2",codeBlock:"3",codeFenced:"4",codeInline:"5",footnote:"6",footnoteReference:"7",gfmTask:"8",heading:"9",headingSetext:"10",htmlBlock:"11",htmlComment:"12",htmlSelfClosing:"13",image:"14",link:"15",linkAngleBraceStyleDetector:"16",linkBareUrlDetector:"17",linkMailtoDetector:"18",newlineCoalescer:"19",orderedList:"20",paragraph:"21",ref:"22",refImage:"23",refLink:"24",table:"25",tableSeparator:"26",text:"27",textBolded:"28",textEmphasized:"29",textEscaped:"30",textMarked:"31",textStrikethroughed:"32",unorderedList:"33"};!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"}(n||(n={}));var a=["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(e,r){return e[r.toLowerCase()]=r,e},{for:"htmlFor"}),o={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},l=["style","script"],c=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,u=/mailto:/i,s=/\n{2,}$/,d=/^(\s*>[\s\S]*?)(?=\n{2,})/,f=/^ *> ?/gm,p=/^ {2,}\n/,h=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,m=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,g=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,y=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,k=/^(?:\n *)*\n/,v=/\r\n?/g,x=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,b=/^\[\^([^\]]+)]/,S=/\f/g,E=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,w=/^\s*?\[(x|\s)\]/,C=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,z=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,L=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,A=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,T=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,O=/^<!--[\s\S]*?(?:-->)/,$=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,B=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,M=/^\{.*\}$/,R=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,I=/^<([^ >]+@[^ >]+)>/,U=/^<([^ >]+:\/[^ >]+)>/,D=/-([a-z])?/gi,j=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,N=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,H=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,F=/^\[([^\]]*)\] ?\[([^\]]*)\]/,P=/(\[|\])/g,_=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,W=/\t/g,G=/(^ *\||\| *$)/g,Z=/^ *:-+: *$/,q=/^ *:-+ *$/,Q=/^ *-+: *$/,V="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",X=new RegExp("^([*_])\\1"+V+"\\1\\1(?!\\1)"),J=new RegExp("^([*_])"+V+"\\1(?!\\1|\\w)"),K=new RegExp("^=="+V+"=="),Y=new RegExp("^~~"+V+"~~"),ee=/^\\([^0-9A-Za-z\s])/,re=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ne=/^\n+/,te=/^([ \t]*)/,ie=/\\([^\\])/g,ae=/ *\n+$/,oe=/(?:^|\n)( *)$/,le="(?:\\d+\\.)",ce="(?:[*+-])";function ue(e){return"( *)("+(1===e?le:ce)+") +"}var se=ue(1),de=ue(2);function fe(e){return new RegExp("^"+(1===e?se:de))}var pe=fe(1),he=fe(2);function me(e){return new RegExp("^"+(1===e?se:de)+"[^\\n]*(?:\\n(?!\\1"+(1===e?le:ce)+" )[^\\n]*)*(\\n|$)","gm")}var ge=me(1),ye=me(2);function ke(e){var r=1===e?le:ce;return new RegExp("^( *)("+r+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+r+" (?!"+r+" ))\\n*|\\s*\\n*$)")}var ve=ke(1),xe=ke(2);function be(e,r){var n=1===r,t=n?ve:xe,a=n?ge:ye,o=n?pe:he;return{match:function(e,r,n){var i=oe.exec(n);return i&&(r.list||!r.inline&&!r.simple)?t.exec(e=i[1]+e):null},order:1,parse:function(e,r,t){var i=n?+e[2]:void 0,l=e[0].replace(s,"\n").match(a),c=!1;return{items:l.map(function(e,n){var i=o.exec(e)[0].length,a=new RegExp("^ {1,"+i+"}","gm"),u=e.replace(a,"").replace(o,""),s=n===l.length-1,d=-1!==u.indexOf("\n\n")||s&&c;c=d;var f,p=t.inline,h=t.list;t.list=!0,d?(t.inline=!1,f=u.replace(ae,"\n\n")):(t.inline=!0,f=u.replace(ae,""));var m=r(f,t);return t.inline=p,t.list=h,m}),ordered:n,start:i}},render:function(r,n,t){return e(r.ordered?"ol":"ul",{key:t.key,start:r.type===i.orderedList?r.start:void 0},r.items.map(function(r,i){return e("li",{key:i},n(r,t))}))}}}var Se=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ee=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,we=[d,m,g,C,L,z,O,j,ge,ve,ye,xe],Ce=[].concat(we,[/^[^\n]+(?: \n|\n{2,})/,A,B]);function ze(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 Le(e){return Q.test(e)?"right":Z.test(e)?"center":q.test(e)?"left":null}function Ae(e,r,n,t){var a=n.inTable;n.inTable=!0;var o=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(function(e,a){return"|"===a.trim()?e.push(t?{type:i.tableSeparator}:{type:i.text,text:a}):""!==a&&e.push.apply(e,r(a,n)),e},[]);n.inTable=a;var l=[[]];return o.forEach(function(e,r){e.type===i.tableSeparator?0!==r&&r!==o.length-1&&l.push([]):(e.type!==i.text||null!=o[r+1]&&o[r+1].type!==i.tableSeparator||(e.text=e.text.trimEnd()),l[l.length-1].push(e))}),l}function Te(e,r,n){n.inline=!0;var t=e[2]?e[2].replace(G,"").split("|").map(Le):[],a=e[3]?function(e,r,n){return e.trim().split("\n").map(function(e){return Ae(e,r,n,!0)})}(e[3],r,n):[],o=Ae(e[1],r,n,!!a.length);return n.inline=!1,a.length?{align:t,cells:a,header:o,type:i.table}:{children:o,type:i.paragraph}}function Oe(e,r){return null==e.align[r]?{}:{textAlign:e.align[r]}}function $e(e){return function(r,n){return n.inline?e.exec(r):null}}function Be(e){return function(r,n){return n.inline||n.simple?e.exec(r):null}}function Me(e){return function(r,n){return n.inline||n.simple?null:e.exec(r)}}function Re(e){return function(r){return e.exec(r)}}function Ie(e,r,n){if(r.inline||r.simple)return null;if(n&&!n.endsWith("\n"))return null;var t="";e.split("\n").every(function(e){return!we.some(function(r){return r.test(e)})&&(t+=e+"\n",e.trim())});var i=t.trimEnd();return""==i?null:[t,i]}function Ue(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch(e){return null}return e}function De(e){return e.replace(ie,"$1")}function je(e,r,n){var t=n.inline||!1,i=n.simple||!1;n.inline=!0,n.simple=!0;var a=e(r,n);return n.inline=t,n.simple=i,a}function Ne(e,r,n){var t=n.inline||!1,i=n.simple||!1;n.inline=!1,n.simple=!0;var a=e(r,n);return n.inline=t,n.simple=i,a}function He(e,r,n){var t=n.inline||!1;n.inline=!1;var i=e(r,n);return n.inline=t,i}var Fe=function(e,r,n){return{children:je(r,e[1],n)}};function Pe(){return{}}function _e(){return null}function We(){return[].slice.call(arguments).filter(Boolean).join(" ")}function Ge(e,r,n){for(var t=e,i=r.split(".");i.length&&void 0!==(t=t[i[0]]);)i.shift();return t||n}function Ze(e,r){var n=Ge(r,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:Ge(r,e+".component",e):e}function qe(n,t){var s;function G(e,n){var i,a=Ge(t.overrides,e+".props",{});return(i=t).createElement.apply(i,[Ze(e,t.overrides),r({},n,a,{className:We(null==n?void 0:n.className,a.className)||void 0})].concat([].slice.call(arguments,2)))}function Z(r){r=r.replace(E,"");var n=!1;t.forceInline?n=!0:t.forceBlock||(n=!1===_.test(r));for(var i=le(oe(n?r:r.trimEnd().replace(ne,"")+"\n\n",{inline:n}));"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===t.wrapper)return i;var a,o=t.wrapper||(n?"span":"div");if(i.length>1||t.forceWrapper)a=i;else{if(1===i.length)return"string"==typeof(a=i[0])?G("span",{key:"outer"},a):a;a=null}return e.createElement(o,{key:"outer"},a)}function q(r,n){var i=n.match(c);return i?i.reduce(function(n,i,o){var l=i.indexOf("=");if(-1!==l){var c=function(e){return-1!==e.indexOf("-")&&null===e.match($)&&(e=e.replace(D,function(e,r){return r.toUpperCase()})),e}(i.slice(0,l)).trim(),u=function(e){var r=e[0];return('"'===r||"'"===r)&&e.length>=2&&e[e.length-1]===r?e.slice(1,-1):e}(i.slice(l+1).trim()),s=a[c]||c,d=n[s]=function(e,r,n,t){return"style"===r?n.split(/;\s?/).reduce(function(e,r){var n=r.slice(0,r.indexOf(":"));return e[n.trim().replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=r.slice(n.length+1).trim(),e},{}):"href"===r||"src"===r?t(n,e,r):(n.match(M)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(r,c,u,t.sanitizer);"string"==typeof d&&(A.test(d)||B.test(d))&&(n[s]=e.cloneElement(Z(d.trim()),{key:o}))}else"style"!==i&&(n[a[i]||i]=!0);return n},{}):null}void 0===n&&(n=""),void 0===t&&(t={}),t.overrides=t.overrides||{},t.sanitizer=t.sanitizer||Ue,t.slugify=t.slugify||ze,t.namedCodesToUnicode=t.namedCodesToUnicode?r({},o,t.namedCodesToUnicode):o,t.createElement=t.createElement||e.createElement;var Q=[],V={},ie=((s={})[i.blockQuote]={match:Me(d),order:1,parse:function(e,r,n){return{children:r(e[0].replace(f,""),n)}},render:function(e,r,n){return G("blockquote",{key:n.key},r(e.children,n))}},s[i.breakLine]={match:Re(p),order:1,parse:Pe,render:function(e,r,n){return G("br",{key:n.key})}},s[i.breakThematic]={match:Me(h),order:1,parse:Pe,render:function(e,r,n){return G("hr",{key:n.key})}},s[i.codeBlock]={match:Me(g),order:0,parse:function(e){return{lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}},render:function(e,n,t){return G("pre",{key:t.key},G("code",r({},e.attrs,{className:e.lang?"lang-"+e.lang:""}),e.text))}},s[i.codeFenced]={match:Me(m),order:0,parse:function(e){return{attrs:q("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:i.codeBlock}}},s[i.codeInline]={match:Be(y),order:3,parse:function(e){return{text:e[2]}},render:function(e,r,n){return G("code",{key:n.key},e.text)}},s[i.footnote]={match:Me(x),order:0,parse:function(e){return Q.push({footnote:e[2],identifier:e[1]}),{}},render:_e},s[i.footnoteReference]={match:$e(b),order:1,parse:function(e){return{target:"#"+t.slugify(e[1],ze),text:e[1]}},render:function(e,r,n){return G("a",{key:n.key,href:t.sanitizer(e.target,"a","href")},G("sup",{key:n.key},e.text))}},s[i.gfmTask]={match:$e(w),order:1,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},render:function(e,r,n){return G("input",{checked:e.completed,key:n.key,readOnly:!0,type:"checkbox"})}},s[i.heading]={match:Me(t.enforceAtxHeadings?z:C),order:1,parse:function(e,r,n){return{children:je(r,e[2],n),id:t.slugify(e[2],ze),level:e[1].length}},render:function(e,r,n){return G("h"+e.level,{id:e.id,key:n.key},r(e.children,n))}},s[i.headingSetext]={match:Me(L),order:0,parse:function(e,r,n){return{children:je(r,e[1],n),level:"="===e[2]?1:2,type:i.heading}}},s[i.htmlBlock]={match:Re(A),order:1,parse:function(e,r,n){var t,i=e[3].match(te),a=new RegExp("^"+i[1],"gm"),o=e[3].replace(a,""),c=(t=o,Ce.some(function(e){return e.test(t)})?He:je),u=e[1].toLowerCase(),s=-1!==l.indexOf(u),d=(s?u:e[1]).trim(),f={attrs:q(d,e[2]),noInnerParse:s,tag:d};return n.inAnchor=n.inAnchor||"a"===u,s?f.text=e[3]:f.children=c(r,o,n),n.inAnchor=!1,f},render:function(e,n,t){return G(e.tag,r({key:t.key},e.attrs),e.text||n(e.children,t))}},s[i.htmlSelfClosing]={match:Re(B),order:1,parse:function(e){var r=e[1].trim();return{attrs:q(r,e[2]||""),tag:r}},render:function(e,n,t){return G(e.tag,r({},e.attrs,{key:t.key}))}},s[i.htmlComment]={match:Re(O),order:1,parse:function(){return{}},render:_e},s[i.image]={match:Be(Ee),order:1,parse:function(e){return{alt:e[1],target:De(e[2]),title:e[3]}},render:function(e,r,n){return G("img",{key:n.key,alt:e.alt||void 0,title:e.title||void 0,src:t.sanitizer(e.target,"img","src")})}},s[i.link]={match:$e(Se),order:3,parse:function(e,r,n){return{children:Ne(r,e[1],n),target:De(e[2]),title:e[3]}},render:function(e,r,n){return G("a",{key:n.key,href:t.sanitizer(e.target,"a","href"),title:e.title},r(e.children,n))}},s[i.linkAngleBraceStyleDetector]={match:$e(U),order:0,parse:function(e){return{children:[{text:e[1],type:i.text}],target:e[1],type:i.link}}},s[i.linkBareUrlDetector]={match:function(e,r){return r.inAnchor?null:$e(R)(e,r)},order:0,parse:function(e){return{children:[{text:e[1],type:i.text}],target:e[1],title:void 0,type:i.link}}},s[i.linkMailtoDetector]={match:$e(I),order:0,parse:function(e){var r=e[1],n=e[1];return u.test(n)||(n="mailto:"+n),{children:[{text:r.replace("mailto:",""),type:i.text}],target:n,type:i.link}}},s[i.orderedList]=be(G,1),s[i.unorderedList]=be(G,2),s[i.newlineCoalescer]={match:Me(k),order:3,parse:Pe,render:function(){return"\n"}},s[i.paragraph]={match:Ie,order:3,parse:Fe,render:function(e,r,n){return G("p",{key:n.key},r(e.children,n))}},s[i.ref]={match:$e(N),order:0,parse:function(e){return V[e[1]]={target:e[2],title:e[4]},{}},render:_e},s[i.refImage]={match:Be(H),order:0,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},render:function(e,r,n){return V[e.ref]?G("img",{key:n.key,alt:e.alt,src:t.sanitizer(V[e.ref].target,"img","src"),title:V[e.ref].title}):null}},s[i.refLink]={match:$e(F),order:0,parse:function(e,r,n){return{children:r(e[1],n),fallbackChildren:r(e[0].replace(P,"\\$1"),n),ref:e[2]}},render:function(e,r,n){return V[e.ref]?G("a",{key:n.key,href:t.sanitizer(V[e.ref].target,"a","href"),title:V[e.ref].title},r(e.children,n)):G("span",{key:n.key},r(e.fallbackChildren,n))}},s[i.table]={match:Me(j),order:1,parse:Te,render:function(e,r,n){var t=e;return G("table",{key:n.key},G("thead",null,G("tr",null,t.header.map(function(e,i){return G("th",{key:i,style:Oe(t,i)},r(e,n))}))),G("tbody",null,t.cells.map(function(e,i){return G("tr",{key:i},e.map(function(e,i){return G("td",{key:i,style:Oe(t,i)},r(e,n))}))})))}},s[i.text]={match:Re(re),order:4,parse:function(e){return{text:e[0].replace(T,function(e,r){return t.namedCodesToUnicode[r]?t.namedCodesToUnicode[r]:e})}},render:function(e){return e.text}},s[i.textBolded]={match:Be(X),order:2,parse:function(e,r,n){return{children:r(e[2],n)}},render:function(e,r,n){return G("strong",{key:n.key},r(e.children,n))}},s[i.textEmphasized]={match:Be(J),order:3,parse:function(e,r,n){return{children:r(e[2],n)}},render:function(e,r,n){return G("em",{key:n.key},r(e.children,n))}},s[i.textEscaped]={match:Be(ee),order:1,parse:function(e){return{text:e[1],type:i.text}}},s[i.textMarked]={match:Be(K),order:3,parse:Fe,render:function(e,r,n){return G("mark",{key:n.key},r(e.children,n))}},s[i.textStrikethroughed]={match:Be(Y),order:3,parse:Fe,render:function(e,r,n){return G("del",{key:n.key},r(e.children,n))}},s);!0===t.disableParsingRawHTML&&(delete ie[i.htmlBlock],delete ie[i.htmlSelfClosing]);var ae,oe=function(e){var r=Object.keys(e);function n(t,i){for(var a=[],o="";t;)for(var l=0;l<r.length;){var c=r[l],u=e[c],s=u.match(t,i,o);if(s){var d=s[0];t=t.substring(d.length);var f=u.parse(s,n,i);null==f.type&&(f.type=c),a.push(f),o=d;break}l++}return a}return r.sort(function(r,n){var t=e[r].order,i=e[n].order;return t!==i?t-i:r<n?-1:1}),function(e,r){return n(function(e){return e.replace(v,"\n").replace(S,"").replace(W," ")}(e),r)}}(ie),le=(ae=function(e,r){return function(n,t,i){var a=e[n.type].render;return r?r(function(){return a(n,t,i)},n,t,i):a(n,t,i)}}(ie,t.renderRule),function e(r,n){if(void 0===n&&(n={}),Array.isArray(r)){for(var t=n.key,i=[],a=!1,o=0;o<r.length;o++){n.key=o;var l=e(r[o],n),c="string"==typeof l;c&&a?i[i.length-1]+=l:null!==l&&i.push(l),a=c}return n.key=t,i}return ae(r,e,n)}),ce=Z(n);return Q.length?G("div",null,ce,G("footer",{key:"footer"},Q.map(function(e){return G("div",{id:t.slugify(e.identifier,ze),key:e.identifier},e.identifier,le(oe(e.footnote,{inline:!0})))}))):ce}export default function(r){var n=r.children,i=void 0===n?"":n,a=r.options,o=function(e,r){if(null==e)return{};var n,t,i={},a=Object.keys(e);for(t=0;t<a.length;t++)r.indexOf(n=a[t])>=0||(i[n]=e[n]);return i}(r,t);return e.cloneElement(qe(i,a),o)}export{i as RuleType,qe as compiler,Ue as sanitizer,ze as slugify}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e||self).MarkdownToJSX=n(e.React)}(this,function(e){function n(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,n}var r=/*#__PURE__*/n(e);function t(){return t=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},t.apply(this,arguments)}var i,a,o=["children","options"];!function(e){e.blockQuote="0",e.breakLine="1",e.breakThematic="2",e.codeBlock="3",e.codeFenced="4",e.codeInline="5",e.footnote="6",e.footnoteReference="7",e.gfmTask="8",e.heading="9",e.headingSetext="10",e.htmlBlock="11",e.htmlComment="12",e.htmlSelfClosing="13",e.image="14",e.link="15",e.linkAngleBraceStyleDetector="16",e.linkBareUrlDetector="17",e.linkMailtoDetector="18",e.newlineCoalescer="19",e.orderedList="20",e.paragraph="21",e.ref="22",e.refImage="23",e.refLink="24",e.table="25",e.tableSeparator="26",e.text="27",e.textBolded="28",e.textEmphasized="29",e.textEscaped="30",e.textMarked="31",e.textStrikethroughed="32",e.unorderedList="33"}(i||(i={})),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"}(a||(a={}));var c=["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(e,n){return e[n.toLowerCase()]=n,e},{for:"htmlFor"}),l={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},u=["style","script"],s=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,f=/mailto:/i,d=/\n{2,}$/,p=/^(\s*>[\s\S]*?)(?=\n{2,})/,h=/^ *> ?/gm,m=/^ {2,}\n/,g=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,y=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,v=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,k=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,x=/^(?:\n *)*\n/,b=/\r\n?/g,w=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,E=/^\[\^([^\]]+)]/,O=/\f/g,S=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,C=/^\s*?\[(x|\s)\]/,T=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,A=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,$=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,L=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,M=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,R=/^<!--[\s\S]*?(?:-->)/,j=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,z=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,I=/^\{.*\}$/,U=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,B=/^<([^ >]+@[^ >]+)>/,N=/^<([^ >]+:\/[^ >]+)>/,P=/-([a-z])?/gi,_=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,D=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,H=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,F=/^\[([^\]]*)\] ?\[([^\]]*)\]/,W=/(\[|\])/g,G=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Z=/\t/g,q=/(^ *\||\| *$)/g,X=/^ *:-+: *$/,V=/^ *:-+ *$/,J=/^ *-+: *$/,Q="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",K=new RegExp("^([*_])\\1"+Q+"\\1\\1(?!\\1)"),Y=new RegExp("^([*_])"+Q+"\\1(?!\\1|\\w)"),ee=new RegExp("^=="+Q+"=="),ne=new RegExp("^~~"+Q+"~~"),re=/^\\([^0-9A-Za-z\s])/,te=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ie=/^\n+/,ae=/^([ \t]*)/,oe=/\\([^\\])/g,ce=/ *\n+$/,le=/(?:^|\n)( *)$/,ue="(?:\\d+\\.)",se="(?:[*+-])";function fe(e){return"( *)("+(1===e?ue:se)+") +"}var de=fe(1),pe=fe(2);function he(e){return new RegExp("^"+(1===e?de:pe))}var me=he(1),ge=he(2);function ye(e){return new RegExp("^"+(1===e?de:pe)+"[^\\n]*(?:\\n(?!\\1"+(1===e?ue:se)+" )[^\\n]*)*(\\n|$)","gm")}var ve=ye(1),ke=ye(2);function xe(e){var n=1===e?ue:se;return new RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}var be=xe(1),we=xe(2);function Ee(e,n){var r=1===n,t=r?be:we,i=r?ve:ke,a=r?me:ge;return{match:function(e,n,r){var i=le.exec(r);return i&&(n.list||!n.inline&&!n.simple)?t.exec(e=i[1]+e):null},order:1,parse:function(e,n,t){var o=r?+e[2]:void 0,c=e[0].replace(d,"\n").match(i),l=!1;return{items:c.map(function(e,r){var i=a.exec(e)[0].length,o=new RegExp("^ {1,"+i+"}","gm"),u=e.replace(o,"").replace(a,""),s=r===c.length-1,f=-1!==u.indexOf("\n\n")||s&&l;l=f;var d,p=t.inline,h=t.list;t.list=!0,f?(t.inline=!1,d=u.replace(ce,"\n\n")):(t.inline=!0,d=u.replace(ce,""));var m=n(d,t);return t.inline=p,t.list=h,m}),ordered:r,start:o}},render:function(n,r,t){return e(n.ordered?"ol":"ul",{key:t.key,start:"20"===n.type?n.start:void 0},n.items.map(function(n,i){return e("li",{key:i},r(n,t))}))}}}var Oe=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Se=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Ce=[p,y,v,T,$,A,R,_,ve,be,ke,we],Te=[].concat(Ce,[/^[^\n]+(?: \n|\n{2,})/,L,z]);function Ae(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 $e(e){return J.test(e)?"right":X.test(e)?"center":V.test(e)?"left":null}function Le(e,n,r,t){var i=r.inTable;r.inTable=!0;var a=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(function(e,i){return"|"===i.trim()?e.push(t?{type:"26"}:{type:"27",text:i}):""!==i&&e.push.apply(e,n(i,r)),e},[]);r.inTable=i;var o=[[]];return a.forEach(function(e,n){"26"===e.type?0!==n&&n!==a.length-1&&o.push([]):("27"!==e.type||null!=a[n+1]&&"26"!==a[n+1].type||(e.text=e.text.trimEnd()),o[o.length-1].push(e))}),o}function Me(e,n,r){r.inline=!0;var t=e[2]?e[2].replace(q,"").split("|").map($e):[],i=e[3]?function(e,n,r){return e.trim().split("\n").map(function(e){return Le(e,n,r,!0)})}(e[3],n,r):[],a=Le(e[1],n,r,!!i.length);return r.inline=!1,i.length?{align:t,cells:i,header:a,type:"25"}:{children:a,type:"21"}}function Re(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function je(e){return function(n,r){return r.inline?e.exec(n):null}}function ze(e){return function(n,r){return r.inline||r.simple?e.exec(n):null}}function Ie(e){return function(n,r){return r.inline||r.simple?null:e.exec(n)}}function Ue(e){return function(n){return e.exec(n)}}function Be(e,n,r){if(n.inline||n.simple)return null;if(r&&!r.endsWith("\n"))return null;var t="";e.split("\n").every(function(e){return!Ce.some(function(n){return n.test(e)})&&(t+=e+"\n",e.trim())});var i=t.trimEnd();return""==i?null:[t,i]}function Ne(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return}catch(e){return null}return e}function Pe(e){return e.replace(oe,"$1")}function _e(e,n,r){var t=r.inline||!1,i=r.simple||!1;r.inline=!0,r.simple=!0;var a=e(n,r);return r.inline=t,r.simple=i,a}function De(e,n,r){var t=r.inline||!1,i=r.simple||!1;r.inline=!1,r.simple=!0;var a=e(n,r);return r.inline=t,r.simple=i,a}function He(e,n,r){var t=r.inline||!1;r.inline=!1;var i=e(n,r);return r.inline=t,i}var Fe=function(e,n,r){return{children:_e(n,e[1],r)}};function We(){return{}}function Ge(){return null}function Ze(){return[].slice.call(arguments).filter(Boolean).join(" ")}function qe(e,n,r){for(var t=e,i=n.split(".");i.length&&void 0!==(t=t[i[0]]);)i.shift();return t||r}function Xe(e,n){var r=qe(n,e);return r?"function"==typeof r||"object"==typeof r&&"render"in r?r:qe(n,e+".component",e):e}function Ve(e,n){var i;void 0===e&&(e=""),void 0===n&&(n={}),n.overrides=n.overrides||{},n.slugify=n.slugify||Ae,n.namedCodesToUnicode=n.namedCodesToUnicode?t({},l,n.namedCodesToUnicode):l;var a=n.createElement||r.createElement;function o(e,r){var i=qe(n.overrides,e+".props",{});return a.apply(void 0,[Xe(e,n.overrides),t({},r,i,{className:Ze(null==r?void 0:r.className,i.className)||void 0})].concat([].slice.call(arguments,2)))}function d(e){e=e.replace(S,"");var t=!1;n.forceInline?t=!0:n.forceBlock||(t=!1===G.test(e));for(var i=ce(oe(t?e:e.trimEnd().replace(ie,"")+"\n\n",{inline:t}));"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===n.wrapper)return i;var a,c=n.wrapper||(t?"span":"div");if(i.length>1||n.forceWrapper)a=i;else{if(1===i.length)return"string"==typeof(a=i[0])?o("span",{key:"outer"},a):a;a=null}return r.createElement(c,{key:"outer"},a)}function q(e){var n=e.match(s);return n?n.reduce(function(e,n,t){var i=n.indexOf("=");if(-1!==i){var a=function(e){return-1!==e.indexOf("-")&&null===e.match(j)&&(e=e.replace(P,function(e,n){return n.toUpperCase()})),e}(n.slice(0,i)).trim(),o=function(e){var n=e[0];return('"'===n||"'"===n)&&e.length>=2&&e[e.length-1]===n?e.slice(1,-1):e}(n.slice(i+1).trim()),l=c[a]||a,u=e[l]=function(e,n){return"style"===e?n.split(/;\s?/).reduce(function(e,n){var r=n.slice(0,n.indexOf(":"));return e[r.trim().replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=n.slice(r.length+1).trim(),e},{}):"href"===e||"src"===e?Ne(n):(n.match(I)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(a,o);"string"==typeof u&&(L.test(u)||z.test(u))&&(e[l]=r.cloneElement(d(u.trim()),{key:t}))}else"style"!==n&&(e[c[n]||n]=!0);return e},{}):null}var X=[],V={},J=((i={})[0]={match:Ie(p),order:1,parse:function(e,n,r){return{children:n(e[0].replace(h,""),r)}},render:function(e,n,r){return o("blockquote",{key:r.key},n(e.children,r))}},i[1]={match:Ue(m),order:1,parse:We,render:function(e,n,r){return o("br",{key:r.key})}},i[2]={match:Ie(g),order:1,parse:We,render:function(e,n,r){return o("hr",{key:r.key})}},i[3]={match:Ie(v),order:0,parse:function(e){return{lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}},render:function(e,n,r){return o("pre",{key:r.key},o("code",t({},e.attrs,{className:e.lang?"lang-"+e.lang:""}),e.text))}},i[4]={match:Ie(y),order:0,parse:function(e){return{attrs:q(e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"}}},i[5]={match:ze(k),order:3,parse:function(e){return{text:e[2]}},render:function(e,n,r){return o("code",{key:r.key},e.text)}},i[6]={match:Ie(w),order:0,parse:function(e){return X.push({footnote:e[2],identifier:e[1]}),{}},render:Ge},i[7]={match:je(E),order:1,parse:function(e){return{target:"#"+n.slugify(e[1]),text:e[1]}},render:function(e,n,r){return o("a",{key:r.key,href:Ne(e.target)},o("sup",{key:r.key},e.text))}},i[8]={match:je(C),order:1,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},render:function(e,n,r){return o("input",{checked:e.completed,key:r.key,readOnly:!0,type:"checkbox"})}},i[9]={match:Ie(n.enforceAtxHeadings?A:T),order:1,parse:function(e,r,t){return{children:_e(r,e[2],t),id:n.slugify(e[2]),level:e[1].length}},render:function(e,n,r){return o("h"+e.level,{id:e.id,key:r.key},n(e.children,r))}},i[10]={match:Ie($),order:0,parse:function(e,n,r){return{children:_e(n,e[1],r),level:"="===e[2]?1:2,type:"9"}}},i[11]={match:Ue(L),order:1,parse:function(e,n,r){var t,i=e[3].match(ae),a=new RegExp("^"+i[1],"gm"),o=e[3].replace(a,""),c=(t=o,Te.some(function(e){return e.test(t)})?He:_e),l=e[1].toLowerCase(),s=-1!==u.indexOf(l),f={attrs:q(e[2]),noInnerParse:s,tag:(s?l:e[1]).trim()};return r.inAnchor=r.inAnchor||"a"===l,s?f.text=e[3]:f.children=c(n,o,r),r.inAnchor=!1,f},render:function(e,n,r){return o(e.tag,t({key:r.key},e.attrs),e.text||n(e.children,r))}},i[13]={match:Ue(z),order:1,parse:function(e){return{attrs:q(e[2]||""),tag:e[1].trim()}},render:function(e,n,r){return o(e.tag,t({},e.attrs,{key:r.key}))}},i[12]={match:Ue(R),order:1,parse:function(){return{}},render:Ge},i[14]={match:ze(Se),order:1,parse:function(e){return{alt:e[1],target:Pe(e[2]),title:e[3]}},render:function(e,n,r){return o("img",{key:r.key,alt:e.alt||void 0,title:e.title||void 0,src:Ne(e.target)})}},i[15]={match:je(Oe),order:3,parse:function(e,n,r){return{children:De(n,e[1],r),target:Pe(e[2]),title:e[3]}},render:function(e,n,r){return o("a",{key:r.key,href:Ne(e.target),title:e.title},n(e.children,r))}},i[16]={match:je(N),order:0,parse:function(e){return{children:[{text:e[1],type:"27"}],target:e[1],type:"15"}}},i[17]={match:function(e,n){return n.inAnchor?null:je(U)(e,n)},order:0,parse:function(e){return{children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"}}},i[18]={match:je(B),order:0,parse:function(e){var n=e[1],r=e[1];return f.test(r)||(r="mailto:"+r),{children:[{text:n.replace("mailto:",""),type:"27"}],target:r,type:"15"}}},i[20]=Ee(o,1),i[33]=Ee(o,2),i[19]={match:Ie(x),order:3,parse:We,render:function(){return"\n"}},i[21]={match:Be,order:3,parse:Fe,render:function(e,n,r){return o("p",{key:r.key},n(e.children,r))}},i[22]={match:je(D),order:0,parse:function(e){return V[e[1]]={target:e[2],title:e[4]},{}},render:Ge},i[23]={match:ze(H),order:0,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},render:function(e,n,r){return V[e.ref]?o("img",{key:r.key,alt:e.alt,src:Ne(V[e.ref].target),title:V[e.ref].title}):null}},i[24]={match:je(F),order:0,parse:function(e,n,r){return{children:n(e[1],r),fallbackChildren:n(e[0].replace(W,"\\$1"),r),ref:e[2]}},render:function(e,n,r){return V[e.ref]?o("a",{key:r.key,href:Ne(V[e.ref].target),title:V[e.ref].title},n(e.children,r)):o("span",{key:r.key},n(e.fallbackChildren,r))}},i[25]={match:Ie(_),order:1,parse:Me,render:function(e,n,r){var t=e;return o("table",{key:r.key},o("thead",null,o("tr",null,t.header.map(function(e,i){return o("th",{key:i,style:Re(t,i)},n(e,r))}))),o("tbody",null,t.cells.map(function(e,i){return o("tr",{key:i},e.map(function(e,i){return o("td",{key:i,style:Re(t,i)},n(e,r))}))})))}},i[27]={match:Ue(te),order:4,parse:function(e){return{text:e[0].replace(M,function(e,r){return n.namedCodesToUnicode[r]?n.namedCodesToUnicode[r]:e})}},render:function(e){return e.text}},i[28]={match:ze(K),order:2,parse:function(e,n,r){return{children:n(e[2],r)}},render:function(e,n,r){return o("strong",{key:r.key},n(e.children,r))}},i[29]={match:ze(Y),order:3,parse:function(e,n,r){return{children:n(e[2],r)}},render:function(e,n,r){return o("em",{key:r.key},n(e.children,r))}},i[30]={match:ze(re),order:1,parse:function(e){return{text:e[1],type:"27"}}},i[31]={match:ze(ee),order:3,parse:Fe,render:function(e,n,r){return o("mark",{key:r.key},n(e.children,r))}},i[32]={match:ze(ne),order:3,parse:Fe,render:function(e,n,r){return o("del",{key:r.key},n(e.children,r))}},i);!0===n.disableParsingRawHTML&&(delete J[11],delete J[13]);var Q,oe=function(e){var n=Object.keys(e);function r(t,i){for(var a=[],o="";t;)for(var c=0;c<n.length;){var l=n[c],u=e[l],s=u.match(t,i,o);if(s){var f=s[0];t=t.substring(f.length);var d=u.parse(s,r,i);null==d.type&&(d.type=l),a.push(d),o=f;break}c++}return a}return n.sort(function(n,r){var t=e[n].order,i=e[r].order;return t!==i?t-i:n<r?-1:1}),function(e,n){return r(function(e){return e.replace(b,"\n").replace(O,"").replace(Z," ")}(e),n)}}(J),ce=(Q=function(e,n){return function(r,t,i){var a=e[r.type].render;return n?n(function(){return a(r,t,i)},r,t,i):a(r,t,i)}}(J,n.renderRule),function e(n,r){if(void 0===r&&(r={}),Array.isArray(n)){for(var t=r.key,i=[],a=!1,o=0;o<n.length;o++){r.key=o;var c=e(n[o],r),l="string"==typeof c;l&&a?i[i.length-1]+=c:null!==c&&i.push(c),a=l}return r.key=t,i}return Q(n,e,r)}),le=d(e);return X.length?o("div",null,le,o("footer",{key:"footer"},X.map(function(e){return o("div",{id:n.slugify(e.identifier),key:e.identifier},e.identifier,ce(oe(e.footnote,{inline:!0})))}))):le}var Je=function(e){var n=e.children,t=void 0===n?"":n,i=e.options,a=function(e,n){if(null==e)return{};var r,t,i={},a=Object.keys(e);for(t=0;t<a.length;t++)n.indexOf(r=a[t])>=0||(i[r]=e[r]);return i}(e,o);return r.cloneElement(Ve(t,i),a)};return Object.assign(Je,{compiler:Ve}),Je}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define(["react"],r):(e||self).MarkdownToJSX=r(e.React)}(this,function(e){function r(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}}),r.default=e,r}var n=/*#__PURE__*/r(e);function t(){return t=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},t.apply(this,arguments)}var i,a=["children","options"],o={blockQuote:"0",breakLine:"1",breakThematic:"2",codeBlock:"3",codeFenced:"4",codeInline:"5",footnote:"6",footnoteReference:"7",gfmTask:"8",heading:"9",headingSetext:"10",htmlBlock:"11",htmlComment:"12",htmlSelfClosing:"13",image:"14",link:"15",linkAngleBraceStyleDetector:"16",linkBareUrlDetector:"17",linkMailtoDetector:"18",newlineCoalescer:"19",orderedList:"20",paragraph:"21",ref:"22",refImage:"23",refLink:"24",table:"25",tableSeparator:"26",text:"27",textBolded:"28",textEmphasized:"29",textEscaped:"30",textMarked:"31",textStrikethroughed:"32",unorderedList:"33"};!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"}(i||(i={}));var l=["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(e,r){return e[r.toLowerCase()]=r,e},{for:"htmlFor"}),c={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},u=["style","script"],s=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,d=/mailto:/i,f=/\n{2,}$/,p=/^(\s*>[\s\S]*?)(?=\n{2,})/,h=/^ *> ?/gm,m=/^ {2,}\n/,g=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,y=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,k=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,v=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,x=/^(?:\n *)*\n/,b=/\r\n?/g,S=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,E=/^\[\^([^\]]+)]/,w=/\f/g,C=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,O=/^\s*?\[(x|\s)\]/,z=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,T=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,L=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,A=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,M=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,R=/^<!--[\s\S]*?(?:-->)/,$=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,B=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,j=/^\{.*\}$/,I=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,D=/^<([^ >]+@[^ >]+)>/,U=/^<([^ >]+:\/[^ >]+)>/,N=/-([a-z])?/gi,P=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,_=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,H=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,F=/^\[([^\]]*)\] ?\[([^\]]*)\]/,W=/(\[|\])/g,G=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Z=/\t/g,q=/(^ *\||\| *$)/g,X=/^ *:-+: *$/,Q=/^ *:-+ *$/,V=/^ *-+: *$/,J="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",K=new RegExp("^([*_])\\1"+J+"\\1\\1(?!\\1)"),Y=new RegExp("^([*_])"+J+"\\1(?!\\1|\\w)"),ee=new RegExp("^=="+J+"=="),re=new RegExp("^~~"+J+"~~"),ne=/^\\([^0-9A-Za-z\s])/,te=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ie=/^\n+/,ae=/^([ \t]*)/,oe=/\\([^\\])/g,le=/ *\n+$/,ce=/(?:^|\n)( *)$/,ue="(?:\\d+\\.)",se="(?:[*+-])";function de(e){return"( *)("+(1===e?ue:se)+") +"}var fe=de(1),pe=de(2);function he(e){return new RegExp("^"+(1===e?fe:pe))}var me=he(1),ge=he(2);function ye(e){return new RegExp("^"+(1===e?fe:pe)+"[^\\n]*(?:\\n(?!\\1"+(1===e?ue:se)+" )[^\\n]*)*(\\n|$)","gm")}var ke=ye(1),ve=ye(2);function xe(e){var r=1===e?ue:se;return new RegExp("^( *)("+r+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+r+" (?!"+r+" ))\\n*|\\s*\\n*$)")}var be=xe(1),Se=xe(2);function Ee(e,r){var n=1===r,t=n?be:Se,i=n?ke:ve,a=n?me:ge;return{match:function(e,r,n){var i=ce.exec(n);return i&&(r.list||!r.inline&&!r.simple)?t.exec(e=i[1]+e):null},order:1,parse:function(e,r,t){var o=n?+e[2]:void 0,l=e[0].replace(f,"\n").match(i),c=!1;return{items:l.map(function(e,n){var i=a.exec(e)[0].length,o=new RegExp("^ {1,"+i+"}","gm"),u=e.replace(o,"").replace(a,""),s=n===l.length-1,d=-1!==u.indexOf("\n\n")||s&&c;c=d;var f,p=t.inline,h=t.list;t.list=!0,d?(t.inline=!1,f=u.replace(le,"\n\n")):(t.inline=!0,f=u.replace(le,""));var m=r(f,t);return t.inline=p,t.list=h,m}),ordered:n,start:o}},render:function(r,n,t){return e(r.ordered?"ol":"ul",{key:t.key,start:r.type===o.orderedList?r.start:void 0},r.items.map(function(r,i){return e("li",{key:i},n(r,t))}))}}}var we=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ce=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Oe=[p,y,k,z,L,T,R,P,ke,be,ve,Se],ze=[].concat(Oe,[/^[^\n]+(?: \n|\n{2,})/,A,B]);function Te(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 Le(e){return V.test(e)?"right":X.test(e)?"center":Q.test(e)?"left":null}function Ae(e,r,n,t){var i=n.inTable;n.inTable=!0;var a=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(function(e,i){return"|"===i.trim()?e.push(t?{type:o.tableSeparator}:{type:o.text,text:i}):""!==i&&e.push.apply(e,r(i,n)),e},[]);n.inTable=i;var l=[[]];return a.forEach(function(e,r){e.type===o.tableSeparator?0!==r&&r!==a.length-1&&l.push([]):(e.type!==o.text||null!=a[r+1]&&a[r+1].type!==o.tableSeparator||(e.text=e.text.trimEnd()),l[l.length-1].push(e))}),l}function Me(e,r,n){n.inline=!0;var t=e[2]?e[2].replace(q,"").split("|").map(Le):[],i=e[3]?function(e,r,n){return e.trim().split("\n").map(function(e){return Ae(e,r,n,!0)})}(e[3],r,n):[],a=Ae(e[1],r,n,!!i.length);return n.inline=!1,i.length?{align:t,cells:i,header:a,type:o.table}:{children:a,type:o.paragraph}}function Re(e,r){return null==e.align[r]?{}:{textAlign:e.align[r]}}function $e(e){return function(r,n){return n.inline?e.exec(r):null}}function Be(e){return function(r,n){return n.inline||n.simple?e.exec(r):null}}function je(e){return function(r,n){return n.inline||n.simple?null:e.exec(r)}}function Ie(e){return function(r){return e.exec(r)}}function De(e,r,n){if(r.inline||r.simple)return null;if(n&&!n.endsWith("\n"))return null;var t="";e.split("\n").every(function(e){return!Oe.some(function(r){return r.test(e)})&&(t+=e+"\n",e.trim())});var i=t.trimEnd();return""==i?null:[t,i]}function Ue(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch(e){return null}return e}function Ne(e){return e.replace(oe,"$1")}function Pe(e,r,n){var t=n.inline||!1,i=n.simple||!1;n.inline=!0,n.simple=!0;var a=e(r,n);return n.inline=t,n.simple=i,a}function _e(e,r,n){var t=n.inline||!1,i=n.simple||!1;n.inline=!1,n.simple=!0;var a=e(r,n);return n.inline=t,n.simple=i,a}function He(e,r,n){var t=n.inline||!1;n.inline=!1;var i=e(r,n);return n.inline=t,i}var Fe=function(e,r,n){return{children:Pe(r,e[1],n)}};function We(){return{}}function Ge(){return null}function Ze(){return[].slice.call(arguments).filter(Boolean).join(" ")}function qe(e,r,n){for(var t=e,i=r.split(".");i.length&&void 0!==(t=t[i[0]]);)i.shift();return t||n}function Xe(e,r){var n=qe(r,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:qe(r,e+".component",e):e}function Qe(e,r){var i;function a(e,n){var i,a=qe(r.overrides,e+".props",{});return(i=r).createElement.apply(i,[Xe(e,r.overrides),t({},n,a,{className:Ze(null==n?void 0:n.className,a.className)||void 0})].concat([].slice.call(arguments,2)))}function f(e){e=e.replace(C,"");var t=!1;r.forceInline?t=!0:r.forceBlock||(t=!1===G.test(e));for(var i=le(oe(t?e:e.trimEnd().replace(ie,"")+"\n\n",{inline:t}));"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===r.wrapper)return i;var o,l=r.wrapper||(t?"span":"div");if(i.length>1||r.forceWrapper)o=i;else{if(1===i.length)return"string"==typeof(o=i[0])?a("span",{key:"outer"},o):o;o=null}return n.createElement(l,{key:"outer"},o)}function q(e,t){var i=t.match(s);return i?i.reduce(function(t,i,a){var o=i.indexOf("=");if(-1!==o){var c=function(e){return-1!==e.indexOf("-")&&null===e.match($)&&(e=e.replace(N,function(e,r){return r.toUpperCase()})),e}(i.slice(0,o)).trim(),u=function(e){var r=e[0];return('"'===r||"'"===r)&&e.length>=2&&e[e.length-1]===r?e.slice(1,-1):e}(i.slice(o+1).trim()),s=l[c]||c,d=t[s]=function(e,r,n,t){return"style"===r?n.split(/;\s?/).reduce(function(e,r){var n=r.slice(0,r.indexOf(":"));return e[n.trim().replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=r.slice(n.length+1).trim(),e},{}):"href"===r||"src"===r?t(n,e,r):(n.match(j)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(e,c,u,r.sanitizer);"string"==typeof d&&(A.test(d)||B.test(d))&&(t[s]=n.cloneElement(f(d.trim()),{key:a}))}else"style"!==i&&(t[l[i]||i]=!0);return t},{}):null}void 0===e&&(e=""),void 0===r&&(r={}),r.overrides=r.overrides||{},r.sanitizer=r.sanitizer||Ue,r.slugify=r.slugify||Te,r.namedCodesToUnicode=r.namedCodesToUnicode?t({},c,r.namedCodesToUnicode):c,r.createElement=r.createElement||n.createElement;var X=[],Q={},V=((i={})[o.blockQuote]={match:je(p),order:1,parse:function(e,r,n){return{children:r(e[0].replace(h,""),n)}},render:function(e,r,n){return a("blockquote",{key:n.key},r(e.children,n))}},i[o.breakLine]={match:Ie(m),order:1,parse:We,render:function(e,r,n){return a("br",{key:n.key})}},i[o.breakThematic]={match:je(g),order:1,parse:We,render:function(e,r,n){return a("hr",{key:n.key})}},i[o.codeBlock]={match:je(k),order:0,parse:function(e){return{lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}},render:function(e,r,n){return a("pre",{key:n.key},a("code",t({},e.attrs,{className:e.lang?"lang-"+e.lang:""}),e.text))}},i[o.codeFenced]={match:je(y),order:0,parse:function(e){return{attrs:q("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:o.codeBlock}}},i[o.codeInline]={match:Be(v),order:3,parse:function(e){return{text:e[2]}},render:function(e,r,n){return a("code",{key:n.key},e.text)}},i[o.footnote]={match:je(S),order:0,parse:function(e){return X.push({footnote:e[2],identifier:e[1]}),{}},render:Ge},i[o.footnoteReference]={match:$e(E),order:1,parse:function(e){return{target:"#"+r.slugify(e[1],Te),text:e[1]}},render:function(e,n,t){return a("a",{key:t.key,href:r.sanitizer(e.target,"a","href")},a("sup",{key:t.key},e.text))}},i[o.gfmTask]={match:$e(O),order:1,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},render:function(e,r,n){return a("input",{checked:e.completed,key:n.key,readOnly:!0,type:"checkbox"})}},i[o.heading]={match:je(r.enforceAtxHeadings?T:z),order:1,parse:function(e,n,t){return{children:Pe(n,e[2],t),id:r.slugify(e[2],Te),level:e[1].length}},render:function(e,r,n){return a("h"+e.level,{id:e.id,key:n.key},r(e.children,n))}},i[o.headingSetext]={match:je(L),order:0,parse:function(e,r,n){return{children:Pe(r,e[1],n),level:"="===e[2]?1:2,type:o.heading}}},i[o.htmlBlock]={match:Ie(A),order:1,parse:function(e,r,n){var t,i=e[3].match(ae),a=new RegExp("^"+i[1],"gm"),o=e[3].replace(a,""),l=(t=o,ze.some(function(e){return e.test(t)})?He:Pe),c=e[1].toLowerCase(),s=-1!==u.indexOf(c),d=(s?c:e[1]).trim(),f={attrs:q(d,e[2]),noInnerParse:s,tag:d};return n.inAnchor=n.inAnchor||"a"===c,s?f.text=e[3]:f.children=l(r,o,n),n.inAnchor=!1,f},render:function(e,r,n){return a(e.tag,t({key:n.key},e.attrs),e.text||r(e.children,n))}},i[o.htmlSelfClosing]={match:Ie(B),order:1,parse:function(e){var r=e[1].trim();return{attrs:q(r,e[2]||""),tag:r}},render:function(e,r,n){return a(e.tag,t({},e.attrs,{key:n.key}))}},i[o.htmlComment]={match:Ie(R),order:1,parse:function(){return{}},render:Ge},i[o.image]={match:Be(Ce),order:1,parse:function(e){return{alt:e[1],target:Ne(e[2]),title:e[3]}},render:function(e,n,t){return a("img",{key:t.key,alt:e.alt||void 0,title:e.title||void 0,src:r.sanitizer(e.target,"img","src")})}},i[o.link]={match:$e(we),order:3,parse:function(e,r,n){return{children:_e(r,e[1],n),target:Ne(e[2]),title:e[3]}},render:function(e,n,t){return a("a",{key:t.key,href:r.sanitizer(e.target,"a","href"),title:e.title},n(e.children,t))}},i[o.linkAngleBraceStyleDetector]={match:$e(U),order:0,parse:function(e){return{children:[{text:e[1],type:o.text}],target:e[1],type:o.link}}},i[o.linkBareUrlDetector]={match:function(e,r){return r.inAnchor?null:$e(I)(e,r)},order:0,parse:function(e){return{children:[{text:e[1],type:o.text}],target:e[1],title:void 0,type:o.link}}},i[o.linkMailtoDetector]={match:$e(D),order:0,parse:function(e){var r=e[1],n=e[1];return d.test(n)||(n="mailto:"+n),{children:[{text:r.replace("mailto:",""),type:o.text}],target:n,type:o.link}}},i[o.orderedList]=Ee(a,1),i[o.unorderedList]=Ee(a,2),i[o.newlineCoalescer]={match:je(x),order:3,parse:We,render:function(){return"\n"}},i[o.paragraph]={match:De,order:3,parse:Fe,render:function(e,r,n){return a("p",{key:n.key},r(e.children,n))}},i[o.ref]={match:$e(_),order:0,parse:function(e){return Q[e[1]]={target:e[2],title:e[4]},{}},render:Ge},i[o.refImage]={match:Be(H),order:0,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},render:function(e,n,t){return Q[e.ref]?a("img",{key:t.key,alt:e.alt,src:r.sanitizer(Q[e.ref].target,"img","src"),title:Q[e.ref].title}):null}},i[o.refLink]={match:$e(F),order:0,parse:function(e,r,n){return{children:r(e[1],n),fallbackChildren:r(e[0].replace(W,"\\$1"),n),ref:e[2]}},render:function(e,n,t){return Q[e.ref]?a("a",{key:t.key,href:r.sanitizer(Q[e.ref].target,"a","href"),title:Q[e.ref].title},n(e.children,t)):a("span",{key:t.key},n(e.fallbackChildren,t))}},i[o.table]={match:je(P),order:1,parse:Me,render:function(e,r,n){var t=e;return a("table",{key:n.key},a("thead",null,a("tr",null,t.header.map(function(e,i){return a("th",{key:i,style:Re(t,i)},r(e,n))}))),a("tbody",null,t.cells.map(function(e,i){return a("tr",{key:i},e.map(function(e,i){return a("td",{key:i,style:Re(t,i)},r(e,n))}))})))}},i[o.text]={match:Ie(te),order:4,parse:function(e){return{text:e[0].replace(M,function(e,n){return r.namedCodesToUnicode[n]?r.namedCodesToUnicode[n]:e})}},render:function(e){return e.text}},i[o.textBolded]={match:Be(K),order:2,parse:function(e,r,n){return{children:r(e[2],n)}},render:function(e,r,n){return a("strong",{key:n.key},r(e.children,n))}},i[o.textEmphasized]={match:Be(Y),order:3,parse:function(e,r,n){return{children:r(e[2],n)}},render:function(e,r,n){return a("em",{key:n.key},r(e.children,n))}},i[o.textEscaped]={match:Be(ne),order:1,parse:function(e){return{text:e[1],type:o.text}}},i[o.textMarked]={match:Be(ee),order:3,parse:Fe,render:function(e,r,n){return a("mark",{key:n.key},r(e.children,n))}},i[o.textStrikethroughed]={match:Be(re),order:3,parse:Fe,render:function(e,r,n){return a("del",{key:n.key},r(e.children,n))}},i);!0===r.disableParsingRawHTML&&(delete V[o.htmlBlock],delete V[o.htmlSelfClosing]);var J,oe=function(e){var r=Object.keys(e);function n(t,i){for(var a=[],o="";t;)for(var l=0;l<r.length;){var c=r[l],u=e[c],s=u.match(t,i,o);if(s){var d=s[0];t=t.substring(d.length);var f=u.parse(s,n,i);null==f.type&&(f.type=c),a.push(f),o=d;break}l++}return a}return r.sort(function(r,n){var t=e[r].order,i=e[n].order;return t!==i?t-i:r<n?-1:1}),function(e,r){return n(function(e){return e.replace(b,"\n").replace(w,"").replace(Z," ")}(e),r)}}(V),le=(J=function(e,r){return function(n,t,i){var a=e[n.type].render;return r?r(function(){return a(n,t,i)},n,t,i):a(n,t,i)}}(V,r.renderRule),function e(r,n){if(void 0===n&&(n={}),Array.isArray(r)){for(var t=n.key,i=[],a=!1,o=0;o<r.length;o++){n.key=o;var l=e(r[o],n),c="string"==typeof l;c&&a?i[i.length-1]+=l:null!==l&&i.push(l),a=c}return n.key=t,i}return J(r,e,n)}),ce=f(e);return X.length?a("div",null,ce,a("footer",{key:"footer"},X.map(function(e){return a("div",{id:r.slugify(e.identifier,Te),key:e.identifier},e.identifier,le(oe(e.footnote,{inline:!0})))}))):ce}var Ve=function(e){var r=e.children,t=void 0===r?"":r,i=e.options,o=function(e,r){if(null==e)return{};var n,t,i={},a=Object.keys(e);for(t=0;t<a.length;t++)r.indexOf(n=a[t])>=0||(i[n]=e[n]);return i}(e,a);return n.cloneElement(Qe(t,i),o)};return Object.assign(Ve,{compiler:Qe,RuleType:o}),Ve}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "7.4.7", | ||
"version": "7.5.0", | ||
"publishConfig": { | ||
@@ -103,7 +103,7 @@ "access": "public" | ||
"path": "./dist/index.module.js", | ||
"limit": "6.1 kB" | ||
"limit": "6.2 kB" | ||
}, | ||
{ | ||
"path": "./dist/index.modern.js", | ||
"limit": "6.1 kB" | ||
"limit": "6.2 kB" | ||
} | ||
@@ -110,0 +110,0 @@ ], |
@@ -22,2 +22,3 @@ **markdown-to-jsx** | ||
- [options.renderRule](#optionsrenderrule) | ||
- [options.sanitizer](#optionssanitizer) | ||
- [options.slugify](#optionsslugify) | ||
@@ -439,2 +440,23 @@ - [options.namedCodesToUnicode](#optionsnamedcodestounicode) | ||
#### options.sanitizer | ||
By default a lightweight URL sanitizer function is provided to avoid common attack vectors that might be placed into the `href` of an anchor tag, for example. The sanitizer receives the input, the HTML tag being targeted, and the attribute name. The original function is available as a library export called `sanitizer`. | ||
This can be overridden and replaced with a custom sanitizer if desired via `options.sanitizer`: | ||
```jsx | ||
// sanitizer in this situation would receive: | ||
// ('javascript:alert("foo")', 'a', 'href') | ||
;<Markdown options={{ sanitizer: (value, tag, attribute) => value }}> | ||
{`[foo](javascript:alert("foo"))`} | ||
</Markdown> | ||
// or | ||
compiler('[foo](javascript:alert("foo"))', { | ||
sanitizer: (value, tag, attribute) => value, | ||
}) | ||
``` | ||
#### options.slugify | ||
@@ -445,3 +467,3 @@ | ||
```jsx | ||
;<Markdown options={{ slugify: str => str }}># 中文</Markdown> | ||
<Markdown options={{ slugify: str => str }}># 中文</Markdown> | ||
@@ -453,5 +475,7 @@ // or | ||
// renders: | ||
;<h1 id="中文">中文</h1> | ||
<h1 id="中文">中文</h1> | ||
``` | ||
The original function is available as a library export called `slugify`. | ||
#### options.namedCodesToUnicode | ||
@@ -458,0 +482,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
481958
699
673