react-markdown-table-ts 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -10
- package/dist/dark.png +0 -0
- package/dist/index.cjs +0 -53
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -940
- package/dist/light.png +0 -0
- package/dist/types.d.ts +0 -122
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -8
- package/dist/utils.d.ts.map +0 -1
- package/dist/validation.d.ts +0 -18
- package/dist/validation.d.ts.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-markdown-table-ts",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.7",
|
4
4
|
"description": "A React component that converts structured data into Markdown table syntax and displays it within a `<pre>` tag.",
|
5
5
|
"keywords": [
|
6
6
|
"markdown",
|
@@ -51,12 +51,10 @@
|
|
51
51
|
"storybook": "storybook dev -p 6006",
|
52
52
|
"build-storybook": "storybook build"
|
53
53
|
},
|
54
|
-
"peerDependencies": {
|
55
|
-
"react": ">=18.0.0",
|
56
|
-
"react-dom": ">=18.0.0"
|
57
|
-
},
|
58
54
|
"dependencies": {
|
59
|
-
"prismjs": "^1.30.0"
|
55
|
+
"prismjs": "^1.30.0",
|
56
|
+
"react": "^18.3.1",
|
57
|
+
"react-dom": "^18.3.1"
|
60
58
|
},
|
61
59
|
"devDependencies": {
|
62
60
|
"@storybook/react-vite": "^9.1.10",
|
@@ -65,13 +63,11 @@
|
|
65
63
|
"@types/jest": "^29.5.14",
|
66
64
|
"@types/node": "^24.6.0",
|
67
65
|
"@types/prismjs": "^1.26.5",
|
68
|
-
"@types/react": "^
|
69
|
-
"@types/react-dom": "^
|
66
|
+
"@types/react": "^18.3.1",
|
67
|
+
"@types/react-dom": "^18.3.1",
|
70
68
|
"@vitejs/plugin-react-swc": "^4.1.0",
|
71
69
|
"jest": "^29.7.0",
|
72
70
|
"jest-environment-jsdom": "^29.7.0",
|
73
|
-
"react": "^19.1.1",
|
74
|
-
"react-dom": "^19.1.1",
|
75
71
|
"storybook": "^9.1.10",
|
76
72
|
"ts-jest": "^29.2.5",
|
77
73
|
"typescript": "~5.9.3",
|
package/dist/dark.png
DELETED
Binary file
|
package/dist/index.cjs
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),oe=require("prismjs");var O={exports:{}},C={};/**
|
2
|
-
* @license React
|
3
|
-
* react-jsx-runtime.production.js
|
4
|
-
*
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/var U;function ie(){if(U)return C;U=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(m,i,d){var a=null;if(d!==void 0&&(a=""+d),i.key!==void 0&&(a=""+i.key),"key"in i){d={};for(var u in i)u!=="key"&&(d[u]=i[u])}else d=i;return i=d.ref,{$$typeof:n,type:m,key:a,ref:i!==void 0?i:null,props:d}}return C.Fragment=t,C.jsx=s,C.jsxs=s,C}var $={};/**
|
10
|
-
* @license React
|
11
|
-
* react-jsx-runtime.development.js
|
12
|
-
*
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
14
|
-
*
|
15
|
-
* This source code is licensed under the MIT license found in the
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/var V;function se(){return V||(V=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case _:return"Profiler";case E:return"StrictMode";case Q:return"Suspense";case K:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case v:return"Portal";case N:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case Z:var c=e.render;return e=e.displayName,e||(e=c.displayName||c.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return c=e.displayName||null,c!==null?c:n(e.type)||"Memo";case z:c=e._payload,e=e._init;try{return n(e(c))}catch{}}return null}function t(e){return""+e}function s(e){try{t(e);var c=!1}catch{c=!0}if(c){c=console;var h=c.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return h.call(c,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),t(e)}}function m(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===z)return"<...>";try{var c=n(e);return c?"<"+c+">":"<...>"}catch{return"<...>"}}function i(){var e=M.A;return e===null?null:e.getOwner()}function d(){return Error("react-stack-top-frame")}function a(e){if(H.call(e,"key")){var c=Object.getOwnPropertyDescriptor(e,"key").get;if(c&&c.isReactWarning)return!1}return e.key!==void 0}function u(e,c){function h(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",c))}h.isReactWarning=!0,Object.defineProperty(e,"key",{get:h,configurable:!0})}function l(){var e=n(this.type);return q[e]||(q[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function f(e,c,h,b,j,I){var w=h.ref;return e={$$typeof:y,type:e,key:c,props:h,_owner:b},(w!==void 0?w:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:l}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:j}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function o(e,c,h,b,j,I){var w=c.children;if(w!==void 0)if(b)if(re(w)){for(b=0;b<w.length;b++)r(w[b]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else r(w);if(H.call(c,"key")){w=n(e);var S=Object.keys(c).filter(function(ae){return ae!=="key"});b=0<S.length?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}",D[w+b]||(S=0<S.length?"{"+S.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
18
|
-
let props = %s;
|
19
|
-
<%s {...props} />
|
20
|
-
React keys must be passed directly to JSX without using spread:
|
21
|
-
let props = %s;
|
22
|
-
<%s key={someKey} {...props} />`,b,w,S,w),D[w+b]=!0)}if(w=null,h!==void 0&&(s(h),w=""+h),a(c)&&(s(c.key),w=""+c.key),"key"in c){h={};for(var L in c)L!=="key"&&(h[L]=c[L])}else h=c;return w&&u(h,typeof e=="function"?e.displayName||e.name||"Unknown":e),f(e,w,h,i(),j,I)}function r(e){p(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===z&&(e._payload.status==="fulfilled"?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}var g=x,y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),N=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),M=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=Object.prototype.hasOwnProperty,re=Array.isArray,P=console.createTask?console.createTask:function(){return null};g={react_stack_bottom_frame:function(e){return e()}};var W,q={},F=g.react_stack_bottom_frame.bind(g,d)(),Y=P(m(d)),D={};$.Fragment=k,$.jsx=function(e,c,h){var b=1e4>M.recentlyCreatedOwnerStacks++;return o(e,c,h,!1,b?Error("react-stack-top-frame"):F,b?P(m(e)):Y)},$.jsxs=function(e,c,h){var b=1e4>M.recentlyCreatedOwnerStacks++;return o(e,c,h,!0,b?Error("react-stack-top-frame"):F,b?P(m(e)):Y)}})()),$}var J;function le(){return J||(J=1,process.env.NODE_ENV==="production"?O.exports=ie():O.exports=se()),O.exports}var T=le();(function(n){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(o){return o=o.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var m=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return m}),d=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+d+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+d+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(m),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+d+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(m),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(r){o!==r&&(n.languages.markdown[o].inside.content.inside[r]=n.languages.markdown[r])})}),n.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function r(p){if(!(!p||typeof p=="string"))for(var g=0,y=p.length;g<y;g++){var v=p[g];if(v.type!=="code"){r(v.content);continue}var k=v.content[1],E=v.content[3];if(k&&E&&k.type==="code-language"&&E.type==="code-block"&&typeof k.content=="string"){var _=k.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");_=(/[a-z][\w-]*/i.exec(_)||[""])[0].toLowerCase();var R="language-"+_;E.alias?typeof E.alias=="string"?E.alias=[E.alias,R]:E.alias.push(R):E.alias=[R]}}}r(o.tokens)}),n.hooks.add("wrap",function(o){if(o.type==="code-block"){for(var r="",p=0,g=o.classes.length;p<g;p++){var y=o.classes[p],v=/language-(.+)/.exec(y);if(v){r=v[1];break}}var k=n.languages[r];if(k)o.content=n.highlight(f(o.content),k,r);else if(r&&r!=="none"&&n.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);o.attributes.id=E,n.plugins.autoloader.loadLanguages(r,function(){var _=document.getElementById(E);_&&(_.innerHTML=n.highlight(_.textContent,n.languages[r],r))})}}});var a=RegExp(n.languages.markup.tag.pattern.source,"gi"),u={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function f(o){var r=o.replace(a,"");return r=r.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,g){if(g=g.toLowerCase(),g[0]==="#"){var y;return g[1]==="x"?y=parseInt(g.slice(2),16):y=Number(g.slice(1)),l(y)}else{var v=u[g];return v||p}}),r}n.languages.md=n.languages.markdown})(Prism);var G={},X;function ue(){return X||(X=1,(function(){if(typeof Prism>"u"||typeof document>"u")return;var n="line-numbers",t=/\n(?!$)/g,s=Prism.plugins.lineNumbers={getLine:function(a,u){if(!(a.tagName!=="PRE"||!a.classList.contains(n))){var l=a.querySelector(".line-numbers-rows");if(l){var f=parseInt(a.getAttribute("data-start"),10)||1,o=f+(l.children.length-1);u<f&&(u=f),u>o&&(u=o);var r=u-f;return l.children[r]}}},resize:function(a){m([a])},assumeViewportIndependence:!0};function m(a){if(a=a.filter(function(l){var f=i(l),o=f["white-space"];return o==="pre-wrap"||o==="pre-line"}),a.length!=0){var u=a.map(function(l){var f=l.querySelector("code"),o=l.querySelector(".line-numbers-rows");if(!(!f||!o)){var r=l.querySelector(".line-numbers-sizer"),p=f.textContent.split(t);r||(r=document.createElement("span"),r.className="line-numbers-sizer",f.appendChild(r)),r.innerHTML="0",r.style.display="block";var g=r.getBoundingClientRect().height;return r.innerHTML="",{element:l,lines:p,lineHeights:[],oneLinerHeight:g,sizer:r}}}).filter(Boolean);u.forEach(function(l){var f=l.sizer,o=l.lines,r=l.lineHeights,p=l.oneLinerHeight;r[o.length-1]=void 0,o.forEach(function(g,y){if(g&&g.length>1){var v=f.appendChild(document.createElement("span"));v.style.display="block",v.textContent=g}else r[y]=p})}),u.forEach(function(l){for(var f=l.sizer,o=l.lineHeights,r=0,p=0;p<o.length;p++)o[p]===void 0&&(o[p]=f.children[r++].getBoundingClientRect().height)}),u.forEach(function(l){var f=l.sizer,o=l.element.querySelector(".line-numbers-rows");f.style.display="none",f.innerHTML="",l.lineHeights.forEach(function(r,p){o.children[p].style.height=r+"px"})})}}function i(a){return a?window.getComputedStyle?getComputedStyle(a):a.currentStyle||null:null}var d=void 0;window.addEventListener("resize",function(){s.assumeViewportIndependence&&d===window.innerWidth||(d=window.innerWidth,m(Array.prototype.slice.call(document.querySelectorAll("pre."+n))))}),Prism.hooks.add("complete",function(a){if(a.code){var u=a.element,l=u.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!u.querySelector(".line-numbers-rows")&&Prism.util.isActive(u,n)){u.classList.remove(n),l.classList.add(n);var f=a.code.match(t),o=f?f.length+1:1,r,p=new Array(o+1).join("<span></span>");r=document.createElement("span"),r.setAttribute("aria-hidden","true"),r.className="line-numbers-rows",r.innerHTML=p,l.hasAttribute("data-start")&&(l.style.counterReset="linenumber "+(parseInt(l.getAttribute("data-start"),10)-1)),a.element.appendChild(r),m([l]),Prism.hooks.run("line-numbers",a)}}}),Prism.hooks.add("line-numbers",function(a){a.plugins=a.plugins||{},a.plugins.lineNumbers=!0})})()),G}ue();function B(n){return n.useTabs?" ":n.hasPadding?" ":""}class ce{padding;constructor(t){this.padding=B(t)}formatCell(t,s,m){const i=m;switch(s){case"right":return`${this.padding}${t.padStart(i)}${this.padding}`;case"center":{const d=i-t.length,a=Math.floor(d/2),u=d-a;return`${this.padding}${" ".repeat(a)}${t}${" ".repeat(u)}${this.padding}`}default:return`${this.padding}${t.padEnd(i)}${this.padding}`}}}class de{static indicators={left:t=>`:${"-".repeat(t-1)}`,right:t=>`${"-".repeat(t-1)}:`,center:t=>`:${"-".repeat(t-2)}:`,none:t=>"-".repeat(t)};static formatIndicator(t,s){return this.indicators[t](s)}}class fe{config;cellFormatter;adjustedAlignments;constructor(t){this.config=t,this.cellFormatter=new ce(t),this.adjustedAlignments=this.getAdjustedAlignments()}getAdjustedAlignments(){return this.config.columnAlignments.length<this.config.columnCount?[...Array.from(this.config.columnAlignments),...Array(this.config.columnCount-this.config.columnAlignments.length).fill("none")]:Array.from(this.config.columnAlignments)}formatRow(t){return`|${Array.from({length:this.config.columnCount},(m,i)=>{let d=t[i]??"";this.config.replaceNewlines&&(d=d.replace(/\n/g,"<br>"));const a=this.adjustedAlignments[i],u=this.config.columnWidths?this.config.columnWidths[i]:d.length;return this.cellFormatter.formatCell(d,a,u)}).join("|")}|`}formatAlignmentRow(){const t=B(this.config);return`|${Array.from({length:this.config.columnCount},(m,i)=>{const d=this.adjustedAlignments[i],a=this.config.columnWidths?this.config.columnWidths[i]:3,u=de.formatIndicator(d,a);return`${t}${u}${t}`}).join("|")}|`}}function pe(n,t){const s=new Array(t).fill(3);return n.forEach(m=>{for(let i=0;i<t;i++){const d=m[i]??"";s[i]=Math.max(s[i],d.length)}}),s}function ge(n){const t=n.inputDataHeader.length,s=n.inputDataBody.map(m=>m.length);return Math.max(t,...s)}function me(n,t,s){return s?pe([n.inputDataHeader,...n.inputDataBody],t):void 0}function he(n,t,s=!0,m=!1,i=!1,d=!0){const a=ge(n),u=me(n,a,s),l={columnCount:a,columnAlignments:t,columnWidths:u,useTabs:m,replaceNewlines:i,hasPadding:d},f=new fe(l),o=f.formatRow(n.inputDataHeader),r=f.formatAlignmentRow(),p=n.inputDataBody.map(g=>f.formatRow(g)).join(`
|
23
|
-
`);return`${o}
|
24
|
-
${r}
|
25
|
-
${p}`.trimEnd()}function be(n){let t="",s=n;for(;s>=0;)t=String.fromCharCode(s%26+65)+t,s=Math.floor(s/26)-1;return t}function we(n){return Array.from({length:n},(t,s)=>be(s))}class A extends Error{constructor(t,s){super(t,s),this.name="MarkdownTableError",Object.setPrototypeOf(this,A.prototype)}}function ye(n){if(n===null||!Array.isArray(n))throw new A("The 'data' prop must be a two-dimensional array.");if(n.length===0)throw new A("The 'data' array must contain at least one row.")}const ve=`
|
26
|
-
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}
|
27
|
-
`,Ee=`
|
28
|
-
code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}
|
29
|
-
`;function _e(n,t){return t?{inputDataHeader:n[0],inputDataBody:n.slice(1)}:{inputDataHeader:we(n[0].length),inputDataBody:n}}function ke(n,t,s,m,i,d,a){try{ye(n);const{inputDataHeader:u,inputDataBody:l}=_e(n,t);return he({inputDataHeader:u,inputDataBody:l},s,m,i,d,a)}catch(u){if(u instanceof A)return`Error: ${u.message}`;throw u}}function Re({inputData:n=null,hasHeader:t=!0,columnAlignments:s=[],isCompact:m=!1,hasTabs:i=!1,hasPadding:d=!0,convertLineBreaks:a=!1,className:u,onGenerate:l,theme:f="light",preStyle:o,topPadding:r=16,minWidth:p,showLineNumbers:g=!0}){const y=x.useRef(null),v=x.useId(),k=x.useDeferredValue(n),[,E]=x.useTransition(),_=x.useMemo(()=>ke(k,t,s,!m,i,a,d),[k,t,s,m,i,a,d]);return x.useEffect(()=>{l&&l(_)},[_,l]),x.useEffect(()=>{const R=y.current?.querySelector("code");R&&_&&E(()=>{requestAnimationFrame(()=>{if(oe.highlightElement(R),!g&&y.current){const N=y.current.querySelector(".line-numbers-rows");N&&N.remove()}})})},[_,E,g]),T.jsxs(T.Fragment,{children:[T.jsxs("style",{children:[f==="light"?ve:Ee,`
|
30
|
-
pre {
|
31
|
-
position: relative;
|
32
|
-
padding-top: ${r}px !important;
|
33
|
-
}
|
34
|
-
pre::before {
|
35
|
-
position: absolute;
|
36
|
-
top: 8px;
|
37
|
-
left: 12px;
|
38
|
-
color: ${f==="light"?"#666":"#999"};
|
39
|
-
letter-spacing: 2px;
|
40
|
-
font-size: 12px;
|
41
|
-
}
|
42
|
-
/* Hide line numbers when showLineNumbers is false */
|
43
|
-
pre:not(.line-numbers) .line-numbers-rows {
|
44
|
-
display: none !important;
|
45
|
-
}
|
46
|
-
/* Remove left padding when line numbers are hidden */
|
47
|
-
pre:not(.line-numbers) {
|
48
|
-
padding-left: 1em !important;
|
49
|
-
}
|
50
|
-
pre:not(.line-numbers) > code {
|
51
|
-
padding-left: 0 !important;
|
52
|
-
}
|
53
|
-
`]}),T.jsx("div",{id:v,style:{position:"relative",isolation:"isolate",display:"inline-block"},children:T.jsx("pre",{ref:y,className:`${u} language-markdown ${g?"line-numbers":""} ${f==="dark"?"dark-theme":""}`,style:{width:"fit-content",minWidth:p?`${p}px`:"min-content",margin:0,...o},children:T.jsx("code",{className:"language-markdown",role:"code",children:_})})})]})}exports.MarkdownTable=Re;exports.MarkdownTableError=A;
|
package/dist/index.d.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview Main MarkdownTable component that generates and displays markdown
|
3
|
-
* table syntax with Prism.js syntax highlighting.
|
4
|
-
*/
|
5
|
-
import 'prismjs/components/prism-markdown';
|
6
|
-
import 'prismjs/plugins/line-numbers/prism-line-numbers';
|
7
|
-
import type { MarkdownTableProps } from './types';
|
8
|
-
export type { Alignment, MarkdownTableProps, InputData, TableConfig } from './types';
|
9
|
-
export { MarkdownTableError } from './validation';
|
10
|
-
export declare function MarkdownTable({ inputData, hasHeader, columnAlignments, isCompact, hasTabs, hasPadding, convertLineBreaks, className, onGenerate, theme, preStyle, topPadding, minWidth, showLineNumbers, }: MarkdownTableProps): import("react/jsx-runtime").JSX.Element;
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7D,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA6ClD,wBAAgB,aAAa,CAAC,EAC5B,SAAgB,EAChB,SAAgB,EAChB,gBAAqB,EACrB,SAAiB,EACjB,OAAe,EACf,UAAiB,EACjB,iBAAyB,EACzB,SAAS,EACT,UAAU,EACV,KAAe,EACf,QAAQ,EACR,UAAe,EACf,QAAQ,EACR,eAAsB,GACvB,EAAE,kBAAkB,2CAwGpB"}
|
package/dist/index.mjs
DELETED
@@ -1,940 +0,0 @@
|
|
1
|
-
import oe, { useRef as ie, useId as se, useDeferredValue as le, useTransition as ue, useMemo as ce, useEffect as D } from "react";
|
2
|
-
import de from "prismjs";
|
3
|
-
var j = { exports: {} }, A = {};
|
4
|
-
/**
|
5
|
-
* @license React
|
6
|
-
* react-jsx-runtime.production.js
|
7
|
-
*
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
9
|
-
*
|
10
|
-
* This source code is licensed under the MIT license found in the
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
12
|
-
*/
|
13
|
-
var U;
|
14
|
-
function fe() {
|
15
|
-
if (U) return A;
|
16
|
-
U = 1;
|
17
|
-
var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
18
|
-
function s(m, i, d) {
|
19
|
-
var a = null;
|
20
|
-
if (d !== void 0 && (a = "" + d), i.key !== void 0 && (a = "" + i.key), "key" in i) {
|
21
|
-
d = {};
|
22
|
-
for (var u in i)
|
23
|
-
u !== "key" && (d[u] = i[u]);
|
24
|
-
} else d = i;
|
25
|
-
return i = d.ref, {
|
26
|
-
$$typeof: n,
|
27
|
-
type: m,
|
28
|
-
key: a,
|
29
|
-
ref: i !== void 0 ? i : null,
|
30
|
-
props: d
|
31
|
-
};
|
32
|
-
}
|
33
|
-
return A.Fragment = t, A.jsx = s, A.jsxs = s, A;
|
34
|
-
}
|
35
|
-
var T = {};
|
36
|
-
/**
|
37
|
-
* @license React
|
38
|
-
* react-jsx-runtime.development.js
|
39
|
-
*
|
40
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
41
|
-
*
|
42
|
-
* This source code is licensed under the MIT license found in the
|
43
|
-
* LICENSE file in the root directory of this source tree.
|
44
|
-
*/
|
45
|
-
var V;
|
46
|
-
function pe() {
|
47
|
-
return V || (V = 1, process.env.NODE_ENV !== "production" && (function() {
|
48
|
-
function n(e) {
|
49
|
-
if (e == null) return null;
|
50
|
-
if (typeof e == "function")
|
51
|
-
return e.$$typeof === te ? null : e.displayName || e.name || null;
|
52
|
-
if (typeof e == "string") return e;
|
53
|
-
switch (e) {
|
54
|
-
case k:
|
55
|
-
return "Fragment";
|
56
|
-
case _:
|
57
|
-
return "Profiler";
|
58
|
-
case E:
|
59
|
-
return "StrictMode";
|
60
|
-
case Q:
|
61
|
-
return "Suspense";
|
62
|
-
case K:
|
63
|
-
return "SuspenseList";
|
64
|
-
case ne:
|
65
|
-
return "Activity";
|
66
|
-
}
|
67
|
-
if (typeof e == "object")
|
68
|
-
switch (typeof e.tag == "number" && console.error(
|
69
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
70
|
-
), e.$$typeof) {
|
71
|
-
case y:
|
72
|
-
return "Portal";
|
73
|
-
case $:
|
74
|
-
return e.displayName || "Context";
|
75
|
-
case R:
|
76
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
77
|
-
case Z:
|
78
|
-
var c = e.render;
|
79
|
-
return e = e.displayName, e || (e = c.displayName || c.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
80
|
-
case ee:
|
81
|
-
return c = e.displayName || null, c !== null ? c : n(e.type) || "Memo";
|
82
|
-
case O:
|
83
|
-
c = e._payload, e = e._init;
|
84
|
-
try {
|
85
|
-
return n(e(c));
|
86
|
-
} catch {
|
87
|
-
}
|
88
|
-
}
|
89
|
-
return null;
|
90
|
-
}
|
91
|
-
function t(e) {
|
92
|
-
return "" + e;
|
93
|
-
}
|
94
|
-
function s(e) {
|
95
|
-
try {
|
96
|
-
t(e);
|
97
|
-
var c = !1;
|
98
|
-
} catch {
|
99
|
-
c = !0;
|
100
|
-
}
|
101
|
-
if (c) {
|
102
|
-
c = console;
|
103
|
-
var h = c.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
104
|
-
return h.call(
|
105
|
-
c,
|
106
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
107
|
-
b
|
108
|
-
), t(e);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
function m(e) {
|
112
|
-
if (e === k) return "<>";
|
113
|
-
if (typeof e == "object" && e !== null && e.$$typeof === O)
|
114
|
-
return "<...>";
|
115
|
-
try {
|
116
|
-
var c = n(e);
|
117
|
-
return c ? "<" + c + ">" : "<...>";
|
118
|
-
} catch {
|
119
|
-
return "<...>";
|
120
|
-
}
|
121
|
-
}
|
122
|
-
function i() {
|
123
|
-
var e = z.A;
|
124
|
-
return e === null ? null : e.getOwner();
|
125
|
-
}
|
126
|
-
function d() {
|
127
|
-
return Error("react-stack-top-frame");
|
128
|
-
}
|
129
|
-
function a(e) {
|
130
|
-
if (L.call(e, "key")) {
|
131
|
-
var c = Object.getOwnPropertyDescriptor(e, "key").get;
|
132
|
-
if (c && c.isReactWarning) return !1;
|
133
|
-
}
|
134
|
-
return e.key !== void 0;
|
135
|
-
}
|
136
|
-
function u(e, c) {
|
137
|
-
function h() {
|
138
|
-
H || (H = !0, console.error(
|
139
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
140
|
-
c
|
141
|
-
));
|
142
|
-
}
|
143
|
-
h.isReactWarning = !0, Object.defineProperty(e, "key", {
|
144
|
-
get: h,
|
145
|
-
configurable: !0
|
146
|
-
});
|
147
|
-
}
|
148
|
-
function l() {
|
149
|
-
var e = n(this.type);
|
150
|
-
return W[e] || (W[e] = !0, console.error(
|
151
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
152
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
153
|
-
}
|
154
|
-
function f(e, c, h, b, N, M) {
|
155
|
-
var w = h.ref;
|
156
|
-
return e = {
|
157
|
-
$$typeof: v,
|
158
|
-
type: e,
|
159
|
-
key: c,
|
160
|
-
props: h,
|
161
|
-
_owner: b
|
162
|
-
}, (w !== void 0 ? w : null) !== null ? Object.defineProperty(e, "ref", {
|
163
|
-
enumerable: !1,
|
164
|
-
get: l
|
165
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
166
|
-
configurable: !1,
|
167
|
-
enumerable: !1,
|
168
|
-
writable: !0,
|
169
|
-
value: 0
|
170
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
171
|
-
configurable: !1,
|
172
|
-
enumerable: !1,
|
173
|
-
writable: !0,
|
174
|
-
value: null
|
175
|
-
}), Object.defineProperty(e, "_debugStack", {
|
176
|
-
configurable: !1,
|
177
|
-
enumerable: !1,
|
178
|
-
writable: !0,
|
179
|
-
value: N
|
180
|
-
}), Object.defineProperty(e, "_debugTask", {
|
181
|
-
configurable: !1,
|
182
|
-
enumerable: !1,
|
183
|
-
writable: !0,
|
184
|
-
value: M
|
185
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
186
|
-
}
|
187
|
-
function o(e, c, h, b, N, M) {
|
188
|
-
var w = c.children;
|
189
|
-
if (w !== void 0)
|
190
|
-
if (b)
|
191
|
-
if (re(w)) {
|
192
|
-
for (b = 0; b < w.length; b++)
|
193
|
-
r(w[b]);
|
194
|
-
Object.freeze && Object.freeze(w);
|
195
|
-
} else
|
196
|
-
console.error(
|
197
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
198
|
-
);
|
199
|
-
else r(w);
|
200
|
-
if (L.call(c, "key")) {
|
201
|
-
w = n(e);
|
202
|
-
var x = Object.keys(c).filter(function(ae) {
|
203
|
-
return ae !== "key";
|
204
|
-
});
|
205
|
-
b = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", Y[w + b] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
206
|
-
`A props object containing a "key" prop is being spread into JSX:
|
207
|
-
let props = %s;
|
208
|
-
<%s {...props} />
|
209
|
-
React keys must be passed directly to JSX without using spread:
|
210
|
-
let props = %s;
|
211
|
-
<%s key={someKey} {...props} />`,
|
212
|
-
b,
|
213
|
-
w,
|
214
|
-
x,
|
215
|
-
w
|
216
|
-
), Y[w + b] = !0);
|
217
|
-
}
|
218
|
-
if (w = null, h !== void 0 && (s(h), w = "" + h), a(c) && (s(c.key), w = "" + c.key), "key" in c) {
|
219
|
-
h = {};
|
220
|
-
for (var I in c)
|
221
|
-
I !== "key" && (h[I] = c[I]);
|
222
|
-
} else h = c;
|
223
|
-
return w && u(
|
224
|
-
h,
|
225
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
226
|
-
), f(
|
227
|
-
e,
|
228
|
-
w,
|
229
|
-
h,
|
230
|
-
i(),
|
231
|
-
N,
|
232
|
-
M
|
233
|
-
);
|
234
|
-
}
|
235
|
-
function r(e) {
|
236
|
-
p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
237
|
-
}
|
238
|
-
function p(e) {
|
239
|
-
return typeof e == "object" && e !== null && e.$$typeof === v;
|
240
|
-
}
|
241
|
-
var g = oe, v = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), R = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), Z = Symbol.for("react.forward_ref"), Q = Symbol.for("react.suspense"), K = Symbol.for("react.suspense_list"), ee = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), te = Symbol.for("react.client.reference"), z = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, re = Array.isArray, P = console.createTask ? console.createTask : function() {
|
242
|
-
return null;
|
243
|
-
};
|
244
|
-
g = {
|
245
|
-
react_stack_bottom_frame: function(e) {
|
246
|
-
return e();
|
247
|
-
}
|
248
|
-
};
|
249
|
-
var H, W = {}, F = g.react_stack_bottom_frame.bind(
|
250
|
-
g,
|
251
|
-
d
|
252
|
-
)(), q = P(m(d)), Y = {};
|
253
|
-
T.Fragment = k, T.jsx = function(e, c, h) {
|
254
|
-
var b = 1e4 > z.recentlyCreatedOwnerStacks++;
|
255
|
-
return o(
|
256
|
-
e,
|
257
|
-
c,
|
258
|
-
h,
|
259
|
-
!1,
|
260
|
-
b ? Error("react-stack-top-frame") : F,
|
261
|
-
b ? P(m(e)) : q
|
262
|
-
);
|
263
|
-
}, T.jsxs = function(e, c, h) {
|
264
|
-
var b = 1e4 > z.recentlyCreatedOwnerStacks++;
|
265
|
-
return o(
|
266
|
-
e,
|
267
|
-
c,
|
268
|
-
h,
|
269
|
-
!0,
|
270
|
-
b ? Error("react-stack-top-frame") : F,
|
271
|
-
b ? P(m(e)) : q
|
272
|
-
);
|
273
|
-
};
|
274
|
-
})()), T;
|
275
|
-
}
|
276
|
-
var J;
|
277
|
-
function ge() {
|
278
|
-
return J || (J = 1, process.env.NODE_ENV === "production" ? j.exports = fe() : j.exports = pe()), j.exports;
|
279
|
-
}
|
280
|
-
var S = ge();
|
281
|
-
(function(n) {
|
282
|
-
var t = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
|
283
|
-
function s(o) {
|
284
|
-
return o = o.replace(/<inner>/g, function() {
|
285
|
-
return t;
|
286
|
-
}), RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + o + ")");
|
287
|
-
}
|
288
|
-
var m = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source, i = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function() {
|
289
|
-
return m;
|
290
|
-
}), d = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
|
291
|
-
n.languages.markdown = n.languages.extend("markup", {}), n.languages.insertBefore("markdown", "prolog", {
|
292
|
-
"front-matter-block": {
|
293
|
-
pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
|
294
|
-
lookbehind: !0,
|
295
|
-
greedy: !0,
|
296
|
-
inside: {
|
297
|
-
punctuation: /^---|---$/,
|
298
|
-
"front-matter": {
|
299
|
-
pattern: /\S+(?:\s+\S+)*/,
|
300
|
-
alias: ["yaml", "language-yaml"],
|
301
|
-
inside: n.languages.yaml
|
302
|
-
}
|
303
|
-
}
|
304
|
-
},
|
305
|
-
blockquote: {
|
306
|
-
// > ...
|
307
|
-
pattern: /^>(?:[\t ]*>)*/m,
|
308
|
-
alias: "punctuation"
|
309
|
-
},
|
310
|
-
table: {
|
311
|
-
pattern: RegExp("^" + i + d + "(?:" + i + ")*", "m"),
|
312
|
-
inside: {
|
313
|
-
"table-data-rows": {
|
314
|
-
pattern: RegExp("^(" + i + d + ")(?:" + i + ")*$"),
|
315
|
-
lookbehind: !0,
|
316
|
-
inside: {
|
317
|
-
"table-data": {
|
318
|
-
pattern: RegExp(m),
|
319
|
-
inside: n.languages.markdown
|
320
|
-
},
|
321
|
-
punctuation: /\|/
|
322
|
-
}
|
323
|
-
},
|
324
|
-
"table-line": {
|
325
|
-
pattern: RegExp("^(" + i + ")" + d + "$"),
|
326
|
-
lookbehind: !0,
|
327
|
-
inside: {
|
328
|
-
punctuation: /\||:?-{3,}:?/
|
329
|
-
}
|
330
|
-
},
|
331
|
-
"table-header-row": {
|
332
|
-
pattern: RegExp("^" + i + "$"),
|
333
|
-
inside: {
|
334
|
-
"table-header": {
|
335
|
-
pattern: RegExp(m),
|
336
|
-
alias: "important",
|
337
|
-
inside: n.languages.markdown
|
338
|
-
},
|
339
|
-
punctuation: /\|/
|
340
|
-
}
|
341
|
-
}
|
342
|
-
}
|
343
|
-
},
|
344
|
-
code: [
|
345
|
-
{
|
346
|
-
// Prefixed by 4 spaces or 1 tab and preceded by an empty line
|
347
|
-
pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
|
348
|
-
lookbehind: !0,
|
349
|
-
alias: "keyword"
|
350
|
-
},
|
351
|
-
{
|
352
|
-
// ```optional language
|
353
|
-
// code block
|
354
|
-
// ```
|
355
|
-
pattern: /^```[\s\S]*?^```$/m,
|
356
|
-
greedy: !0,
|
357
|
-
inside: {
|
358
|
-
"code-block": {
|
359
|
-
pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
|
360
|
-
lookbehind: !0
|
361
|
-
},
|
362
|
-
"code-language": {
|
363
|
-
pattern: /^(```).+/,
|
364
|
-
lookbehind: !0
|
365
|
-
},
|
366
|
-
punctuation: /```/
|
367
|
-
}
|
368
|
-
}
|
369
|
-
],
|
370
|
-
title: [
|
371
|
-
{
|
372
|
-
// title 1
|
373
|
-
// =======
|
374
|
-
// title 2
|
375
|
-
// -------
|
376
|
-
pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
|
377
|
-
alias: "important",
|
378
|
-
inside: {
|
379
|
-
punctuation: /==+$|--+$/
|
380
|
-
}
|
381
|
-
},
|
382
|
-
{
|
383
|
-
// # title 1
|
384
|
-
// ###### title 6
|
385
|
-
pattern: /(^\s*)#.+/m,
|
386
|
-
lookbehind: !0,
|
387
|
-
alias: "important",
|
388
|
-
inside: {
|
389
|
-
punctuation: /^#+|#+$/
|
390
|
-
}
|
391
|
-
}
|
392
|
-
],
|
393
|
-
hr: {
|
394
|
-
// ***
|
395
|
-
// ---
|
396
|
-
// * * *
|
397
|
-
// -----------
|
398
|
-
pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
|
399
|
-
lookbehind: !0,
|
400
|
-
alias: "punctuation"
|
401
|
-
},
|
402
|
-
list: {
|
403
|
-
// * item
|
404
|
-
// + item
|
405
|
-
// - item
|
406
|
-
// 1. item
|
407
|
-
pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
|
408
|
-
lookbehind: !0,
|
409
|
-
alias: "punctuation"
|
410
|
-
},
|
411
|
-
"url-reference": {
|
412
|
-
// [id]: http://example.com "Optional title"
|
413
|
-
// [id]: http://example.com 'Optional title'
|
414
|
-
// [id]: http://example.com (Optional title)
|
415
|
-
// [id]: <http://example.com> "Optional title"
|
416
|
-
pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
|
417
|
-
inside: {
|
418
|
-
variable: {
|
419
|
-
pattern: /^(!?\[)[^\]]+/,
|
420
|
-
lookbehind: !0
|
421
|
-
},
|
422
|
-
string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
|
423
|
-
punctuation: /^[\[\]!:]|[<>]/
|
424
|
-
},
|
425
|
-
alias: "url"
|
426
|
-
},
|
427
|
-
bold: {
|
428
|
-
// **strong**
|
429
|
-
// __strong__
|
430
|
-
// allow one nested instance of italic text using the same delimiter
|
431
|
-
pattern: s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
|
432
|
-
lookbehind: !0,
|
433
|
-
greedy: !0,
|
434
|
-
inside: {
|
435
|
-
content: {
|
436
|
-
pattern: /(^..)[\s\S]+(?=..$)/,
|
437
|
-
lookbehind: !0,
|
438
|
-
inside: {}
|
439
|
-
// see below
|
440
|
-
},
|
441
|
-
punctuation: /\*\*|__/
|
442
|
-
}
|
443
|
-
},
|
444
|
-
italic: {
|
445
|
-
// *em*
|
446
|
-
// _em_
|
447
|
-
// allow one nested instance of bold text using the same delimiter
|
448
|
-
pattern: s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
|
449
|
-
lookbehind: !0,
|
450
|
-
greedy: !0,
|
451
|
-
inside: {
|
452
|
-
content: {
|
453
|
-
pattern: /(^.)[\s\S]+(?=.$)/,
|
454
|
-
lookbehind: !0,
|
455
|
-
inside: {}
|
456
|
-
// see below
|
457
|
-
},
|
458
|
-
punctuation: /[*_]/
|
459
|
-
}
|
460
|
-
},
|
461
|
-
strike: {
|
462
|
-
// ~~strike through~~
|
463
|
-
// ~strike~
|
464
|
-
// eslint-disable-next-line regexp/strict
|
465
|
-
pattern: s(/(~~?)(?:(?!~)<inner>)+\2/.source),
|
466
|
-
lookbehind: !0,
|
467
|
-
greedy: !0,
|
468
|
-
inside: {
|
469
|
-
content: {
|
470
|
-
pattern: /(^~~?)[\s\S]+(?=\1$)/,
|
471
|
-
lookbehind: !0,
|
472
|
-
inside: {}
|
473
|
-
// see below
|
474
|
-
},
|
475
|
-
punctuation: /~~?/
|
476
|
-
}
|
477
|
-
},
|
478
|
-
"code-snippet": {
|
479
|
-
// `code`
|
480
|
-
// ``code``
|
481
|
-
pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
|
482
|
-
lookbehind: !0,
|
483
|
-
greedy: !0,
|
484
|
-
alias: ["code", "keyword"]
|
485
|
-
},
|
486
|
-
url: {
|
487
|
-
// [example](http://example.com "Optional title")
|
488
|
-
// [example][id]
|
489
|
-
// [example] [id]
|
490
|
-
pattern: s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
|
491
|
-
lookbehind: !0,
|
492
|
-
greedy: !0,
|
493
|
-
inside: {
|
494
|
-
operator: /^!/,
|
495
|
-
content: {
|
496
|
-
pattern: /(^\[)[^\]]+(?=\])/,
|
497
|
-
lookbehind: !0,
|
498
|
-
inside: {}
|
499
|
-
// see below
|
500
|
-
},
|
501
|
-
variable: {
|
502
|
-
pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
|
503
|
-
lookbehind: !0
|
504
|
-
},
|
505
|
-
url: {
|
506
|
-
pattern: /(^\]\()[^\s)]+/,
|
507
|
-
lookbehind: !0
|
508
|
-
},
|
509
|
-
string: {
|
510
|
-
pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
|
511
|
-
lookbehind: !0
|
512
|
-
}
|
513
|
-
}
|
514
|
-
}
|
515
|
-
}), ["url", "bold", "italic", "strike"].forEach(function(o) {
|
516
|
-
["url", "bold", "italic", "strike", "code-snippet"].forEach(function(r) {
|
517
|
-
o !== r && (n.languages.markdown[o].inside.content.inside[r] = n.languages.markdown[r]);
|
518
|
-
});
|
519
|
-
}), n.hooks.add("after-tokenize", function(o) {
|
520
|
-
if (o.language !== "markdown" && o.language !== "md")
|
521
|
-
return;
|
522
|
-
function r(p) {
|
523
|
-
if (!(!p || typeof p == "string"))
|
524
|
-
for (var g = 0, v = p.length; g < v; g++) {
|
525
|
-
var y = p[g];
|
526
|
-
if (y.type !== "code") {
|
527
|
-
r(y.content);
|
528
|
-
continue;
|
529
|
-
}
|
530
|
-
var k = y.content[1], E = y.content[3];
|
531
|
-
if (k && E && k.type === "code-language" && E.type === "code-block" && typeof k.content == "string") {
|
532
|
-
var _ = k.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
|
533
|
-
_ = (/[a-z][\w-]*/i.exec(_) || [""])[0].toLowerCase();
|
534
|
-
var R = "language-" + _;
|
535
|
-
E.alias ? typeof E.alias == "string" ? E.alias = [E.alias, R] : E.alias.push(R) : E.alias = [R];
|
536
|
-
}
|
537
|
-
}
|
538
|
-
}
|
539
|
-
r(o.tokens);
|
540
|
-
}), n.hooks.add("wrap", function(o) {
|
541
|
-
if (o.type === "code-block") {
|
542
|
-
for (var r = "", p = 0, g = o.classes.length; p < g; p++) {
|
543
|
-
var v = o.classes[p], y = /language-(.+)/.exec(v);
|
544
|
-
if (y) {
|
545
|
-
r = y[1];
|
546
|
-
break;
|
547
|
-
}
|
548
|
-
}
|
549
|
-
var k = n.languages[r];
|
550
|
-
if (k)
|
551
|
-
o.content = n.highlight(f(o.content), k, r);
|
552
|
-
else if (r && r !== "none" && n.plugins.autoloader) {
|
553
|
-
var E = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
|
554
|
-
o.attributes.id = E, n.plugins.autoloader.loadLanguages(r, function() {
|
555
|
-
var _ = document.getElementById(E);
|
556
|
-
_ && (_.innerHTML = n.highlight(_.textContent, n.languages[r], r));
|
557
|
-
});
|
558
|
-
}
|
559
|
-
}
|
560
|
-
});
|
561
|
-
var a = RegExp(n.languages.markup.tag.pattern.source, "gi"), u = {
|
562
|
-
amp: "&",
|
563
|
-
lt: "<",
|
564
|
-
gt: ">",
|
565
|
-
quot: '"'
|
566
|
-
}, l = String.fromCodePoint || String.fromCharCode;
|
567
|
-
function f(o) {
|
568
|
-
var r = o.replace(a, "");
|
569
|
-
return r = r.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(p, g) {
|
570
|
-
if (g = g.toLowerCase(), g[0] === "#") {
|
571
|
-
var v;
|
572
|
-
return g[1] === "x" ? v = parseInt(g.slice(2), 16) : v = Number(g.slice(1)), l(v);
|
573
|
-
} else {
|
574
|
-
var y = u[g];
|
575
|
-
return y || p;
|
576
|
-
}
|
577
|
-
}), r;
|
578
|
-
}
|
579
|
-
n.languages.md = n.languages.markdown;
|
580
|
-
})(Prism);
|
581
|
-
var G = {}, X;
|
582
|
-
function me() {
|
583
|
-
return X || (X = 1, (function() {
|
584
|
-
if (typeof Prism > "u" || typeof document > "u")
|
585
|
-
return;
|
586
|
-
var n = "line-numbers", t = /\n(?!$)/g, s = Prism.plugins.lineNumbers = {
|
587
|
-
/**
|
588
|
-
* Get node for provided line number
|
589
|
-
*
|
590
|
-
* @param {Element} element pre element
|
591
|
-
* @param {number} number line number
|
592
|
-
* @returns {Element|undefined}
|
593
|
-
*/
|
594
|
-
getLine: function(a, u) {
|
595
|
-
if (!(a.tagName !== "PRE" || !a.classList.contains(n))) {
|
596
|
-
var l = a.querySelector(".line-numbers-rows");
|
597
|
-
if (l) {
|
598
|
-
var f = parseInt(a.getAttribute("data-start"), 10) || 1, o = f + (l.children.length - 1);
|
599
|
-
u < f && (u = f), u > o && (u = o);
|
600
|
-
var r = u - f;
|
601
|
-
return l.children[r];
|
602
|
-
}
|
603
|
-
}
|
604
|
-
},
|
605
|
-
/**
|
606
|
-
* Resizes the line numbers of the given element.
|
607
|
-
*
|
608
|
-
* This function will not add line numbers. It will only resize existing ones.
|
609
|
-
*
|
610
|
-
* @param {HTMLElement} element A `<pre>` element with line numbers.
|
611
|
-
* @returns {void}
|
612
|
-
*/
|
613
|
-
resize: function(a) {
|
614
|
-
m([a]);
|
615
|
-
},
|
616
|
-
/**
|
617
|
-
* Whether the plugin can assume that the units font sizes and margins are not depended on the size of
|
618
|
-
* the current viewport.
|
619
|
-
*
|
620
|
-
* Setting this to `true` will allow the plugin to do certain optimizations for better performance.
|
621
|
-
*
|
622
|
-
* Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
|
623
|
-
*
|
624
|
-
* @type {boolean}
|
625
|
-
*/
|
626
|
-
assumeViewportIndependence: !0
|
627
|
-
};
|
628
|
-
function m(a) {
|
629
|
-
if (a = a.filter(function(l) {
|
630
|
-
var f = i(l), o = f["white-space"];
|
631
|
-
return o === "pre-wrap" || o === "pre-line";
|
632
|
-
}), a.length != 0) {
|
633
|
-
var u = a.map(function(l) {
|
634
|
-
var f = l.querySelector("code"), o = l.querySelector(".line-numbers-rows");
|
635
|
-
if (!(!f || !o)) {
|
636
|
-
var r = l.querySelector(".line-numbers-sizer"), p = f.textContent.split(t);
|
637
|
-
r || (r = document.createElement("span"), r.className = "line-numbers-sizer", f.appendChild(r)), r.innerHTML = "0", r.style.display = "block";
|
638
|
-
var g = r.getBoundingClientRect().height;
|
639
|
-
return r.innerHTML = "", {
|
640
|
-
element: l,
|
641
|
-
lines: p,
|
642
|
-
lineHeights: [],
|
643
|
-
oneLinerHeight: g,
|
644
|
-
sizer: r
|
645
|
-
};
|
646
|
-
}
|
647
|
-
}).filter(Boolean);
|
648
|
-
u.forEach(function(l) {
|
649
|
-
var f = l.sizer, o = l.lines, r = l.lineHeights, p = l.oneLinerHeight;
|
650
|
-
r[o.length - 1] = void 0, o.forEach(function(g, v) {
|
651
|
-
if (g && g.length > 1) {
|
652
|
-
var y = f.appendChild(document.createElement("span"));
|
653
|
-
y.style.display = "block", y.textContent = g;
|
654
|
-
} else
|
655
|
-
r[v] = p;
|
656
|
-
});
|
657
|
-
}), u.forEach(function(l) {
|
658
|
-
for (var f = l.sizer, o = l.lineHeights, r = 0, p = 0; p < o.length; p++)
|
659
|
-
o[p] === void 0 && (o[p] = f.children[r++].getBoundingClientRect().height);
|
660
|
-
}), u.forEach(function(l) {
|
661
|
-
var f = l.sizer, o = l.element.querySelector(".line-numbers-rows");
|
662
|
-
f.style.display = "none", f.innerHTML = "", l.lineHeights.forEach(function(r, p) {
|
663
|
-
o.children[p].style.height = r + "px";
|
664
|
-
});
|
665
|
-
});
|
666
|
-
}
|
667
|
-
}
|
668
|
-
function i(a) {
|
669
|
-
return a ? window.getComputedStyle ? getComputedStyle(a) : a.currentStyle || null : null;
|
670
|
-
}
|
671
|
-
var d = void 0;
|
672
|
-
window.addEventListener("resize", function() {
|
673
|
-
s.assumeViewportIndependence && d === window.innerWidth || (d = window.innerWidth, m(Array.prototype.slice.call(document.querySelectorAll("pre." + n))));
|
674
|
-
}), Prism.hooks.add("complete", function(a) {
|
675
|
-
if (a.code) {
|
676
|
-
var u = (
|
677
|
-
/** @type {Element} */
|
678
|
-
a.element
|
679
|
-
), l = (
|
680
|
-
/** @type {HTMLElement} */
|
681
|
-
u.parentNode
|
682
|
-
);
|
683
|
-
if (!(!l || !/pre/i.test(l.nodeName)) && !u.querySelector(".line-numbers-rows") && Prism.util.isActive(u, n)) {
|
684
|
-
u.classList.remove(n), l.classList.add(n);
|
685
|
-
var f = a.code.match(t), o = f ? f.length + 1 : 1, r, p = new Array(o + 1).join("<span></span>");
|
686
|
-
r = document.createElement("span"), r.setAttribute("aria-hidden", "true"), r.className = "line-numbers-rows", r.innerHTML = p, l.hasAttribute("data-start") && (l.style.counterReset = "linenumber " + (parseInt(l.getAttribute("data-start"), 10) - 1)), a.element.appendChild(r), m([l]), Prism.hooks.run("line-numbers", a);
|
687
|
-
}
|
688
|
-
}
|
689
|
-
}), Prism.hooks.add("line-numbers", function(a) {
|
690
|
-
a.plugins = a.plugins || {}, a.plugins.lineNumbers = !0;
|
691
|
-
});
|
692
|
-
})()), G;
|
693
|
-
}
|
694
|
-
me();
|
695
|
-
function B(n) {
|
696
|
-
return n.useTabs ? " " : n.hasPadding ? " " : "";
|
697
|
-
}
|
698
|
-
class he {
|
699
|
-
padding;
|
700
|
-
constructor(t) {
|
701
|
-
this.padding = B(t);
|
702
|
-
}
|
703
|
-
formatCell(t, s, m) {
|
704
|
-
const i = m;
|
705
|
-
switch (s) {
|
706
|
-
case "right":
|
707
|
-
return `${this.padding}${t.padStart(i)}${this.padding}`;
|
708
|
-
case "center": {
|
709
|
-
const d = i - t.length, a = Math.floor(d / 2), u = d - a;
|
710
|
-
return `${this.padding}${" ".repeat(a)}${t}${" ".repeat(u)}${this.padding}`;
|
711
|
-
}
|
712
|
-
default:
|
713
|
-
return `${this.padding}${t.padEnd(i)}${this.padding}`;
|
714
|
-
}
|
715
|
-
}
|
716
|
-
}
|
717
|
-
class be {
|
718
|
-
static indicators = {
|
719
|
-
left: (t) => `:${"-".repeat(t - 1)}`,
|
720
|
-
right: (t) => `${"-".repeat(t - 1)}:`,
|
721
|
-
center: (t) => `:${"-".repeat(t - 2)}:`,
|
722
|
-
none: (t) => "-".repeat(t)
|
723
|
-
};
|
724
|
-
static formatIndicator(t, s) {
|
725
|
-
return this.indicators[t](s);
|
726
|
-
}
|
727
|
-
}
|
728
|
-
class we {
|
729
|
-
config;
|
730
|
-
cellFormatter;
|
731
|
-
adjustedAlignments;
|
732
|
-
constructor(t) {
|
733
|
-
this.config = t, this.cellFormatter = new he(t), this.adjustedAlignments = this.getAdjustedAlignments();
|
734
|
-
}
|
735
|
-
getAdjustedAlignments() {
|
736
|
-
return this.config.columnAlignments.length < this.config.columnCount ? [
|
737
|
-
...Array.from(this.config.columnAlignments),
|
738
|
-
...Array(this.config.columnCount - this.config.columnAlignments.length).fill("none")
|
739
|
-
] : Array.from(this.config.columnAlignments);
|
740
|
-
}
|
741
|
-
formatRow(t) {
|
742
|
-
return `|${Array.from({ length: this.config.columnCount }, (m, i) => {
|
743
|
-
let d = t[i] ?? "";
|
744
|
-
this.config.replaceNewlines && (d = d.replace(/\n/g, "<br>"));
|
745
|
-
const a = this.adjustedAlignments[i], u = this.config.columnWidths ? this.config.columnWidths[i] : d.length;
|
746
|
-
return this.cellFormatter.formatCell(d, a, u);
|
747
|
-
}).join("|")}|`;
|
748
|
-
}
|
749
|
-
formatAlignmentRow() {
|
750
|
-
const t = B(this.config);
|
751
|
-
return `|${Array.from({ length: this.config.columnCount }, (m, i) => {
|
752
|
-
const d = this.adjustedAlignments[i], a = this.config.columnWidths ? this.config.columnWidths[i] : 3, u = be.formatIndicator(d, a);
|
753
|
-
return `${t}${u}${t}`;
|
754
|
-
}).join("|")}|`;
|
755
|
-
}
|
756
|
-
}
|
757
|
-
function ve(n, t) {
|
758
|
-
const s = new Array(t).fill(3);
|
759
|
-
return n.forEach((m) => {
|
760
|
-
for (let i = 0; i < t; i++) {
|
761
|
-
const d = m[i] ?? "";
|
762
|
-
s[i] = Math.max(s[i], d.length);
|
763
|
-
}
|
764
|
-
}), s;
|
765
|
-
}
|
766
|
-
function ye(n) {
|
767
|
-
const t = n.inputDataHeader.length, s = n.inputDataBody.map((m) => m.length);
|
768
|
-
return Math.max(t, ...s);
|
769
|
-
}
|
770
|
-
function Ee(n, t, s) {
|
771
|
-
return s ? ve(
|
772
|
-
[n.inputDataHeader, ...n.inputDataBody],
|
773
|
-
t
|
774
|
-
) : void 0;
|
775
|
-
}
|
776
|
-
function _e(n, t, s = !0, m = !1, i = !1, d = !0) {
|
777
|
-
const a = ye(n), u = Ee(n, a, s), l = {
|
778
|
-
columnCount: a,
|
779
|
-
columnAlignments: t,
|
780
|
-
columnWidths: u,
|
781
|
-
useTabs: m,
|
782
|
-
replaceNewlines: i,
|
783
|
-
hasPadding: d
|
784
|
-
}, f = new we(l), o = f.formatRow(n.inputDataHeader), r = f.formatAlignmentRow(), p = n.inputDataBody.map((g) => f.formatRow(g)).join(`
|
785
|
-
`);
|
786
|
-
return `${o}
|
787
|
-
${r}
|
788
|
-
${p}`.trimEnd();
|
789
|
-
}
|
790
|
-
function ke(n) {
|
791
|
-
let t = "", s = n;
|
792
|
-
for (; s >= 0; )
|
793
|
-
t = String.fromCharCode(s % 26 + 65) + t, s = Math.floor(s / 26) - 1;
|
794
|
-
return t;
|
795
|
-
}
|
796
|
-
function Re(n) {
|
797
|
-
return Array.from({ length: n }, (t, s) => ke(s));
|
798
|
-
}
|
799
|
-
class C extends Error {
|
800
|
-
constructor(t, s) {
|
801
|
-
super(t, s), this.name = "MarkdownTableError", Object.setPrototypeOf(this, C.prototype);
|
802
|
-
}
|
803
|
-
}
|
804
|
-
function xe(n) {
|
805
|
-
if (n === null || !Array.isArray(n))
|
806
|
-
throw new C("The 'data' prop must be a two-dimensional array.");
|
807
|
-
if (n.length === 0)
|
808
|
-
throw new C("The 'data' array must contain at least one row.");
|
809
|
-
}
|
810
|
-
const Se = `
|
811
|
-
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}
|
812
|
-
`, Ae = `
|
813
|
-
code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}
|
814
|
-
`;
|
815
|
-
function Te(n, t) {
|
816
|
-
return t ? { inputDataHeader: n[0], inputDataBody: n.slice(1) } : { inputDataHeader: Re(n[0].length), inputDataBody: n };
|
817
|
-
}
|
818
|
-
function Ce(n, t, s, m, i, d, a) {
|
819
|
-
try {
|
820
|
-
xe(n);
|
821
|
-
const { inputDataHeader: u, inputDataBody: l } = Te(n, t);
|
822
|
-
return _e(
|
823
|
-
{ inputDataHeader: u, inputDataBody: l },
|
824
|
-
s,
|
825
|
-
m,
|
826
|
-
i,
|
827
|
-
d,
|
828
|
-
a
|
829
|
-
);
|
830
|
-
} catch (u) {
|
831
|
-
if (u instanceof C)
|
832
|
-
return `Error: ${u.message}`;
|
833
|
-
throw u;
|
834
|
-
}
|
835
|
-
}
|
836
|
-
function je({
|
837
|
-
inputData: n = null,
|
838
|
-
hasHeader: t = !0,
|
839
|
-
columnAlignments: s = [],
|
840
|
-
isCompact: m = !1,
|
841
|
-
hasTabs: i = !1,
|
842
|
-
hasPadding: d = !0,
|
843
|
-
convertLineBreaks: a = !1,
|
844
|
-
className: u,
|
845
|
-
onGenerate: l,
|
846
|
-
theme: f = "light",
|
847
|
-
preStyle: o,
|
848
|
-
topPadding: r = 16,
|
849
|
-
minWidth: p,
|
850
|
-
showLineNumbers: g = !0
|
851
|
-
}) {
|
852
|
-
const v = ie(null), y = se(), k = le(n), [, E] = ue(), _ = ce(() => Ce(
|
853
|
-
k,
|
854
|
-
t,
|
855
|
-
s,
|
856
|
-
!m,
|
857
|
-
i,
|
858
|
-
a,
|
859
|
-
d
|
860
|
-
), [
|
861
|
-
k,
|
862
|
-
t,
|
863
|
-
s,
|
864
|
-
m,
|
865
|
-
i,
|
866
|
-
a,
|
867
|
-
d
|
868
|
-
]);
|
869
|
-
return D(() => {
|
870
|
-
l && l(_);
|
871
|
-
}, [_, l]), D(() => {
|
872
|
-
const R = v.current?.querySelector("code");
|
873
|
-
R && _ && E(() => {
|
874
|
-
requestAnimationFrame(() => {
|
875
|
-
if (de.highlightElement(R), !g && v.current) {
|
876
|
-
const $ = v.current.querySelector(".line-numbers-rows");
|
877
|
-
$ && $.remove();
|
878
|
-
}
|
879
|
-
});
|
880
|
-
});
|
881
|
-
}, [_, E, g]), /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
|
882
|
-
/* @__PURE__ */ S.jsxs("style", { children: [
|
883
|
-
f === "light" ? Se : Ae,
|
884
|
-
`
|
885
|
-
pre {
|
886
|
-
position: relative;
|
887
|
-
padding-top: ${r}px !important;
|
888
|
-
}
|
889
|
-
pre::before {
|
890
|
-
position: absolute;
|
891
|
-
top: 8px;
|
892
|
-
left: 12px;
|
893
|
-
color: ${f === "light" ? "#666" : "#999"};
|
894
|
-
letter-spacing: 2px;
|
895
|
-
font-size: 12px;
|
896
|
-
}
|
897
|
-
/* Hide line numbers when showLineNumbers is false */
|
898
|
-
pre:not(.line-numbers) .line-numbers-rows {
|
899
|
-
display: none !important;
|
900
|
-
}
|
901
|
-
/* Remove left padding when line numbers are hidden */
|
902
|
-
pre:not(.line-numbers) {
|
903
|
-
padding-left: 1em !important;
|
904
|
-
}
|
905
|
-
pre:not(.line-numbers) > code {
|
906
|
-
padding-left: 0 !important;
|
907
|
-
}
|
908
|
-
`
|
909
|
-
] }),
|
910
|
-
/* @__PURE__ */ S.jsx(
|
911
|
-
"div",
|
912
|
-
{
|
913
|
-
id: y,
|
914
|
-
style: {
|
915
|
-
position: "relative",
|
916
|
-
isolation: "isolate",
|
917
|
-
display: "inline-block"
|
918
|
-
},
|
919
|
-
children: /* @__PURE__ */ S.jsx(
|
920
|
-
"pre",
|
921
|
-
{
|
922
|
-
ref: v,
|
923
|
-
className: `${u} language-markdown ${g ? "line-numbers" : ""} ${f === "dark" ? "dark-theme" : ""}`,
|
924
|
-
style: {
|
925
|
-
width: "fit-content",
|
926
|
-
minWidth: p ? `${p}px` : "min-content",
|
927
|
-
margin: 0,
|
928
|
-
...o
|
929
|
-
},
|
930
|
-
children: /* @__PURE__ */ S.jsx("code", { className: "language-markdown", role: "code", children: _ })
|
931
|
-
}
|
932
|
-
)
|
933
|
-
}
|
934
|
-
)
|
935
|
-
] });
|
936
|
-
}
|
937
|
-
export {
|
938
|
-
je as MarkdownTable,
|
939
|
-
C as MarkdownTableError
|
940
|
-
};
|
package/dist/light.png
DELETED
Binary file
|
package/dist/types.d.ts
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview Type definitions for the MarkdownTable component including props,
|
3
|
-
* alignment options, and table configuration.
|
4
|
-
*/
|
5
|
-
export interface InputData {
|
6
|
-
inputDataHeader: string[];
|
7
|
-
inputDataBody: readonly string[][];
|
8
|
-
}
|
9
|
-
export interface MarkdownTableProps {
|
10
|
-
/**
|
11
|
-
* The entire table data as a two-dimensional array.
|
12
|
-
* If `hasHeader` is true, the first row is treated as the header.
|
13
|
-
* @default null
|
14
|
-
*/
|
15
|
-
inputData?: string[][] | null;
|
16
|
-
/**
|
17
|
-
* Optional array specifying the alignment for each column.
|
18
|
-
* Acceptable values are 'left', 'center', 'right', or 'none'.
|
19
|
-
* @default []
|
20
|
-
*/
|
21
|
-
columnAlignments?: readonly Alignment[];
|
22
|
-
/**
|
23
|
-
* Disables column width alignment to provide a more compact markdown table string.
|
24
|
-
* @default false
|
25
|
-
*/
|
26
|
-
isCompact?: boolean;
|
27
|
-
/**
|
28
|
-
* Optional flag to add a single space around cell content in the markdown table.
|
29
|
-
* When true, one space is added before and after the content in each cell.
|
30
|
-
* @default true
|
31
|
-
*/
|
32
|
-
hasPadding?: boolean;
|
33
|
-
/**
|
34
|
-
* Optional flag to add tabs as additional padding between column pipes.
|
35
|
-
* When true, adds a tab character after each | and before the content.
|
36
|
-
* @default false
|
37
|
-
*/
|
38
|
-
hasTabs?: boolean;
|
39
|
-
/**
|
40
|
-
* Indicates whether the first row of `data` is a header.
|
41
|
-
* @default true
|
42
|
-
*/
|
43
|
-
hasHeader?: boolean;
|
44
|
-
/**
|
45
|
-
* Optional flag to replace newlines with <br> tags in table cells.
|
46
|
-
* @default false
|
47
|
-
*/
|
48
|
-
convertLineBreaks?: boolean;
|
49
|
-
/**
|
50
|
-
* Optional theme for the Markdown table.
|
51
|
-
* Acceptable values are 'light' or 'dark'.
|
52
|
-
* @default 'light'
|
53
|
-
*/
|
54
|
-
theme?: 'light' | 'dark';
|
55
|
-
/**
|
56
|
-
* Optional CSS class for styling the rendered Markdown table.
|
57
|
-
* This class will be applied to the <pre> element containing the table.
|
58
|
-
* It will be combined with built-in classes for syntax highlighting.
|
59
|
-
* @default undefined
|
60
|
-
* @example
|
61
|
-
* <MarkdownTable
|
62
|
-
* inputData={data}
|
63
|
-
* className="custom-table-style"
|
64
|
-
* />
|
65
|
-
*/
|
66
|
-
className?: string;
|
67
|
-
/**
|
68
|
-
* Optional CSS properties to apply to the pre element containing the Markdown table.
|
69
|
-
* Allows direct styling of the table container using React's style prop.
|
70
|
-
* @default undefined
|
71
|
-
* @example
|
72
|
-
* <MarkdownTable
|
73
|
-
* inputData={data}
|
74
|
-
* preStyle={{
|
75
|
-
* maxHeight: '300px',
|
76
|
-
* overflow: 'auto',
|
77
|
-
* backgroundColor: '#f5f5f5'
|
78
|
-
* }}
|
79
|
-
* />
|
80
|
-
*/
|
81
|
-
preStyle?: React.CSSProperties;
|
82
|
-
/**
|
83
|
-
* Optional callback function to receive the generated Markdown table string.
|
84
|
-
*/
|
85
|
-
onGenerate?: (markdownTableString: string) => void;
|
86
|
-
/**
|
87
|
-
* Optional top padding for the pre element.
|
88
|
-
* @default 0
|
89
|
-
*/
|
90
|
-
topPadding?: number;
|
91
|
-
/**
|
92
|
-
* Optional minimum width in pixels for the pre element containing the Markdown table.
|
93
|
-
* @default undefined
|
94
|
-
* @example
|
95
|
-
* <MarkdownTable
|
96
|
-
* inputData={data}
|
97
|
-
* minWidth={300}
|
98
|
-
* />
|
99
|
-
*/
|
100
|
-
minWidth?: number;
|
101
|
-
/**
|
102
|
-
* Optional flag to show or hide line numbers in the Prism syntax highlighting.
|
103
|
-
* When true, line numbers are displayed on the left side of the code block.
|
104
|
-
* @default true
|
105
|
-
* @example
|
106
|
-
* <MarkdownTable
|
107
|
-
* inputData={data}
|
108
|
-
* showLineNumbers={false}
|
109
|
-
* />
|
110
|
-
*/
|
111
|
-
showLineNumbers?: boolean;
|
112
|
-
}
|
113
|
-
export type Alignment = 'left' | 'right' | 'center' | 'none';
|
114
|
-
export interface TableConfig {
|
115
|
-
columnCount: number;
|
116
|
-
columnAlignments: readonly Alignment[];
|
117
|
-
columnWidths?: readonly number[];
|
118
|
-
useTabs: boolean;
|
119
|
-
replaceNewlines: boolean;
|
120
|
-
hasPadding: boolean;
|
121
|
-
}
|
122
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC;IAE9B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAExC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAExB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE/B;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAE3B;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;CACrB"}
|
package/dist/utils.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview Utility functions and classes for generating formatted markdown
|
3
|
-
* table strings with alignment, padding, and column width adjustments.
|
4
|
-
*/
|
5
|
-
import type { InputData, Alignment } from './types';
|
6
|
-
export declare function generateMarkdownTableString(inputData: InputData, columnAlignments: readonly Alignment[], canAdjustColumnWidths?: boolean, useTabs?: boolean, replaceNewlines?: boolean, hasPadding?: boolean): string;
|
7
|
-
export declare function generateAlphabetHeaders(columnCount: number): string[];
|
8
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAe,MAAM,SAAS,CAAC;AAmIjE,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,SAAS,SAAS,EAAE,EACtC,qBAAqB,UAAO,EAC5B,OAAO,UAAQ,EACf,eAAe,UAAQ,EACvB,UAAU,UAAO,GAChB,MAAM,CAsBR;AAYD,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAErE"}
|
package/dist/validation.d.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview Validation utilities and custom error class for markdown table
|
3
|
-
* data validation.
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* Custom error class for handling Markdown table generation errors.
|
7
|
-
* Supports ES2022 error chaining via the optional `cause` property.
|
8
|
-
*/
|
9
|
-
export declare class MarkdownTableError extends Error {
|
10
|
-
constructor(message: string, options?: ErrorOptions);
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* Validates that the input data is a non-empty two-dimensional array.
|
14
|
-
* @param inputData - The data to validate
|
15
|
-
* @throws {MarkdownTableError} If validation fails
|
16
|
-
*/
|
17
|
-
export declare function validateInputData(inputData: unknown): void;
|
18
|
-
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKpD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAQ1D"}
|