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.0.1 to 4.0.2

12

dist/markdown-it-multimd-table.js

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

/*! markdown-it-multimd-table 4.0.1 https://github.com/RedBug312/markdown-it-multimd-table @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownitMultimdTable = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
/*! markdown-it-multimd-table 4.0.2 https://github.com/RedBug312/markdown-it-multimd-table @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownitMultimdTable = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

@@ -263,3 +263,3 @@

case 0x00010:
trToken = new state.Token('table_row_open', 'tr', 1);
trToken = new state.Token('tr_open', 'tr', 1);
trToken.map = [ _line, _line + 1 ];

@@ -334,3 +334,3 @@ trToken.meta = table_row(state, false, _line);

tag = (trToken.meta.type === 0x00100) ? 'thead' : 'tbody';
token = state.push('table_group_open', tag, 1);
token = state.push(tag + '_open', tag, 1);
token.map = tgroupLines = [ trToken.map[0], 0 ]; // array ref

@@ -360,3 +360,3 @@ upTokens = [];

tag = (trToken.meta.type === 0x00100) ? 'th' : 'td';
token = state.push('table_column_open', tag, 1);
token = state.push(tag + '_open', tag, 1);
token.map = trToken.map;

@@ -389,3 +389,3 @@ token.attrs = [];

token = state.push('table_column_close', tag, -1);
token = state.push(tag + '_close', tag, -1);
}

@@ -397,3 +397,3 @@

tag = (trToken.meta.type === 0x00100) ? 'thead' : 'tbody';
token = state.push('table_group_close', tag, -1);
token = state.push(tag + '_close', tag, -1);
tgroupLines[1] = trToken.map[1];

@@ -400,0 +400,0 @@ }

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

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).markdownitMultimdTable=t()}}(function(){return function t(e,a,s){function n(r,o){if(!a[r]){if(!e[r]){var p="function"==typeof require&&require;if(!o&&p)return p(r,!0);if(i)return i(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var _=a[r]={exports:{}};e[r][0].call(_.exports,function(t){return n(e[r][1][t]||t)},_,_.exports,t,e,a,s)}return a[r].exports}for(var i="function"==typeof require&&require,r=0;r<s.length;r++)n(s[r]);return n}({1:[function(t,e,a){"use strict";function s(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}s.prototype.set_highest_alphabet=function(t){this.__highest_alphabet__=t},s.prototype.set_match_alphabets=function(t){this.__match_alphabets__=t},s.prototype.set_initial_state=function(t){this.__initial_state__=t},s.prototype.set_accept_states=function(t){for(var e=0;e<t.length;e++)this.__accept_states__[t[e]]=!0},s.prototype.set_transitions=function(t){this.__transitions__=t},s.prototype.set_actions=function(t){this.__actions__=t},s.prototype.update_transition=function(t,e){this.__transitions__[t]=Object.assign(this.__transitions__[t]||Object(),e)},s.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]},e.exports=s},{}],2:[function(t,e,a){"use strict";var s=t("./lib/dfa.js");e.exports=function(t,e){function a(t,e){var a,s=t.bMarks[e],n=t.skipSpacesBack(t.eMarks[e],s),i=[],r=!1,o=!1;for(a=s;a<n;a++)switch(t.src.charCodeAt(a)){case 92:r=!0;break;case 96:!o&&r||(o=!o),96===t.src.charCodeAt(a-1)&&(o=!1),r=!1;break;case 124:o||r||i.push(a),r=!1;break;default:r=!1}return 0===i.length?i:(i[0]>s&&i.unshift(s-1),i[i.length-1]<n-1&&i.push(n),i)}function n(t,e,a){var s=t.bMarks[a]+t.tShift[a],n=t.eMarks[a],i=t.src.slice(s,n).match(/^\[([^\[\]]+)\](\[([^\[\]]+)\])?\s*$/),r={};return!!i&&(!!e||(r.text=i[1],r.label=i[2]||i[1],r.label=r.label.toLowerCase().replace(/\W+/g,""),r))}function i(t,s,n){var i,r,o,p=a(t,n),l={};return!(p.length<2)&&(!!s||(l.bounds=p,e.multiline&&(i=t.bMarks[n]+t.tShift[n],r=t.eMarks[n]-1,l.multiline=92===t.src.charCodeAt(r),l.multiline&&(o=t.eMarks[n],t.eMarks[n]=t.skipSpacesBack(r,i),l.bounds=a(t,n),t.eMarks[n]=o)),l))}function r(t,e,s){var n,i,r=a(t,s),o={aligns:[],wraps:[]},p=/^:?(-+|=+):?\+?$/;if(t.sCount[s]-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(o.wraps.push(43===i.charCodeAt(i.length-1)),(58===i.charCodeAt(0))<<4|58===i.charCodeAt(i.length-1-o.wraps[n])){case 0:o.aligns.push("");break;case 1:o.aligns.push("right");break;case 16:o.aligns.push("left");break;case 17:o.aligns.push("center")}}return!!e||o}function o(t,e,a){return t.bMarks[a]+t.tShift[a]===t.eMarks[a]}e=e||{},t.block.ruler.at("table",function(t,a,p,l){var _,c,u,h,m,f,b,d,g,k,w,y,v,x,M=new s,C=16,j=-1,S=[];if(a+2>p)return!1;if((c=new t.Token("table_open","table",1)).meta={sep:null,cap:null,tr:[]},M.set_highest_alphabet(65536),M.set_initial_state(65792),M.set_accept_states([65552,65553,0]),M.set_match_alphabets({65536:n.bind(this,t,!0),4096:r.bind(this,t,!0),256:i.bind(this,t,!0),16:i.bind(this,t,!0),1:o.bind(this,t,!0)}),M.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}}),e.headerless&&(M.set_initial_state(69888),M.update_transition(69888,{65536:4352,4096:65552,256:4352}),(u=new t.Token("table_fake_header_row","tr",1)).meta=Object()),M.set_actions(function(s,o,p){switch(p){case 65536:if(c.meta.cap)break;c.meta.cap=n(t,!1,s),c.meta.cap.map=[s,s+1],c.meta.cap.first=s===a;break;case 4096:c.meta.sep=r(t,!1,s),c.meta.sep.map=[s,s+1],u.meta.grp|=1,C=16;break;case 256:case 16:(u=new t.Token("table_row_open","tr",1)).map=[s,s+1],u.meta=i(t,!1,s),u.meta.type=p,u.meta.grp=C,C=0,c.meta.tr.push(u),e.multiline&&(u.meta.multiline&&j<0?j=c.meta.tr.length-1:!u.meta.multiline&&j>=0&&((_=c.meta.tr[j]).meta.mbounds=c.meta.tr.slice(j).map(function(t){return t.meta.bounds}),_.map[1]=u.map[1],c.meta.tr=c.meta.tr.slice(0,j+1),j=-1));break;case 1:u.meta.grp|=1,C=16}}),!1===M.execute(a,p))return!1;if(!c.meta.tr.length)return!1;if(l)return!0;for(c.meta.tr[c.meta.tr.length-1].meta.grp|=1,c.map=b=[a,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,_.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)),y=0;y<c.meta.tr.length;y++){for(m=new t.Token("table_fake_tcol_open","",1),16&(u=c.meta.tr[y]).meta.grp&&(g=256===u.meta.type?"thead":"tbody",(_=t.push("table_group_open",g,1)).map=d=[u.map[0],0],S=[]),u.block=!0,u.level=t.level++,t.tokens.push(u),v=0;v<u.meta.bounds.length-1;v++)if(w=[u.meta.bounds[v]+1,u.meta.bounds[v+1]],""!==(k=t.src.slice.apply(t.src,w)))if(e.rowspan&&S[v]&&"^^"===k.trim())f=S[v].attrGet("rowspan"),S[v].attrSet("rowspan",null===f?2:f+1);else{if(g=256===u.meta.type?"th":"td",(_=t.push("table_column_open",g,1)).map=u.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"]),m=S[v]=_,e.multiline&&u.meta.multiline&&u.meta.mbounds){for(k=[k.trimRight()],x=1;x<u.meta.mbounds.length;x++)v>u.meta.mbounds[x].length-2||(w=[u.meta.mbounds[x][v]+1,u.meta.mbounds[x][v+1]],k.push(t.src.slice.apply(t.src,w).trimRight()));t.md.block.parse(k.join("\n"),t.md,t.env,t.tokens)}else(_=t.push("inline","",0)).content=k.trim(),_.map=u.map,_.children=[];_=t.push("table_column_close",g,-1)}else h=m.attrGet("colspan"),m.attrSet("colspan",null===h?2:h+1);t.push("tr_close","tr",-1),1&u.meta.grp&&(g=256===u.meta.type?"thead":"tbody",_=t.push("table_group_close",g,-1),d[1]=u.map[1])}return b[1]=Math.max(d[1],c.meta.sep.map[1],c.meta.cap?c.meta.cap.map[1]:-1),_=t.push("table_close","table",-1),t.line=b[1],!0},{alt:["paragraph","reference"]})}},{"./lib/dfa.js":1}]},{},[2])(2)});
/*! markdown-it-multimd-table 4.0.2 https://github.com/RedBug312/markdown-it-multimd-table @license MIT */!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).markdownitMultimdTable=t()}}((function(){return function t(e,a,s){function n(r,o){if(!a[r]){if(!e[r]){var p="function"==typeof require&&require;if(!o&&p)return p(r,!0);if(i)return i(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var c=a[r]={exports:{}};e[r][0].call(c.exports,(function(t){return n(e[r][1][t]||t)}),c,c.exports,t,e,a,s)}return a[r].exports}for(var i="function"==typeof require&&require,r=0;r<s.length;r++)n(s[r]);return n}({1:[function(t,e,a){"use strict";function s(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}s.prototype.set_highest_alphabet=function(t){this.__highest_alphabet__=t},s.prototype.set_match_alphabets=function(t){this.__match_alphabets__=t},s.prototype.set_initial_state=function(t){this.__initial_state__=t},s.prototype.set_accept_states=function(t){for(var e=0;e<t.length;e++)this.__accept_states__[t[e]]=!0},s.prototype.set_transitions=function(t){this.__transitions__=t},s.prototype.set_actions=function(t){this.__actions__=t},s.prototype.update_transition=function(t,e){this.__transitions__[t]=Object.assign(this.__transitions__[t]||Object(),e)},s.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]},e.exports=s},{}],2:[function(t,e,a){"use strict";var s=t("./lib/dfa.js");e.exports=function(t,e){function a(t,e){var a,s=t.bMarks[e],n=t.skipSpacesBack(t.eMarks[e],s),i=[],r=!1,o=!1;for(a=s;a<n;a++)switch(t.src.charCodeAt(a)){case 92:r=!0;break;case 96:!o&&r||(o=!o),96===t.src.charCodeAt(a-1)&&(o=!1),r=!1;break;case 124:o||r||i.push(a),r=!1;break;default:r=!1}return 0===i.length||(i[0]>s&&i.unshift(s-1),i[i.length-1]<n-1&&i.push(n)),i}function n(t,e,a){var s=t.bMarks[a]+t.tShift[a],n=t.eMarks[a],i=t.src.slice(s,n).match(/^\[([^\[\]]+)\](\[([^\[\]]+)\])?\s*$/),r={};return!!i&&(!!e||(r.text=i[1],r.label=i[2]||i[1],r.label=r.label.toLowerCase().replace(/\W+/g,""),r))}function i(t,s,n){var i,r,o,p=a(t,n),l={};return!(p.length<2)&&(!!s||(l.bounds=p,e.multiline&&(i=t.bMarks[n]+t.tShift[n],r=t.eMarks[n]-1,l.multiline=92===t.src.charCodeAt(r),l.multiline&&(o=t.eMarks[n],t.eMarks[n]=t.skipSpacesBack(r,i),l.bounds=a(t,n),t.eMarks[n]=o)),l))}function r(t,e,s){var n,i,r=a(t,s),o={aligns:[],wraps:[]},p=/^:?(-+|=+):?\+?$/;if(t.sCount[s]-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(o.wraps.push(43===i.charCodeAt(i.length-1)),(58===i.charCodeAt(0))<<4|58===i.charCodeAt(i.length-1-o.wraps[n])){case 0:o.aligns.push("");break;case 1:o.aligns.push("right");break;case 16:o.aligns.push("left");break;case 17:o.aligns.push("center")}}return!!e||o}function o(t,e,a){return t.bMarks[a]+t.tShift[a]===t.eMarks[a]}e=e||{},t.block.ruler.at("table",(function(t,a,p,l){var c,_,h,u,m,f,b,d,g,k,y,w,v,x,M=new s,C=16,j=-1,S=[];if(a+2>p)return!1;if((_=new t.Token("table_open","table",1)).meta={sep:null,cap:null,tr:[]},M.set_highest_alphabet(65536),M.set_initial_state(65792),M.set_accept_states([65552,65553,0]),M.set_match_alphabets({65536:n.bind(this,t,!0),4096:r.bind(this,t,!0),256:i.bind(this,t,!0),16:i.bind(this,t,!0),1:o.bind(this,t,!0)}),M.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}}),e.headerless&&(M.set_initial_state(69888),M.update_transition(69888,{65536:4352,4096:65552,256:4352}),(h=new t.Token("table_fake_header_row","tr",1)).meta=Object()),M.set_actions((function(s,o,p){switch(p){case 65536:if(_.meta.cap)break;_.meta.cap=n(t,!1,s),_.meta.cap.map=[s,s+1],_.meta.cap.first=s===a;break;case 4096:_.meta.sep=r(t,!1,s),_.meta.sep.map=[s,s+1],h.meta.grp|=1,C=16;break;case 256:case 16:(h=new t.Token("tr_open","tr",1)).map=[s,s+1],h.meta=i(t,!1,s),h.meta.type=p,h.meta.grp=C,C=0,_.meta.tr.push(h),e.multiline&&(h.meta.multiline&&j<0?j=_.meta.tr.length-1:!h.meta.multiline&&j>=0&&((c=_.meta.tr[j]).meta.mbounds=_.meta.tr.slice(j).map((function(t){return t.meta.bounds})),c.map[1]=h.map[1],_.meta.tr=_.meta.tr.slice(0,j+1),j=-1));break;case 1:h.meta.grp|=1,C=16}})),!1===M.execute(a,p))return!1;if(!_.meta.tr.length)return!1;if(l)return!0;for(_.meta.tr[_.meta.tr.length-1].meta.grp|=1,_.map=b=[a,0],_.block=!0,_.level=t.level++,t.tokens.push(_),_.meta.cap&&((c=t.push("caption_open","caption",1)).map=_.meta.cap.map,c.attrs=[["id",_.meta.cap.label]],(c=t.push("inline","",0)).content=_.meta.cap.text,c.map=_.meta.cap.map,c.children=[],c=t.push("caption_close","caption",-1)),w=0;w<_.meta.tr.length;w++){for(m=new t.Token("table_fake_tcol_open","",1),16&(h=_.meta.tr[w]).meta.grp&&(g=256===h.meta.type?"thead":"tbody",(c=t.push(g+"_open",g,1)).map=d=[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]],""!==(k=t.src.slice.apply(t.src,y)))if(e.rowspan&&S[v]&&"^^"===k.trim())f=S[v].attrGet("rowspan"),S[v].attrSet("rowspan",null===f?2:f+1);else{if(g=256===h.meta.type?"th":"td",(c=t.push(g+"_open",g,1)).map=h.map,c.attrs=[],_.meta.sep.aligns[v]&&c.attrs.push(["style","text-align:"+_.meta.sep.aligns[v]]),_.meta.sep.wraps[v]&&c.attrs.push(["class","extend"]),m=S[v]=c,e.multiline&&h.meta.multiline&&h.meta.mbounds){for(k=[k.trimRight()],x=1;x<h.meta.mbounds.length;x++)v>h.meta.mbounds[x].length-2||(y=[h.meta.mbounds[x][v]+1,h.meta.mbounds[x][v+1]],k.push(t.src.slice.apply(t.src,y).trimRight()));t.md.block.parse(k.join("\n"),t.md,t.env,t.tokens)}else(c=t.push("inline","",0)).content=k.trim(),c.map=h.map,c.children=[];c=t.push(g+"_close",g,-1)}else u=m.attrGet("colspan"),m.attrSet("colspan",null===u?2:u+1);t.push("tr_close","tr",-1),1&h.meta.grp&&(g=256===h.meta.type?"thead":"tbody",c=t.push(g+"_close",g,-1),d[1]=h.map[1])}return b[1]=Math.max(d[1],_.meta.sep.map[1],_.meta.cap?_.meta.cap.map[1]:-1),c=t.push("table_close","table",-1),t.line=b[1],!0}),{alt:["paragraph","reference"]})}},{"./lib/dfa.js":1}]},{},[2])(2)}));

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

