Skip to content

Commit

Permalink
fix(tables): fix table heading separators requiring 3 dashes instead …
Browse files Browse the repository at this point in the history
…of 2

Closes #256
  • Loading branch information
Estevão Soares dos Santos authored and Estevão Soares dos Santos committed May 17, 2016
1 parent 7700718 commit ddaacfc
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 15 deletions.
14 changes: 7 additions & 7 deletions dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/subParsers/tables.js
Expand Up @@ -5,14 +5,14 @@ showdown.subParser('tables', function (text, options, globals) {
return text;
}

var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){3,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){3,}[^]+?(?:\n\n|~0)/gm;
var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[^]+?(?:\n\n|~0)/gm;

function parseStyles(sLine) {
if (/^:[ \t]*---*$/.test(sLine)) {
if (/^:[ \t]*--*$/.test(sLine)) {
return ' style="text-align:left;"';
} else if (/^---*[ \t]*:[ \t]*$/.test(sLine)) {
} else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
return ' style="text-align:right;"';
} else if (/^:[ \t]*---*[ \t]*:$/.test(sLine)) {
} else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
return ' style="text-align:center;"';
} else {
return '';
Expand Down
@@ -0,0 +1,14 @@
<table>
<thead>
<tr>
<th>key</th>
<th>value</th>
</tr>
</thead>
<tbody>
<tr>
<td>My Key</td>
<td>My Value</td>
</tr>
</tbody>
</table>
@@ -0,0 +1,3 @@
|key|value|
|--|--|
|My Key|My Value|

0 comments on commit ddaacfc

Please sign in to comment.