Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

markdown-it-multimd-table

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-multimd-table - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

13

dist/markdown-it-multimd-table.js

@@ -1,2 +0,2 @@

/*! markdown-it-multimd-table 4.2.0 https://github.com/redbug312/markdown-it-multimd-table @license MIT */
/*! markdown-it-multimd-table 4.2.1 https://github.com/redbug312/markdown-it-multimd-table @license MIT */
(function(global, factory) {

@@ -78,3 +78,3 @@ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,

*/
var start = state.bMarks[line] + state.sCount[line], head = state.bMarks[line] + state.blkIndent, end = state.skipSpacesBack(state.eMarks[line], head), bounds = [], pos, posjump, escape = false, code = false;
var start = state.bMarks[line] + state.sCount[line], head = state.bMarks[line] + state.blkIndent, end = state.skipSpacesBack(state.eMarks[line], head), bounds = [], pos, posjump, escape = false, code = false, serial = 0;
/* Scan for valid pipe character position */ for (pos = start; pos < end; pos++) {

@@ -91,4 +91,11 @@ switch (state.src.charCodeAt(pos)) {

/* eslint-disable-next-line brace-style */ if (posjump > pos) {
if (!code) {
if (serial === 0) {
serial = posjump - pos;
} else if (serial === posjump - pos) {
serial = 0;
}
}
pos = posjump;
} else if (code || !escape) {
} else if (code || !escape && !serial) {
code = !code;

@@ -95,0 +102,0 @@ }

@@ -1,2 +0,2 @@

/*! markdown-it-multimd-table 4.2.0 https://github.com/redbug312/markdown-it-multimd-table @license MIT */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).markdownit=e()}(this,(function(){"use strict";function t(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}t.prototype.set_highest_alphabet=function(t){this.__highest_alphabet__=t},t.prototype.set_match_alphabets=function(t){this.__match_alphabets__=t},t.prototype.set_initial_state=function(t){this.__initial_state__=t},t.prototype.set_accept_states=function(t){for(var e=0;e<t.length;e++)this.__accept_states__[t[e]]=!0},t.prototype.set_transitions=function(t){this.__transitions__=t},t.prototype.set_actions=function(t){this.__actions__=t},t.prototype.update_transition=function(t,e){this.__transitions__[t]=Object.assign(this.__transitions__[t]||Object(),e)},t.prototype.execute=function(t,e){var a,s,n;for(a=this.__initial_state__,s=t;a&&s<e;s++){for(n=this.__highest_alphabet__;n>0&&!(a&n&&this.__match_alphabets__[n].call(this,s,a,n));n>>=4);if(this.__actions__(s,a,n),0===n)break;a=this.__transitions__[a][n]||0}return!!this.__accept_states__[a]};var e=t;return function(t,a){function s(t,e){var a,s,n=t.bMarks[e]+t.sCount[e],i=t.bMarks[e]+t.blkIndent,l=t.skipSpacesBack(t.eMarks[e],i),r=[],p=!1,o=!1;for(a=n;a<l;a++)switch(t.src.charCodeAt(a)){case 92:p=!0;break;case 96:(s=t.skipChars(a,96)-1)>a?a=s:!o&&p||(o=!o),p=!1;break;case 124:o||p||r.push(a),p=!1;break;default:p=!1}return 0===r.length||(r[0]>i&&r.unshift(i-1),r[r.length-1]<l-1&&r.push(l)),r}function n(t,e,s){var n={text:null,label:null},i=t.bMarks[s]+t.sCount[s],l=t.eMarks[s],r=t.src.slice(i,l).match(/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/);return!!r&&(!!e||(n.text=r[1],a.autolabel||r[2]?(n.label=r[2]||r[1],n.label=n.label.toLowerCase().replace(/\W+/g,""),n):n))}function i(t,e,n){var i,l,r,p={bounds:null,multiline:null},o=s(t,n);return!(o.length<2)&&(!!e||(p.bounds=o,a.multiline&&(i=t.bMarks[n]+t.sCount[n],l=t.eMarks[n]-1,p.multiline=92===t.src.charCodeAt(l),p.multiline&&(r=t.eMarks[n],t.eMarks[n]=t.skipSpacesBack(l,i),p.bounds=s(t,n),t.eMarks[n]=r)),p))}function l(t,e,a){var n,i,l={aligns:[],wraps:[]},r=s(t,a),p=/^:?(-+|=+):?\+?$/;if(t.sCount[a]-t.blkIndent>=4)return!1;if(0===r.length)return!1;for(n=0;n<r.length-1;n++){if(i=t.src.slice(r[n]+1,r[n+1]).trim(),!p.test(i))return!1;switch(l.wraps.push(43===i.charCodeAt(i.length-1)),(58===i.charCodeAt(0))<<4|58===i.charCodeAt(i.length-1-l.wraps[n])){case 0:l.aligns.push("");break;case 1:l.aligns.push("right");break;case 16:l.aligns.push("left");break;case 17:l.aligns.push("center")}}return!!e||l}function r(t,e,a){return t.isEmpty(a)}a=t.utils.assign({},{multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0},a||{}),t.block.ruler.at("table",(function(t,s,p,o){var _,c,h,m,u,b,d,f,k,g,y,w,v,M,x,C,T=new e,A=16,j=-1,S=[];if(s+2>p)return!1;if((c=new t.Token("table_open","table",1)).meta={sep:null,cap:null,tr:[]},T.set_highest_alphabet(65536),T.set_initial_state(65792),T.set_accept_states([65552,65553,0]),T.set_match_alphabets({65536:n.bind(this,t,!0),4096:l.bind(this,t,!0),256:i.bind(this,t,!0),16:i.bind(this,t,!0),1:r.bind(this,t,!0)}),T.set_transitions({65792:{65536:256,256:4352},256:{256:4352},4352:{4096:65552,256:4352},65552:{65536:0,16:65553},65553:{65536:0,16:65553,1:65552}}),a.headerless&&(T.set_initial_state(69888),T.update_transition(69888,{65536:4352,4096:65552,256:4352}),(h=new t.Token("tr_placeholder","tr",0)).meta=Object()),a.multibody||T.update_transition(65552,{65536:0,16:65552}),T.set_actions((function(e,r,p){switch(p){case 65536:if(c.meta.cap)break;c.meta.cap=n(t,!1,e),c.meta.cap.map=[e,e+1],c.meta.cap.first=e===s;break;case 4096:c.meta.sep=l(t,!1,e),c.meta.sep.map=[e,e+1],h.meta.grp|=1,A=16;break;case 256:case 16:(h=new t.Token("tr_open","tr",1)).map=[e,e+1],h.meta=i(t,!1,e),h.meta.type=p,h.meta.grp=A,A=0,c.meta.tr.push(h),a.multiline&&(h.meta.multiline&&j<0?j=c.meta.tr.length-1:!h.meta.multiline&&j>=0&&((_=c.meta.tr[j]).meta.mbounds=c.meta.tr.slice(j).map((function(t){return t.meta.bounds})),_.map[1]=h.map[1],c.meta.tr=c.meta.tr.slice(0,j+1),j=-1));break;case 1:h.meta.grp|=1,A=16}})),!1===T.execute(s,p))return!1;if(!c.meta.tr.length)return!1;if(o)return!0;for(c.meta.tr[c.meta.tr.length-1].meta.grp|=1,c.map=d=[s,0],c.block=!0,c.level=t.level++,t.tokens.push(c),c.meta.cap&&((_=t.push("caption_open","caption",1)).map=c.meta.cap.map,null!==c.meta.cap.label&&(_.attrs=[["id",c.meta.cap.label]]),(_=t.push("inline","",0)).content=c.meta.cap.text,_.map=c.meta.cap.map,_.children=[],_=t.push("caption_close","caption",-1)),w=0;w<c.meta.tr.length;w++){for(u=new t.Token("td_th_placeholder","",0),16&(h=c.meta.tr[w]).meta.grp&&(k=256===h.meta.type?"thead":"tbody",(_=t.push(k+"_open",k,1)).map=f=[h.map[0],0],S=[]),h.block=!0,h.level=t.level++,t.tokens.push(h),v=0;v<h.meta.bounds.length-1;v++)if(y=[h.meta.bounds[v]+1,h.meta.bounds[v+1]],""!==(g=t.src.slice.apply(t.src,y)))if(a.rowspan&&S[v]&&"^^"===g.trim())b=S[v].attrGet("rowspan"),S[v].attrSet("rowspan",null===b?2:b+1),u=new t.Token("td_th_placeholder","",0);else{if(k=256===h.meta.type?"th":"td",(_=t.push(k+"_open",k,1)).map=h.map,_.attrs=[],c.meta.sep.aligns[v]&&_.attrs.push(["style","text-align:"+c.meta.sep.aligns[v]]),c.meta.sep.wraps[v]&&_.attrs.push(["class","extend"]),u=S[v]=_,a.multiline&&h.meta.multiline&&h.meta.mbounds){for(g=new Array(h.map[0]).fill("").concat([g.trimRight()]),M=1;M<h.meta.mbounds.length;M++)v>h.meta.mbounds[M].length-2||(y=[h.meta.mbounds[M][v]+1,h.meta.mbounds[M][v+1]],g.push(t.src.slice.apply(t.src,y).trimRight()));for((C=new t.md.block.State(g.join("\n"),t.md,t.env,[])).level=h.level+1,t.md.block.tokenize(C,h.map[0],C.lineMax),x=0;x<C.tokens.length;x++)t.tokens.push(C.tokens[x])}else(_=t.push("inline","",0)).content=g.trim(),_.map=h.map,_.level=h.level+1,_.children=[];_=t.push(k+"_close",k,-1)}else m=u.attrGet("colspan"),u.attrSet("colspan",null===m?2:m+1);t.push("tr_close","tr",-1),1&h.meta.grp&&(k=256===h.meta.type?"thead":"tbody",_=t.push(k+"_close",k,-1),f[1]=h.map[1])}return d[1]=Math.max(f[1],c.meta.sep.map[1],c.meta.cap?c.meta.cap.map[1]:-1),_=t.push("table_close","table",-1),t.line=d[1],!0}),{alt:["paragraph","reference"]})}}));
/*! markdown-it-multimd-table 4.2.1 https://github.com/redbug312/markdown-it-multimd-table @license MIT */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).markdownit=e()}(this,(function(){"use strict";function t(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}t.prototype.set_highest_alphabet=function(t){this.__highest_alphabet__=t},t.prototype.set_match_alphabets=function(t){this.__match_alphabets__=t},t.prototype.set_initial_state=function(t){this.__initial_state__=t},t.prototype.set_accept_states=function(t){for(var e=0;e<t.length;e++)this.__accept_states__[t[e]]=!0},t.prototype.set_transitions=function(t){this.__transitions__=t},t.prototype.set_actions=function(t){this.__actions__=t},t.prototype.update_transition=function(t,e){this.__transitions__[t]=Object.assign(this.__transitions__[t]||Object(),e)},t.prototype.execute=function(t,e){var a,s,n;for(a=this.__initial_state__,s=t;a&&s<e;s++){for(n=this.__highest_alphabet__;n>0&&!(a&n&&this.__match_alphabets__[n].call(this,s,a,n));n>>=4);if(this.__actions__(s,a,n),0===n)break;a=this.__transitions__[a][n]||0}return!!this.__accept_states__[a]};var e=t;return function(t,a){function s(t,e){var a,s,n=t.bMarks[e]+t.sCount[e],i=t.bMarks[e]+t.blkIndent,l=t.skipSpacesBack(t.eMarks[e],i),r=[],p=!1,o=!1,_=0;for(a=n;a<l;a++)switch(t.src.charCodeAt(a)){case 92:p=!0;break;case 96:(s=t.skipChars(a,96)-1)>a?(o||(0===_?_=s-a:_===s-a&&(_=0)),a=s):(o||!p&&!_)&&(o=!o),p=!1;break;case 124:o||p||r.push(a),p=!1;break;default:p=!1}return 0===r.length||(r[0]>i&&r.unshift(i-1),r[r.length-1]<l-1&&r.push(l)),r}function n(t,e,s){var n={text:null,label:null},i=t.bMarks[s]+t.sCount[s],l=t.eMarks[s],r=t.src.slice(i,l).match(/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/);return!!r&&(!!e||(n.text=r[1],a.autolabel||r[2]?(n.label=r[2]||r[1],n.label=n.label.toLowerCase().replace(/\W+/g,""),n):n))}function i(t,e,n){var i,l,r,p={bounds:null,multiline:null},o=s(t,n);return!(o.length<2)&&(!!e||(p.bounds=o,a.multiline&&(i=t.bMarks[n]+t.sCount[n],l=t.eMarks[n]-1,p.multiline=92===t.src.charCodeAt(l),p.multiline&&(r=t.eMarks[n],t.eMarks[n]=t.skipSpacesBack(l,i),p.bounds=s(t,n),t.eMarks[n]=r)),p))}function l(t,e,a){var n,i,l={aligns:[],wraps:[]},r=s(t,a),p=/^:?(-+|=+):?\+?$/;if(t.sCount[a]-t.blkIndent>=4)return!1;if(0===r.length)return!1;for(n=0;n<r.length-1;n++){if(i=t.src.slice(r[n]+1,r[n+1]).trim(),!p.test(i))return!1;switch(l.wraps.push(43===i.charCodeAt(i.length-1)),(58===i.charCodeAt(0))<<4|58===i.charCodeAt(i.length-1-l.wraps[n])){case 0:l.aligns.push("");break;case 1:l.aligns.push("right");break;case 16:l.aligns.push("left");break;case 17:l.aligns.push("center")}}return!!e||l}function r(t,e,a){return t.isEmpty(a)}a=t.utils.assign({},{multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0},a||{}),t.block.ruler.at("table",(function(t,s,p,o){var _,c,h,m,u,b,d,f,k,g,y,w,v,M,x,C,T=new e,A=16,j=-1,S=[];if(s+2>p)return!1;if((c=new t.Token("table_open","table",1)).meta={sep:null,cap:null,tr:[]},T.set_highest_alphabet(65536),T.set_initial_state(65792),T.set_accept_states([65552,65553,0]),T.set_match_alphabets({65536:n.bind(this,t,!0),4096:l.bind(this,t,!0),256:i.bind(this,t,!0),16:i.bind(this,t,!0),1:r.bind(this,t,!0)}),T.set_transitions({65792:{65536:256,256:4352},256:{256:4352},4352:{4096:65552,256:4352},65552:{65536:0,16:65553},65553:{65536:0,16:65553,1:65552}}),a.headerless&&(T.set_initial_state(69888),T.update_transition(69888,{65536:4352,4096:65552,256:4352}),(h=new t.Token("tr_placeholder","tr",0)).meta=Object()),a.multibody||T.update_transition(65552,{65536:0,16:65552}),T.set_actions((function(e,r,p){switch(p){case 65536:if(c.meta.cap)break;c.meta.cap=n(t,!1,e),c.meta.cap.map=[e,e+1],c.meta.cap.first=e===s;break;case 4096:c.meta.sep=l(t,!1,e),c.meta.sep.map=[e,e+1],h.meta.grp|=1,A=16;break;case 256:case 16:(h=new t.Token("tr_open","tr",1)).map=[e,e+1],h.meta=i(t,!1,e),h.meta.type=p,h.meta.grp=A,A=0,c.meta.tr.push(h),a.multiline&&(h.meta.multiline&&j<0?j=c.meta.tr.length-1:!h.meta.multiline&&j>=0&&((_=c.meta.tr[j]).meta.mbounds=c.meta.tr.slice(j).map((function(t){return t.meta.bounds})),_.map[1]=h.map[1],c.meta.tr=c.meta.tr.slice(0,j+1),j=-1));break;case 1:h.meta.grp|=1,A=16}})),!1===T.execute(s,p))return!1;if(!c.meta.tr.length)return!1;if(o)return!0;for(c.meta.tr[c.meta.tr.length-1].meta.grp|=1,c.map=d=[s,0],c.block=!0,c.level=t.level++,t.tokens.push(c),c.meta.cap&&((_=t.push("caption_open","caption",1)).map=c.meta.cap.map,null!==c.meta.cap.label&&(_.attrs=[["id",c.meta.cap.label]]),(_=t.push("inline","",0)).content=c.meta.cap.text,_.map=c.meta.cap.map,_.children=[],_=t.push("caption_close","caption",-1)),w=0;w<c.meta.tr.length;w++){for(u=new t.Token("td_th_placeholder","",0),16&(h=c.meta.tr[w]).meta.grp&&(k=256===h.meta.type?"thead":"tbody",(_=t.push(k+"_open",k,1)).map=f=[h.map[0],0],S=[]),h.block=!0,h.level=t.level++,t.tokens.push(h),v=0;v<h.meta.bounds.length-1;v++)if(y=[h.meta.bounds[v]+1,h.meta.bounds[v+1]],""!==(g=t.src.slice.apply(t.src,y)))if(a.rowspan&&S[v]&&"^^"===g.trim())b=S[v].attrGet("rowspan"),S[v].attrSet("rowspan",null===b?2:b+1),u=new t.Token("td_th_placeholder","",0);else{if(k=256===h.meta.type?"th":"td",(_=t.push(k+"_open",k,1)).map=h.map,_.attrs=[],c.meta.sep.aligns[v]&&_.attrs.push(["style","text-align:"+c.meta.sep.aligns[v]]),c.meta.sep.wraps[v]&&_.attrs.push(["class","extend"]),u=S[v]=_,a.multiline&&h.meta.multiline&&h.meta.mbounds){for(g=new Array(h.map[0]).fill("").concat([g.trimRight()]),M=1;M<h.meta.mbounds.length;M++)v>h.meta.mbounds[M].length-2||(y=[h.meta.mbounds[M][v]+1,h.meta.mbounds[M][v+1]],g.push(t.src.slice.apply(t.src,y).trimRight()));for((C=new t.md.block.State(g.join("\n"),t.md,t.env,[])).level=h.level+1,t.md.block.tokenize(C,h.map[0],C.lineMax),x=0;x<C.tokens.length;x++)t.tokens.push(C.tokens[x])}else(_=t.push("inline","",0)).content=g.trim(),_.map=h.map,_.level=h.level+1,_.children=[];_=t.push(k+"_close",k,-1)}else m=u.attrGet("colspan"),u.attrSet("colspan",null===m?2:m+1);t.push("tr_close","tr",-1),1&h.meta.grp&&(k=256===h.meta.type?"thead":"tbody",_=t.push(k+"_close",k,-1),f[1]=h.map[1])}return d[1]=Math.max(f[1],c.meta.sep.map[1],c.meta.cap?c.meta.cap.map[1]:-1),_=t.push("table_close","table",-1),t.line=d[1],!0}),{alt:["paragraph","reference"]})}}));

