Skip to content

Commit

Permalink
feat(subParser/tables.js): add support for md span elements in table …
Browse files Browse the repository at this point in the history
…headers

+ tests

Closes #179
  • Loading branch information
tivie committed Jul 22, 2015
1 parent bf4798a commit 789dc18
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/subParsers/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ showdown.subParser('tables', function (text, options, globals) {
if (options.tableHeaderId) {
id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
}
header = showdown.subParser('spanGamut')(header, options, globals);
if (!style || style.trim() === '') {
style = '';
} else {
Expand Down
16 changes: 16 additions & 0 deletions test/features/tables/#179.parse_md_in_table_ths.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<table>
<thead>
<tr>
<th><em>foo</em></th>
<th><strong>bar</strong></th>
<th><del>baz</del></th>
</tr>
</thead>
<tbody>
<tr>
<td>100</td>
<td>blabla</td>
<td>aaa</td>
</tr>
</tbody>
</table>
3 changes: 3 additions & 0 deletions test/features/tables/#179.parse_md_in_table_ths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
| *foo* | **bar** | ~~baz~~ |
|-------|---------|---------|
| 100 | blabla | aaa |
2 changes: 2 additions & 0 deletions test/node/testsuite.features.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ describe('makeHtml() features testsuite', function () {
for (var i = 0; i < tableSuite.length; ++i) {
if (tableSuite[i].name === 'basic_with_header_ids') {
converter = new showdown.Converter({tables: true, tableHeaderId: true});
} else if (tableSuite[i].name === '#179.parse_md_in_table_ths') {
converter = new showdown.Converter({tables: true, strikethrough: true});
} else {
converter = new showdown.Converter({tables: true});
}
Expand Down

0 comments on commit 789dc18

Please sign in to comment.