From 0c933a01f93cc8618a9358839ea57f0c4097492d Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Thu, 23 Nov 2017 05:39:53 +0000 Subject: [PATCH] fix(tables): pipe character in code spans no longer breaks table A code span with a pipe character no longer incorrectly breaks the cell table. Closes #465 --- dist/showdown.js | Bin 168070 -> 168233 bytes dist/showdown.js.map | Bin 417412 -> 417844 bytes dist/showdown.min.js | Bin 96637 -> 96677 bytes dist/showdown.min.js.map | Bin 73696 -> 73761 bytes src/subParsers/tables.js | 4 +++- ...465.code-spans-with-pipes-break-table.html | 14 ++++++++++++++ .../#465.code-spans-with-pipes-break-table.md | 3 +++ 7 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/features/tables/#465.code-spans-with-pipes-break-table.html create mode 100644 test/features/tables/#465.code-spans-with-pipes-break-table.md diff --git a/dist/showdown.js b/dist/showdown.js index 5b3ca7462beab7546afa2f93c2501dc3c81670e7..eaf5306c9ecf1cd9c622727a0db675716ac075bf 100644 GIT binary patch delta 142 zcmZo$$hC42S3?Wq7N$A%(=+Or1g3weXHu9xr=H1WI$s0RD^~>teSL+3#G>Lx4(h`O8RE7M!oJxh_(t?8gq7on{RUs!6NFbDRO<&i*BsRTd kHlxV&`DskNJc&s;sXjn8#nG9u(;H_pN^bwrz|_YN0FLQ20RR91 delta 34 qcmZ3vh^uWOS3?Wq7N$A%)6dj1xlF&@#AGsEtbyst_Sub0ef$9aE)FaJ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index e22d7469c76b61a9c097798b985a76b6a37bf653..8e7bb06a62fcce7e6ccdeb1f803bc428151c6079 100644 GIT binary patch delta 363 zcmZqKE4k%>WJ3#M3)2?nMH8ma*}=#^*B zFo8LOsmOKuLv3cM$qpeRlP~14Zoe>*xq)$dz#L}Q$pUFyVAYcsr~-97Wds@^$;?0b zz+|rJ4G$UlrYCG?WShJ}j%%_)CD$aN;06(pp|wn$jIPr!gfmM`>foOqu#ZV@dXh7< z2_YykO*IDs!72c$86Px{V3Yv-1^9Y~S1z6!i5K3KENo zQx%f)Q&JU*3lj5+71A<`ic549l1fVy%2O5c^KvQ`ic1R$@{3AZvefs$-X0FK&AtIA6BpljQUTM;N)b*G*wo6kx1qU$BH3h*`ETSi;)7a(bK}o9pyvK5PQhCj_#oPG9NA M_F=nC0NW3K0B%A!&;S4c diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 66635207e099ee058a719b3186a57052e6e50495..181033ceba8df6b5a0b57b73fb0c557a2d7e54dd 100644 GIT binary patch delta 502 zcmZutyH3L}6qSYAfr){F#8fg=wrV*+3<#wj5E~PF8bp<*wWVMuw!>12_zQmlj}PE0 z_#Bv#u#=)jg5_TO*yo&k&-Z8V`K$Nz4nE2&fhAoMT^8KHU@8I>FQkHkMzNSkQsiQ3 zSUesJ6y6M15k6f{A3|bsZJ$>ITko#@B;rx<)I5yJYAgwon_)dcW;jASq zs2zfv=dME0HCp-DeH?SYFmw5{Nw)pK8jG{S2_-B=c-~4IxIvt{gHc?z_#CZOZfYfl MGnnD>b*(}F2WdK@od5s; delta 496 zcmZutu};G<5S4|>z{CIyOd&&MtCkbQz>s)|vN5rziBv^tVksm}?68zd{6)T?;s^K& z2E-rm4=^KPJE%2^SgU*_dWahnmxaQH+~o3kmf}2l1XSUD;s(1x`hFCy}%Di znN_(gyu~6wPGW6be6w9XIYeec!Y~SAG@qMH)uTUa06zVL-Z$X##Cu$|R;8xg{-XiT zQBA}Cy#d#epizvO4y6vM3g&>2h=Q#pMEFqsbChjgQN24RvSklYog)bEM4^w;n@EB@ zwuaRx#IMH!wVCYN%E~8d_dTPw9B49FYn4+|_FQJH|GWU_NjW;9Gqr7m+3>rCl|ry- zPbtLI*NygD+tX@dKQ*>NirQ^aG0yMbH65mEFCMqWDL9omlCR*>QJWhcP# EFW9b}L;wH) diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index 292ceee5256863281590b8163b6fd645009ce60d..6e938d8481d204c08603caf313ed3670556414d7 100644 GIT binary patch delta 125 zcmaE`pJm|zmWC~ijAD$g)0xB=^?;P27~^ao_ac{KGiM!FN5}9Sb7viQM@MfD5HA=g z80zR4s*~vGm{@LtqQcY239Q7V45Y!`&{fCN(b3byYx{LEMj;laEYIn$r5GKV(!I9p JNi%L@0RXE6B9{OF delta 60 zcmZ2@faSq{mWC~ijAD%L)0xB=^%$L}8;UW`=JqUe(eZS2^ei=V-Yy}|D8#~~?=f9R Qn$eNT!gG7RG~*@~00Vaqh5!Hn diff --git a/src/subParsers/tables.js b/src/subParsers/tables.js index 826d2a0..77851f5 100644 --- a/src/subParsers/tables.js +++ b/src/subParsers/tables.js @@ -61,14 +61,16 @@ showdown.subParser('tables', function (text, options, globals) { function parseTable (rawTable) { var i, tableLines = rawTable.split('\n'); - // strip wrong first and last column if wrapped tables are used for (i = 0; i < tableLines.length; ++i) { + // strip wrong first and last column if wrapped tables are used if (/^ {0,3}\|/.test(tableLines[i])) { tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, ''); } if (/\|[ \t]*$/.test(tableLines[i])) { tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, ''); } + // parse code spans first, but we only support one line code spans + tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals); } var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}), diff --git a/test/features/tables/#465.code-spans-with-pipes-break-table.html b/test/features/tables/#465.code-spans-with-pipes-break-table.html new file mode 100644 index 0000000..9be5dc1 --- /dev/null +++ b/test/features/tables/#465.code-spans-with-pipes-break-table.html @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +
PowerShell commandExample
Get-ServiceGet-Service | Stop-Service -WhatIf
diff --git a/test/features/tables/#465.code-spans-with-pipes-break-table.md b/test/features/tables/#465.code-spans-with-pipes-break-table.md new file mode 100644 index 0000000..f605e12 --- /dev/null +++ b/test/features/tables/#465.code-spans-with-pipes-break-table.md @@ -0,0 +1,3 @@ +|PowerShell command|Example| +|--|--| +|Get-Service|`Get-Service | Stop-Service -WhatIf`|