From 66bdd21312e06e29a22328e837a8be18e0cc12d0 Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Fri, 6 Oct 2017 12:52:20 +0100 Subject: [PATCH] fix(tables): trailing spaces no longer prevent table parsing If there were a trailing space following the closing | of a single column table, the table does not get rendered. This fixes the issue. Closes #442 --- dist/showdown.js | Bin 93616 -> 93634 bytes dist/showdown.js.map | Bin 270784 -> 270865 bytes dist/showdown.min.js | Bin 39594 -> 39612 bytes dist/showdown.min.js.map | Bin 41165 -> 41165 bytes src/subParsers/tables.js | 2 +- ...ailing-spaces-break-one-column-tables.html | 15 +++++++++++++++ ...trailing-spaces-break-one-column-tables.md | 4 ++++ 7 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/features/tables/#442.trailing-spaces-break-one-column-tables.html create mode 100644 test/features/tables/#442.trailing-spaces-break-one-column-tables.md diff --git a/dist/showdown.js b/dist/showdown.js index 1c912740ccf6ee7ab32cd5df939b8acd65ff2cd3..9fc0540232e8bad2456045e5f4cf5f772579eb0b 100644 GIT binary patch delta 57 zcmdmRoAuCb)`l&NRgrAb3Nau diff --git a/dist/showdown.js.map b/dist/showdown.js.map index 9e580f6fc1a9c7931d01a56fcb8fd433106aef2e..a7d55e4a5584d4bb1c7138ea954cebecdeacb6c1 100644 GIT binary patch delta 174 zcmX?bSYYB2frb{wElfA+CMOihO|xQ>oPMB?No3MXuF3Pmxu$QZVKM?qOy1znHTi%w z|Ktyxtdkd95t%%Ji*@>{nT%Z1Gv2JIi^2vWE7eFAeO6Lpn++-Km+rs9`DpVWj V7}v(c)aYpg38?&bbzYX4A^=BuJtzPG delta 97 zcmV-n0G|Jm#1O#45P*aMv;x?Eli=(lm%woX6q4x*lb=@#m#};SGMAA20UncJSqhVo z3I&(Ge*!B4YDtqY+ZBd@0=9qy7LAvH3#VN@BHQ@)W8Kbc}0bY9{}mW*{1qrvc;ZX~)z+)NI~1{R9}rVS70@|$=#T6h*Y>G(V5I60R2PkvZwuvuZ=S|$Jh=MDV; delta 34 qcmX?mkm>9}rVS70@*B82T6h*Y>G(V5I60R2PkvZwuvuZ=S|$Jha1HnX diff --git a/src/subParsers/tables.js b/src/subParsers/tables.js index 97a2eda..826d2a0 100644 --- a/src/subParsers/tables.js +++ b/src/subParsers/tables.js @@ -7,7 +7,7 @@ showdown.subParser('tables', function (text, options, globals) { var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n| + + + Single column + + + + + Row one + + + Row two + + + diff --git a/test/features/tables/#442.trailing-spaces-break-one-column-tables.md b/test/features/tables/#442.trailing-spaces-break-one-column-tables.md new file mode 100644 index 0000000..b3d0ae9 --- /dev/null +++ b/test/features/tables/#442.trailing-spaces-break-one-column-tables.md @@ -0,0 +1,4 @@ +| Single column | +|:--------------| +| Row one | +| Row two |