mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
feat(subParser/tables.js): add support for md span elements in table headers
+ tests Closes #179
This commit is contained in:
parent
bf4798a728
commit
789dc1806a
|
@ -15,6 +15,7 @@ showdown.subParser('tables', function (text, options, globals) {
|
||||||
if (options.tableHeaderId) {
|
if (options.tableHeaderId) {
|
||||||
id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
|
id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
|
||||||
}
|
}
|
||||||
|
header = showdown.subParser('spanGamut')(header, options, globals);
|
||||||
if (!style || style.trim() === '') {
|
if (!style || style.trim() === '') {
|
||||||
style = '';
|
style = '';
|
||||||
} else {
|
} else {
|
||||||
|
|
16
test/features/tables/#179.parse_md_in_table_ths.html
Normal file
16
test/features/tables/#179.parse_md_in_table_ths.html
Normal file
|
@ -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
test/features/tables/#179.parse_md_in_table_ths.md
Normal file
3
test/features/tables/#179.parse_md_in_table_ths.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
| *foo* | **bar** | ~~baz~~ |
|
||||||
|
|-------|---------|---------|
|
||||||
|
| 100 | blabla | aaa |
|
|
@ -36,6 +36,8 @@ describe('makeHtml() features testsuite', function () {
|
||||||
for (var i = 0; i < tableSuite.length; ++i) {
|
for (var i = 0; i < tableSuite.length; ++i) {
|
||||||
if (tableSuite[i].name === 'basic_with_header_ids') {
|
if (tableSuite[i].name === 'basic_with_header_ids') {
|
||||||
converter = new showdown.Converter({tables: true, tableHeaderId: true});
|
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 {
|
} else {
|
||||||
converter = new showdown.Converter({tables: true});
|
converter = new showdown.Converter({tables: true});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user