case 0x00010:
trToken = new state.Token('table_row_open', 'tr', 1);
trToken = new state.Token('tr_open', 'tr', 1);
trToken.map = [ _line, _line + 1 ];

@@ -259,3 +259,3 @@ trToken.meta = table_row(state, false, _line);

tag = (trToken.meta.type === 0x00100) ? 'thead' : 'tbody';
token = state.push('table_group_open', tag, 1);
token = state.push(tag + '_open', tag, 1);
token.map = tgroupLines = [ trToken.map[0], 0 ]; // array ref

@@ -285,3 +285,3 @@ upTokens = [];

tag = (trToken.meta.type === 0x00100) ? 'th' : 'td';
token = state.push('table_column_open', tag, 1);
token = state.push(tag + '_open', tag, 1);
token.map = trToken.map;

@@ -314,3 +314,3 @@ token.attrs = [];

token = state.push('table_column_close', tag, -1);
token = state.push(tag + '_close', tag, -1);
}

@@ -322,3 +322,3 @@

tag = (trToken.meta.type === 0x00100) ? 'thead' : 'tbody';
token = state.push('table_group_close', tag, -1);
token = state.push(tag + '_close', tag, -1);
tgroupLines[1] = trToken.map[1];

@@ -325,0 +325,0 @@ }

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

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