@@ -25,3 +25,3 @@ 'use strict';

bounds = [], pos, posjump,
escape = false, code = false;
escape = false, code = false, serial = 0;

@@ -38,4 +38,8 @@ /* Scan for valid pipe character position */

/* eslint-disable-next-line brace-style */
if (posjump > pos) { pos = posjump; }
else if (code || !escape) { code = !code; }
if (posjump > pos) {
if (!code) {
if (serial === 0) { serial = posjump - pos; } else if (serial === posjump - pos) { serial = 0; }
}
pos = posjump;
} else if (code || (!escape && !serial)) { code = !code; }
escape = false; break;

@@ -42,0 +46,0 @@ case 0x7c /* | */:

{
"name": "markdown-it-multimd-table",
"version": "4.2.0",
"version": "4.2.1",
"description": "Multimarkdown table syntax plugin for markdown-it markdown parser",

@@ -5,0 +5,0 @@ "keywords": [

@@ -70,2 +70,50 @@ ---

Literal backtick (`) inside inline code in table data row
.
| First | Second |
| --------- | -------- |
| `` ` `` | Content |
| ``(`)`` | Content |
| ``(\`)`` | Content |
| `(``)` | Content |
| `(```)` | `(```)` |
| `(```)` | `(```)` |
.
<table>
<thead>
<tr>
<th>First</th>
<th>Second</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>`</code></td>
<td>Content</td>
</tr>
<tr>
<td><code>(`)</code></td>
<td>Content</td>
</tr>
<tr>
<td><code>(\`)</code></td>
<td>Content</td>
</tr>
<tr>
<td><code>(``)</code></td>
<td>Content</td>
</tr>
<tr>
<td><code>(```)</code></td>
<td><code>(```)</code></td>
</tr>
<tr>
<td><code>(```)</code></td>
<td><code>(```)</code></td>
</tr>
</tbody>
</table>
.
[Issue #1](github.com/RedBug312/markdown-it-multimd-table/issues/1)

@@ -72,0 +120,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc