浏览代码

fix(tablesHeaderId): fix missmatch of option name

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
Estevao Soares dos Santos 8 年之前
父节点
当前提交
51e46933a4
共有 6 个文件被更改,包括 13 次插入7 次删除
  1. 9 4
      dist/showdown.js
  2. 0 0
      dist/showdown.js.map
  3. 1 1
      dist/showdown.min.js
  4. 0 0
      dist/showdown.min.js.map
  5. 2 1
      src/subParsers/tables.js
  6. 1 1
      test/node/testsuite.features.js

+ 9 - 4
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 07-06-2017 */
+;/*! showdown 04-08-2017 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -1431,8 +1431,12 @@ showdown.subParser('anchors', function (text, options, globals) {
       if (!showdown.helper.isString(options.ghMentionsLink)) {
         throw new Error('ghMentionsLink option must be a string');
       }
-      var lnk = options.ghMentionsLink.replace(/\{u}/g, username);
-      return st + '<a href="' + lnk + '">' + mentions + '</a>';
+      var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
+          target = '';
+      if (options.openLinksInNewWindow) {
+        target = ' target="¨E95Eblank"';
+      }
+      return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
     });
   }
 
@@ -2798,7 +2802,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);

文件差异内容过多而无法显示
+ 0 - 0
dist/showdown.js.map


文件差异内容过多而无法显示
+ 1 - 1
dist/showdown.min.js


文件差异内容过多而无法显示
+ 0 - 0
dist/showdown.min.js.map


+ 2 - 1
src/subParsers/tables.js

@@ -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);

+ 1 - 1
test/node/testsuite.features.js

@@ -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 {

部分文件因为文件数量过多而无法显示