mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
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
This commit is contained in:
parent
d88b095f05
commit
66bdd21312
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -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|<ol|<ul|¨0)/gm,
|
||||
//singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
|
||||
singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|\n( {0,3}\|.+\|\n)*(?:\n|<ol|<ul|¨0)/gm;
|
||||
singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|<ol|<ul|¨0)/gm;
|
||||
|
||||
function parseStyles (sLine) {
|
||||
if (/^:[ \t]*--*$/.test(sLine)) {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left;">Single column</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align:left;">Row one</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;">Row two</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,4 @@
|
|||
| Single column |
|
||||
|:--------------|
|
||||
| Row one |
|
||||
| Row two |
|
Loading…
Reference in New Issue
Block a user