Skip to content

Commit

Permalink
fix(tablesHeaderId): fix missmatch of option name
Browse files Browse the repository at this point in the history
In code, the option appeared both as 'tableHeaderId' and 'tablesHeaderId',
although only the first form had effect. In documentation was referenced
as 'tablesHeaderId'.
Option is now fixed in code to reflex the documentation and table parser
accepts both forms, with and without an s.

Closes #412
  • Loading branch information
tivie committed Aug 4, 2017
1 parent 1194d88 commit 51e4693
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
13 changes: 9 additions & 4 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.

6 changes: 3 additions & 3 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.

3 changes: 2 additions & 1 deletion src/subParsers/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ showdown.subParser('tables', function (text, options, globals) {
function parseHeaders (header, style) {
var id = '';
header = header.trim();
if (options.tableHeaderId) {
// support both tablesHeaderId and tableHeaderId due to error in documention so we don't break backwards compatibility
if (options.tablesHeaderId || options.tableHeaderId) {
id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
}
header = showdown.subParser('spanGamut')(header, options, globals);
Expand Down
2 changes: 1 addition & 1 deletion test/node/testsuite.features.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('makeHtml() features testsuite', function () {
suite = tableSuite;
for (var i = 0; i < suite.length; ++i) {
if (suite[i].name === 'basic-with-header-ids') {
converter = new showdown.Converter({tables: true, tableHeaderId: true});
converter = new showdown.Converter({tables: true, tablesHeaderId: true});
} else if (suite[i].name === '#179.parse-md-in-table-ths') {
converter = new showdown.Converter({tables: true, strikethrough: true});
} else {
Expand Down

0 comments on commit 51e4693

Please sign in to comment.