[![NPM version](https://img.shields.io/npm/v/markdown-it-multimd-table.svg?style=flat)](https://www.npmjs.org/package/markdown-it-multimd-table)
[![Build Status](https://api.travis-ci.org/RedBug312/markdown-it-multimd-table.svg?branch=master)](https://travis-ci.com/RedBug312/markdown-it-multimd-table)
[![Build Status](https://travis-ci.org/RedBug312/markdown-it-multimd-table.svg?branch=master)](https://travis-ci.org/RedBug312/markdown-it-multimd-table)
[![Coverage Status](https://coveralls.io/repos/github/RedBug312/markdown-it-multimd-table/badge.svg?branch=master)](https://coveralls.io/github/RedBug312/markdown-it-multimd-table?branch=master)

@@ -8,22 +8,34 @@

## Intro
When writing table in Markdown syntax, we have to fallback to write raw HTML tags, if we just need some advanced attribute like `colspan`.
[MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6/) is an extended Markdown spec covering fancy features.
It has defined some complete and clear rules for advanced Markdown table syntax, and aims to be compatible to basic table syntax as possible.
[markdown-it](https://markdown-it.github.io/) is a powerful and widely-used Markdown compiler, in native it supports basic table syntax only.
It allows plugins to expand it capability, and this plugin replaced the original table parser in markdown-it to support MultiMarkdown table syntax.
Markdown specs defines only the basics for tables. When users want common
features like `colspan`, they must fallback to raw HTML. And writing tables in
HTML is truly *lengthy and troublesome*.
For now, these extended features are provided:
- Cells spanning multiple columns
- Cells spanning multiple rows (optional)
- Grouped table header rows or data rows
- Table caption above or below the table
- Blocked elements (lists, codes, paragraphs...) in table (optional)
- Table header not required (optional)
This plugin extends markdown-it with MultiMarkdown table syntax.
[MultiMarkdown][mmd6] is an extended Markdown spec. It defines clear rules for
advanced Markdown table syntax, while being consistent with original pipe
table; [markdown-it][mdit] is a popular Markdown parser in JavaScript and
allows plugins extending itself.
Noted: the plugin is not a re-written of MultiMarkdown to deploy on markdown-it, it will generate HTML different from MultiMarkdown official compiler in some corner cases.
This plugin try to follow the rule defined in [MultiMarkdown User's Guide](http://fletcher.github.io/MultiMarkdown-5/tables) as possible.
If some case is reasonable but behaves strangely, please pose an issue for that.
[mmd6]: https://fletcher.github.io/MultiMarkdown-6/
[mdit]: https://markdown-it.github.io/
The features are provided:
- Cell spans over columns
- Cell spans over rows (optional)
- Divide rows into sections
- Multiple table headers
- Table caption
- Block-level elements such as lists, codes... (optional)
- Omitted table header (optional)
Noted that the plugin is not a re-written of MultiMarkdown. This plugin will
behave differently from the official compiler, but doing its best to obey rules
defined in [MultiMarkdown User's Guide](mmd6-table). Please pose an issue if
there are weird results for sensible inputs.
[mmd6-table]: https://fletcher.github.io/MultiMarkdown-6/syntax/tables.html
## Usage
```javascript

@@ -34,3 +46,3 @@ // defaults

// full options list (same to defaults)
// full options list (equivalent to defaults)
var md = require('markdown-it')()

@@ -46,3 +58,3 @@ .use(require('markdown-it-multimd-table'), {

To simply test this plugin, you can do these in terminal:
For a quick demo:
```javascript

@@ -74,3 +86,3 @@ $ mkdir markdown-it-multimd-table

And you will see the rendered table in the browser:
Here's the table expected on browser:

@@ -114,10 +126,9 @@ <table>

Noted that GitHub filters out `style` property, so the example displays with
the obsolete `align` property. But in actual this plugin outputs `style`
property with `text-align` CSS attribute.
Noted that GitHub filters out `style` property, so the example uses `align` the
obsolete one. However it outputs `style="text-align: ..."` in actual.
### Multiline (optional)
A backslash at end to join cell contents with the following lines.<br>
This feature is contributed by [Lucas-C](https://github.com/Lucas-C).
Backslash at end merges with line content below.<br>
Feature contributed by [Lucas-C](https://github.com/Lucas-C).

@@ -136,3 +147,3 @@ ```markdown

If this option is enabled, code above would be parsed as:
This is parsed below when the option enabled:

@@ -184,4 +195,4 @@ <table>

`^^` in a cell indicates it should be merged with the cell above.<br>
This feature is contributed by [pmccloghrylaing](https://github.com/pmccloghrylaing).
`^^` indicates cells being merged above.<br>
Feature contributed by [pmccloghrylaing](https://github.com/pmccloghrylaing).

@@ -201,3 +212,3 @@ ```markdown

If this option is enabled, code above would be parsed as:
This is parsed below when the option enabled:

@@ -261,3 +272,3 @@ <table>

If this option is enabled, code above would be parsed as:
This is parsed below when the option enabled:

@@ -351,6 +362,9 @@ <table>

* [MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6/), Lightweight markup processor to produce HTML, LaTeX, and more.
* [markdown-it](https://markdown-it.github.io/), Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed.
* [MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6/), Lightweight
markup processor to produce HTML, LaTeX, and more.
* [markdown-it](https://markdown-it.github.io/), Markdown parser, done right.
100% CommonMark support, extensions, syntax plugins & high speed.
## License
This software is licensed under the [MIT license](https://opensource.org/licenses/mit-license.php) © RedBug312.

Sorry, the diff of this file is not supported yet

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