-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#376 - Allow more custom HTML character codes #379
Conversation
@probablyup Will this be merged or is there something that needs to be actioned? |
@dexster could you drop your changes to the docs files? |
…xster/markdown-to-jsx into #376_Allow_more__custom_codes
Doc updates removed |
@@ -1,2 +0,0 @@ | |||
!function(e,n,t){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(e),o=r(n),i=r(t);function l(){return(l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function c(e,n){return n||(n=e.slice(0)),e.raw=n,e}function u(){return(u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,n){return(s=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function p(e,n,t){return(p=d()?Reflect.construct:function(e,n,t){var r=[null];r.push.apply(r,n);var a=new(Function.bind.apply(e,r));return t&&s(a,t.prototype),a}).apply(null,arguments)}function m(e){var n="function"==typeof Map?new Map:void 0;return(m=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return p(e,arguments,f(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),s(t,e)})(e)}var h=function(e){var n,t;function r(n){return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this)}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,n.__proto__=t,r}(m(Error));function g(e){return Math.round(255*e)}function y(e,n,t){return g(e)+","+g(n)+","+g(t)}function b(e,n,t,r){if(void 0===r&&(r=y),0===n)return r(t,t,t);var a=(e%360+360)%360/60,o=(1-Math.abs(2*t-1))*n,i=o*(1-Math.abs(a%2-1)),l=0,c=0,u=0;a>=0&&a<1?(l=o,c=i):a>=1&&a<2?(l=i,c=o):a>=2&&a<3?(c=o,u=i):a>=3&&a<4?(c=i,u=o):a>=4&&a<5?(l=i,u=o):a>=5&&a<6&&(l=o,u=i);var f=t-o/2;return r(l+f,c+f,u+f)}var v={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},k=/^#[a-fA-F0-9]{6}$/,w=/^#[a-fA-F0-9]{8}$/,x=/^#[a-fA-F0-9]{3}$/,I=/^#[a-fA-F0-9]{4}$/,E=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,M=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,O=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,S=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function H(e){if("string"!=typeof e)throw new h(3);var n=function(e){if("string"!=typeof e)return e;var n=e.toLowerCase();return v[n]?"#"+v[n]:e}(e);if(n.match(k))return{red:parseInt(""+n[1]+n[2],16),green:parseInt(""+n[3]+n[4],16),blue:parseInt(""+n[5]+n[6],16)};if(n.match(w)){var t=parseFloat((parseInt(""+n[7]+n[8],16)/255).toFixed(2));return{red:parseInt(""+n[1]+n[2],16),green:parseInt(""+n[3]+n[4],16),blue:parseInt(""+n[5]+n[6],16),alpha:t}}if(n.match(x))return{red:parseInt(""+n[1]+n[1],16),green:parseInt(""+n[2]+n[2],16),blue:parseInt(""+n[3]+n[3],16)};if(n.match(I)){var r=parseFloat((parseInt(""+n[4]+n[4],16)/255).toFixed(2));return{red:parseInt(""+n[1]+n[1],16),green:parseInt(""+n[2]+n[2],16),blue:parseInt(""+n[3]+n[3],16),alpha:r}}var a=E.exec(n);if(a)return{red:parseInt(""+a[1],10),green:parseInt(""+a[2],10),blue:parseInt(""+a[3],10)};var o=M.exec(n);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10),alpha:parseFloat(""+o[4])};var i=O.exec(n);if(i){var l="rgb("+b(parseInt(""+i[1],10),parseInt(""+i[2],10)/100,parseInt(""+i[3],10)/100)+")",c=E.exec(l);if(!c)throw new h(4,n,l);return{red:parseInt(""+c[1],10),green:parseInt(""+c[2],10),blue:parseInt(""+c[3],10)}}var u=S.exec(n);if(u){var f="rgb("+b(parseInt(""+u[1],10),parseInt(""+u[2],10)/100,parseInt(""+u[3],10)/100)+")",s=E.exec(f);if(!s)throw new h(4,n,f);return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+u[4])}}throw new h(5)}var j=function(e){return 7===e.length&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e};function A(e){var n=e.toString(16);return 1===n.length?"0"+n:n}function $(e){return A(Math.round(255*e))}function z(e,n,t){return j("#"+$(e)+$(n)+$(t))}function C(e,n,t){return b(e,n,t,z)}function _(e,n,t){if("number"==typeof e&&"number"==typeof n&&"number"==typeof t)return j("#"+A(e)+A(n)+A(t));if("object"==typeof e&&void 0===n&&void 0===t)return j("#"+A(e.red)+A(e.green)+A(e.blue));throw new h(6)}function G(e,n,t,r){if("string"==typeof e&&"number"==typeof n){var a=H(e);return"rgba("+a.red+","+a.green+","+a.blue+","+n+")"}if("number"==typeof e&&"number"==typeof n&&"number"==typeof t&&"number"==typeof r)return r>=1?_(e,n,t):"rgba("+e+","+n+","+t+","+r+")";if("object"==typeof e&&void 0===n&&void 0===t&&void 0===r)return e.alpha>=1?_(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new h(7)}function L(e,n,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=n?e.apply(this,r):L(e,n,r)}}function R(e){return L(e,e.length,[])}function F(e,n){if("transparent"===n)return n;var t,r=function(e){return function(e){var n,t=e.red/255,r=e.green/255,a=e.blue/255,o=Math.max(t,r,a),i=Math.min(t,r,a),l=(o+i)/2;if(o===i)return void 0!==e.alpha?{hue:0,saturation:0,lightness:l,alpha:e.alpha}:{hue:0,saturation:0,lightness:l};var c=o-i,u=l>.5?c/(2-o-i):c/(o+i);switch(o){case t:n=(r-a)/c+(r<a?6:0);break;case r:n=(a-t)/c+2;break;default:n=(t-r)/c+4}return n*=60,void 0!==e.alpha?{hue:n,saturation:u,lightness:l,alpha:e.alpha}:{hue:n,saturation:u,lightness:l}}(H(e))}(n);return function(e){if("object"!=typeof e)throw new h(8);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha}(e))return G(e);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return _(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha}(e))return function(e,n,t,r){if("object"==typeof e)return e.alpha>=1?C(e.hue,e.saturation,e.lightness):"rgba("+b(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new h(2)}(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return function(e,n,t){if("object"==typeof e)return C(e.hue,e.saturation,e.lightness);throw new h(1)}(e);throw new h(8)}(u({},r,{lightness:(t=r.lightness+parseFloat(e),Math.max(0,Math.min(1,t)))}))}var T=R(F);function P(){return(P=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var D=/[\'\"]/,X={accesskey:"accessKey",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},q={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},B=["style","script"],N=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,W=/mailto:/i,U=/\n{2,}$/,Z=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,J=/^ *> ?/gm,V=/^ {2,}\n/,K=/^(?:( *[-*_]) *){3,}(?:\n *)+\n/,Q=/^\s*(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n *)+\n?/,Y=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,ee=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,ne=/^(?:\n *)*\n/,te=/\r\n?/g,re=/^\[\^([^\]]+)](:.*)\n/,ae=/^\[\^([^\]]+)]/,oe=/\f/g,ie=/^\s*?\[(x|\s)\]/,le=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,ce=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,ue=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,fe=/&([a-z]+);/g,se=/^<!--[\s\S]*?(?:-->)/,de=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,pe=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,me=/^\{.*\}$/,he=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,ge=/^<([^ >]+@[^ >]+)>/,ye=/^<([^ >]+:\/[^ >]+)>/,be=/ *\n+$/,ve=/(?:^|\n)( *)$/,ke=/-([a-z])?/gi,we=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,xe=/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/,Ie=/^\[([^\]]*)\]:\s*(\S+)\s*("([^"]*)")?/,Ee=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Me=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Oe=/(\[|\])/g,Se=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,He=/\t/g,je=/^ *\| */,Ae=/(^ *\||\| *$)/g,$e=/ *$/,ze=/^ *:-+: *$/,Ce=/^ *:-+ *$/,_e=/^ *-+: *$/,Ge=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,Le=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1)/,Re=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,Fe=/^\\([^0-9A-Za-z\s])/,Te=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,Pe=/(^\n+|\n+$|\s+$)/g,De=/^([ \t]*)/,Xe=/\\([^0-9A-Z\s])/gi,qe=new RegExp("^( *)((?:[*+-]|\\d+\\.)) +"),Be=new RegExp("( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\\n|$)","gm"),Ne=new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) (?!(?:[*+-]|\\d+\\.) ))\\n*|\\s*\\n*$)"),We="(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*",Ue=new RegExp("^\\[("+We+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ze=new RegExp("^!\\[("+We+")\\]\\(\\s*<?((?:[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Je=[Z,Y,Q,le,ce,ue,se,pe,Be,Ne,we,xe];function Ve(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 Ke(e){return _e.test(e)?"right":ze.test(e)?"center":Ce.test(e)?"left":null}function Qe(e,n,t){var r=t.inTable;t.inTable=!0;var a=n(e.trim(),t);t.inTable=r;var o=[[]];return a.forEach(function(e,n){"tableSeparator"===e.type?0!==n&&n!==a.length-1&&o.push([]):("text"!==e.type||null!=a[n+1]&&"tableSeparator"!==a[n+1].type||(e.content=e.content.replace($e,"")),o[o.length-1].push(e))}),o}function Ye(e,n,t){t.inline=!0;var r=Qe(e[1],n,t),a=e[2].replace(Ae,"").split("|").map(Ke),o=function(e,n,t){return e.trim().split("\n").map(function(e){return Qe(e,n,t)})}(e[3],n,t);return t.inline=!1,{align:a,cells:o,header:r,type:"table"}}function en(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function nn(e){return function(n,t){return t.inline?e.exec(n):null}}function tn(e){return function(n,t){return t.inline||t.simple?e.exec(n):null}}function rn(e){return function(n,t){return t.inline||t.simple?null:e.exec(n)}}function an(e){return function(n){return e.exec(n)}}function on(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data):/i))return null}catch(e){return null}return e}function ln(e){return e.replace(Xe,"$1")}function cn(e,n,t){var r=t.inline||!1,a=t.simple||!1;t.inline=!0,t.simple=!0;var o=e(n,t);return t.inline=r,t.simple=a,o}function un(e,n,t){var r=t.inline||!1,a=t.simple||!1;t.inline=!1,t.simple=!0;var o=e(n,t);return t.inline=r,t.simple=a,o}function fn(e,n,t){return t.inline=!1,e(n+"\n\n",t)}var sn,dn,pn=function(e,n,t){return{content:cn(n,e[1],t)}};function mn(){return{}}function hn(){return null}function gn(){return[].slice.call(arguments).filter(Boolean).join(" ")}function yn(e,n,t){for(var r=e,a=n.split(".");a.length&&void 0!==(r=r[a[0]]);)a.shift();return r||t}function bn(e,n){var t=yn(n,e);return t?"function"==typeof t||"object"==typeof t&&"render"in t?t:yn(n,e+".component",e):e}function vn(e,n){void 0===n&&(n={}),n.overrides=n.overrides||{},n.slugify=n.slugify||Ve,n.namedCodesToUnicode=n.namedCodesToUnicode?P({},q,n.namedCodesToUnicode):q;var t=n.createElement||a.default.createElement;function r(e,r){var a=yn(n.overrides,e+".props",{});return t.apply(void 0,[bn(e,n.overrides),P({},r,a,{className:gn(null==r?void 0:r.className,a.className)||void 0})].concat([].slice.call(arguments,2)))}function o(e){var t=!1;n.forceInline?t=!0:n.forceBlock||(t=!1===Se.test(e));var o=p(d(t?e:e.replace(Pe,"")+"\n\n",{inline:t}));if(null===n.wrapper)return o;var i,l=n.wrapper||(t?"span":"div");if(o.length>1||n.forceWrapper)i=o;else{if(1===o.length)return"string"==typeof(i=o[0])?r("span",{key:"outer"},i):i;i=null}return a.default.createElement(l,{key:"outer"},i)}function i(e){var n=e.match(N);return n?n.reduce(function(e,n,t){var r,i=n.indexOf("=");if(-1!==i){var l=(r=n.slice(0,i),-1!==r.indexOf("-")&&null===r.match(de)&&(r=r.replace(ke,function(e,n){return n.toUpperCase()})),r).trim(),c=function(e){return e?(D.test(e.charAt(0))&&(e=e.substr(1)),D.test(e.charAt(e.length-1))&&(e=e.substr(0,e.length-1)),e):""}(n.slice(i+1).trim()),u=X[l]||l,f=e[u]=function(e,n){return"style"===e?n.split(/;\s?/).reduce(function(e,n){var t=n.slice(0,n.indexOf(":"));return e[t.replace(/(-[a-z])/g,function(e){return e[1].toUpperCase()})]=n.slice(t.length+1).trim(),e},{}):"href"===e?on(n):(n.match(me)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(l,c);"string"==typeof f&&(ue.test(f)||pe.test(f))&&(e[u]=a.default.cloneElement(o(f.trim()),{key:t}))}else"style"!==n&&(e[X[n]||n]=!0);return e},{}):void 0}var l=[],c={},u={blockQuote:{match:rn(Z),order:sn.HIGH,parse:function(e,n,t){return{content:n(e[0].replace(J,""),t)}},react:function(e,n,t){return r("blockquote",{key:t.key},n(e.content,t))}},breakLine:{match:an(V),order:sn.HIGH,parse:mn,react:function(e,n,t){return r("br",{key:t.key})}},breakThematic:{match:rn(K),order:sn.HIGH,parse:mn,react:function(e,n,t){return r("hr",{key:t.key})}},codeBlock:{match:rn(Y),order:sn.MAX,parse:function(e){return{content:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,""),lang:void 0}},react:function(e,n,t){return r("pre",{key:t.key},r("code",{className:e.lang?"lang-"+e.lang:""},e.content))}},codeFenced:{match:rn(Q),order:sn.MAX,parse:function(e){return{content:e[3],lang:e[2]||void 0,type:"codeBlock"}}},codeInline:{match:tn(ee),order:sn.LOW,parse:function(e){return{content:e[2]}},react:function(e,n,t){return r("code",{key:t.key},e.content)}},footnote:{match:rn(re),order:sn.MAX,parse:function(e){return l.push({footnote:e[2],identifier:e[1]}),{}},react:hn},footnoteReference:{match:nn(ae),order:sn.HIGH,parse:function(e){return{content:e[1],target:"#"+n.slugify(e[1])}},react:function(e,n,t){return r("a",{key:t.key,href:on(e.target)},r("sup",{key:t.key},e.content))}},gfmTask:{match:nn(ie),order:sn.HIGH,parse:function(e){return{completed:"x"===e[1].toLowerCase()}},react:function(e,n,t){return r("input",{checked:e.completed,key:t.key,readOnly:!0,type:"checkbox"})}},heading:{match:rn(le),order:sn.HIGH,parse:function(e,t,r){return{content:cn(t,e[2],r),id:n.slugify(e[2]),level:e[1].length}},react:function(e,n,t){return e.tag="h"+e.level,r(e.tag,{id:e.id,key:t.key},n(e.content,t))}},headingSetext:{match:rn(ce),order:sn.MAX,parse:function(e,n,t){return{content:cn(n,e[1],t),level:"="===e[2]?1:2,type:"heading"}}},htmlComment:{match:an(se),order:sn.HIGH,parse:function(){return{}},react:hn},image:{match:tn(Ze),order:sn.HIGH,parse:function(e){return{alt:e[1],target:ln(e[2]),title:e[3]}},react:function(e,n,t){return r("img",{key:t.key,alt:e.alt||void 0,title:e.title||void 0,src:on(e.target)})}},link:{match:nn(Ue),order:sn.LOW,parse:function(e,n,t){return{content:un(n,e[1],t),target:ln(e[2]),title:e[3]}},react:function(e,n,t){return r("a",{key:t.key,href:on(e.target),title:e.title},n(e.content,t))}},linkAngleBraceStyleDetector:{match:nn(ye),order:sn.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],type:"link"}}},linkBareUrlDetector:{match:nn(he),order:sn.MAX,parse:function(e){return{content:[{content:e[1],type:"text"}],target:e[1],title:void 0,type:"link"}}},linkMailtoDetector:{match:nn(ge),order:sn.MAX,parse:function(e){var n=e[1],t=e[1];return W.test(t)||(t="mailto:"+t),{content:[{content:n.replace("mailto:",""),type:"text"}],target:t,type:"link"}}},list:{match:function(e,n,t){var r=ve.exec(t);return!r||!n._list&&n.inline?null:Ne.exec(e=r[1]+e)},order:sn.HIGH,parse:function(e,n,t){var r=e[2],a=r.length>1,o=a?+r:void 0,i=e[0].replace(U,"\n").match(Be),l=!1;return{items:i.map(function(e,r){var a=qe.exec(e)[0].length,o=new RegExp("^ {1,"+a+"}","gm"),c=e.replace(o,"").replace(qe,""),u=r===i.length-1,f=-1!==c.indexOf("\n\n")||u&&l;l=f;var s,d=t.inline,p=t._list;t._list=!0,f?(t.inline=!1,s=c.replace(be,"\n\n")):(t.inline=!0,s=c.replace(be,""));var m=n(s,t);return t.inline=d,t._list=p,m}),ordered:a,start:o}},react:function(e,n,t){return r(e.ordered?"ol":"ul",{key:t.key,start:e.start},e.items.map(function(e,a){return r("li",{key:a},n(e,t))}))}},newlineCoalescer:{match:rn(ne),order:sn.LOW,parse:mn,react:function(){return"\n"}},paragraph:{match:rn(xe),order:sn.LOW,parse:pn,react:function(e,n,t){return r("p",{key:t.key},n(e.content,t))}},ref:{match:nn(Ie),order:sn.MAX,parse:function(e){return c[e[1]]={target:e[2],title:e[4]},{}},react:hn},refImage:{match:tn(Ee),order:sn.MAX,parse:function(e){return{alt:e[1]||void 0,ref:e[2]}},react:function(e,n,t){return r("img",{key:t.key,alt:e.alt,src:on(c[e.ref].target),title:c[e.ref].title})}},refLink:{match:nn(Me),order:sn.MAX,parse:function(e,n,t){return{content:n(e[1],t),fallbackContent:n(e[0].replace(Oe,"\\$1"),t),ref:e[2]}},react:function(e,n,t){return c[e.ref]?r("a",{key:t.key,href:on(c[e.ref].target),title:c[e.ref].title},n(e.content,t)):r("span",{key:t.key},n(e.fallbackContent,t))}},table:{match:rn(we),order:sn.HIGH,parse:Ye,react:function(e,n,t){return r("table",{key:t.key},r("thead",null,r("tr",null,e.header.map(function(a,o){return r("th",{key:o,style:en(e,o)},n(a,t))}))),r("tbody",null,e.cells.map(function(a,o){return r("tr",{key:o},a.map(function(a,o){return r("td",{key:o,style:en(e,o)},n(a,t))}))})))}},tableSeparator:{match:function(e,n){return n.inTable?je.exec(e):null},order:sn.HIGH,parse:function(){return{type:"tableSeparator"}},react:function(){return" | "}},text:{match:an(Te),order:sn.MIN,parse:function(e){return{content:e[0].replace(fe,function(e,t){return n.namedCodesToUnicode[t]?n.namedCodesToUnicode[t]:e})}},react:function(e){return e.content}},textBolded:{match:tn(Ge),order:sn.MED,parse:function(e,n,t){return{content:n(e[2],t)}},react:function(e,n,t){return r("strong",{key:t.key},n(e.content,t))}},textEmphasized:{match:tn(Le),order:sn.LOW,parse:function(e,n,t){return{content:n(e[2],t)}},react:function(e,n,t){return r("em",{key:t.key},n(e.content,t))}},textEscaped:{match:tn(Fe),order:sn.HIGH,parse:function(e){return{content:e[1],type:"text"}}},textStrikethroughed:{match:tn(Re),order:sn.LOW,parse:pn,react:function(e,n,t){return r("del",{key:t.key},n(e.content,t))}}};!0!==n.disableParsingRawHTML&&(u.htmlBlock={match:an(ue),order:sn.HIGH,parse:function(e,n,t){var r,a=e[3].match(De),o=new RegExp("^"+a[1],"gm"),l=e[3].replace(o,""),c=(r=l,Je.some(function(e){return e.test(r)})?fn:cn),u=e[1].toLowerCase(),f=-1!==B.indexOf(u);return{attrs:i(e[2]),content:f?e[3]:c(n,l,t),noInnerParse:f,tag:f?u:e[1]}},react:function(e,n,t){return r(e.tag,Object.assign({key:t.key},e.attrs),e.noInnerParse?e.content:n(e.content,t))}},u.htmlSelfClosing={match:an(pe),order:sn.HIGH,parse:function(e){return{attrs:i(e[2]||""),tag:e[1]}},react:function(e,n,t){return r(e.tag,Object.assign({},e.attrs,{key:t.key}))}});var f,s,d=function(e){var n=Object.keys(e);function t(r,a){for(var o=[],i="";r;)for(var l=0;l<n.length;){var c=n[l],u=e[c],f=u.match(r,a,i);if(f){var s=f[0];r=r.substring(s.length);var d=u.parse(f,t,a);null==d.type&&(d.type=c),o.push(d),i=s;break}l++}return o}return n.sort(function(n,t){var r=e[n].order,a=e[t].order;return r!==a?r-a:n<t?-1:1}),function(e,n){return t(function(e){return e.replace(te,"\n").replace(oe,"").replace(He," ")}(e),n)}}(u),p=(s=u,f=function(e,n,t){return s[e.type].react(e,n,t)},function e(n,t){if(void 0===t&&(t={}),Array.isArray(n)){for(var r=t.key,a=[],o=!1,i=0;i<n.length;i++){t.key=i;var l=e(n[i],t),c="string"==typeof l;c&&o?a[a.length-1]+=l:a.push(l),o=c}return t.key=r,a}return f(n,e,t)}),m=o(e);return l.length&&m.props.children.push(r("footer",{key:"footer"},l.map(function(e){return r("div",{id:n.slugify(e.identifier),key:e.identifier},e.identifier,p(d(e.footnote,{inline:!0})))}))),m}function kn(e){var n=e.children,t=e.options,r=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n.indexOf(t=o[r])>=0||(a[t]=e[t]);return a}(e,["children","options"]);return a.default.cloneElement(vn(n,t),r)}function wn(){var e=c(["\n background: #444;\n color: #ddd;\n cursor: pointer;\n font: inherit;\n transition: background 200ms ease;\n\n &:hover,\n &:focus {\n background: #222;\n }\n\n &:active {\n background: #000;\n }\n"]);return wn=function(){return e},e}function xn(){var e=c(["\n ",";\n padding-left: 2rem;\n padding-right: 1rem;\n overflow: auto;\n overflow-x: hidden;\n"]);return xn=function(){return e},e}function In(){var e=c(["\n ",";\n background: ",";\n border: 0;\n color: inherit;\n position: sticky;\n top: 0;\n font-family: 'Source Code Pro', Consolas, Monaco, monospace;\n font-size: inherit;\n max-height: 100vh;\n\n @media all and (max-width: 500px) {\n height: 300px;\n position: relative;\n }\n"]);return In=function(){return e},e}function En(){var e=c(["\n display: flex;\n flex-grow: 1;\n margin-left: -1.5rem;\n margin-right: -1.5rem;\n\n @media all and (min-width: 1024px) {\n margin-left: 0;\n margin-right: 0;\n }\n\n @media all and (max-width: 500px) {\n flex-direction: column;\n }\n"]);return En=function(){return e},e}function Mn(){var e=c(["\n flex: 0 0 50%;\n padding: 1em;\n"]);return Mn=function(){return e},e}function On(){var e=c(["\n color: ",";\n"]);return On=function(){return e},e}function Sn(){var e=c(["\n font-size: 18px;\n margin-left: auto;\n margin-right: auto;\n max-width: 60vw;\n\n h1,\n h2 {\n font: inherit;\n }\n\n @media all and (max-width: 500px) {\n max-width: none;\n }\n\n @media all and (max-width: 1023px) {\n h1,\n h2 {\n display: block;\n margin-bottom: 1.5rem;\n }\n }\n"]);return Sn=function(){return e},e}function Hn(){var e=c(["\n flex-shrink: 0;\n margin-bottom: 2em;\n text-align: center;\n\n img {\n height: 100px;\n }\n"]);return Hn=function(){return e},e}function jn(){var e=c(["\n\t*,\n\t*::before,\n\t*::after {\n\t\tbox-sizing: border-box;\n\t\toutline-color: ",";\n\t}\n\n\thtml,\n\tbody,\n\t#root,\n\tmain {\n\t\tmargin: 0;\n\t\tmin-height: 100vh;\n\t}\n\n\thtml {\n\t\tbackground: #222;\n\t\tcolor: ",";\n\t\tfont-family: 'Source Sans Pro', Helvetica Neue, Helvetica, sans-serif;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t}\n\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6 {\n\t\tmargin: 0 0 1rem;\n\t}\n\n\th1 {\n\t\tfont-size: 2rem;\n\t}\n\n\th2 {\n\t\tfont-size: 1.8rem;\n\t}\n\n\th3 {\n\t\tfont-size: 1.6rem;\n\t}\n\n\th4 {\n\t\tfont-size: 1.4rem;\n\t}\n\n\th5 {\n\t\tfont-size: 1.2rem;\n\t}\n\n\th6 {\n\t\tfont-size: 1rem;\n\t}\n\n\ta {\n\t\tcolor: ",";\n\t\ttransition: color 200ms ease;\n\n\t\t&:hover,\n\t\t&:focus {\n\t\t\tcolor: ",";\n\t\t}\n\t}\n\n\tcode {\n\t\tbackground: ",";\n\t\tdisplay: inline-block;\n\t\tpadding: 0 2px;\n\t}\n\n\tpre code {\n\t\tbackground: transparent;\n\t\tborder: 0;\n\t\tdisplay: block;\n\t\tpadding: 1em;\n\t}\n\n\tmain {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tpadding: 3rem 1.5rem 0;\n\t\tmargin: 0;\n\n\t\t@media all and (min-width: 1024px) {\n\t\t\tpadding: 3rem;\n\t\t}\n\t}\n"]);return jn=function(){return e},e}function An(){var e=a.default.useState(document.getElementById("sample-content").textContent.trim()),n=e[0],t=e[1],r=a.default.useCallback(function(e){return t(e.target.value)},[]);return a.default.createElement("main",null,a.default.createElement(Cn,null),a.default.createElement("a",{href:"https://support.eji.org/give/153413/#!/donation/checkout",rel:"noopener noreferrer",target:"_blank",style:{background:"#000",color:"#fff",textAlign:"center",textDecoration:"none",fontSize:"16px",padding:"0.5em",margin:"-3rem -3rem 2em",position:"sticky",top:0}},"#BlackLivesMatter ✊🏿"," ",a.default.createElement("span",{style:{textDecoration:"underline"}},"Support the Equal Justice Initiative")),a.default.createElement(_n,null,a.default.createElement("a",{target:"_blank",href:"https://github.com/probablyup/markdown-to-jsx",title:"Check out the markdown-to-jsx source code",rel:"noopener noreferrer"},a.default.createElement("img",{src:"./images/logo.svg",alt:"markdown-to-jsx logo"})),a.default.createElement(Gn,null,a.default.createElement("h1",null,a.default.createElement("code",null,"markdown-to-jsx")," is an easy-to-use markdown component that takes Github-flavored Markdown (GFM) and makes native JSX without dangerous hacks. "),a.default.createElement("h2",null,"It's lightweight, customizable, and happily supports React-like libraries.")),a.default.createElement(Ln,null,"See the"," ",a.default.createElement("a",{target:"_blank",href:"https://github.com/probablyup/markdown-to-jsx/blob/master/README.md",rel:"noopener noreferrer"},"project README")," ","for detailed installation & usage instructions.")),a.default.createElement(Fn,null,a.default.createElement(Tn,{onInput:r,value:n}),a.default.createElement(Pn,null,a.default.createElement(kn,{options:Xn},n))))}(dn=sn||(sn={}))[dn.MAX=0]="MAX",dn[dn.HIGH=1]="HIGH",dn[dn.MED=2]="MED",dn[dn.LOW=3]="LOW",dn[dn.MIN=4]="MIN";var $n="rgba(255, 255, 255, 0.5)",zn="#fefefe",Cn=t.createGlobalStyle(jn(),$n,zn,$n,G($n,.75),G($n,.05)),_n=i.default.header(Hn()),Gn=i.default.p(Sn()),Ln=i.default.p(On(),T(.2,zn)),Rn=t.css(Mn()),Fn=i.default.section(En()),Tn=i.default.textarea(In(),Rn,G($n,.05)),Pn=i.default.div(xn(),Rn),Dn=i.default.button(wn()),Xn={overrides:{MyComponent:{component:function(e){return a.default.createElement(Dn,l({},e,{onClick:function(){alert("Look ma, I'm a real component!")}}))}}}};o.default.render(a.default.createElement(An,null),document.getElementById("root"))}(React,ReactDOM,styled); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop these file deletions from your PR please
I'm interested in landing this if someone wants to update / recreate this PR against main |
Superceded by #502, thank you for contributing! |
Allows more HTML character codes to be added to custom codes as per #376