From 789dc1806a93b1d4f171ee76dbc0c64c64de7f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o=20Soares=20dos=20Santos?= Date: Wed, 22 Jul 2015 12:03:38 +0100 Subject: [PATCH] feat(subParser/tables.js): add support for md span elements in table headers + tests Closes #179 --- src/subParsers/tables.js | 1 + .../tables/#179.parse_md_in_table_ths.html | 16 ++++++++++++++++ .../tables/#179.parse_md_in_table_ths.md | 3 +++ test/node/testsuite.features.js | 2 ++ 4 files changed, 22 insertions(+) create mode 100644 test/features/tables/#179.parse_md_in_table_ths.html create mode 100644 test/features/tables/#179.parse_md_in_table_ths.md diff --git a/src/subParsers/tables.js b/src/subParsers/tables.js index 79e81c8e..104db35e 100644 --- a/src/subParsers/tables.js +++ b/src/subParsers/tables.js @@ -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 { diff --git a/test/features/tables/#179.parse_md_in_table_ths.html b/test/features/tables/#179.parse_md_in_table_ths.html new file mode 100644 index 00000000..e641c3af --- /dev/null +++ b/test/features/tables/#179.parse_md_in_table_ths.html @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + +
foobarbaz
100blablaaaa
diff --git a/test/features/tables/#179.parse_md_in_table_ths.md b/test/features/tables/#179.parse_md_in_table_ths.md new file mode 100644 index 00000000..42f88d85 --- /dev/null +++ b/test/features/tables/#179.parse_md_in_table_ths.md @@ -0,0 +1,3 @@ +| *foo* | **bar** | ~~baz~~ | +|-------|---------|---------| +| 100 | blabla | aaa | diff --git a/test/node/testsuite.features.js b/test/node/testsuite.features.js index 948fbf50..96db8f63 100644 --- a/test/node/testsuite.features.js +++ b/test/node/testsuite.features.js @@ -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}); }