diff --git a/.gitignore b/.gitignore index ab96a23..8778302 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules npm-debug.log localtest.html +/*.test.* diff --git a/dist/showdown.js b/dist/showdown.js index 4e3bac8..d6ae105 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index 12a16c8..7e063d5 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 82dd554..c380470 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index c0b8fa1..2fd90be 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js index a564d1c..4a814f8 100644 --- a/src/subParsers/headers.js +++ b/src/subParsers/headers.js @@ -1,7 +1,8 @@ showdown.subParser('headers', function (text, options, globals) { 'use strict'; - var prefixHeader = options.prefixHeaderId; + var prefixHeader = options.prefixHeaderId, + headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart); // Set text-style headers: // Header 1 @@ -13,16 +14,16 @@ showdown.subParser('headers', function (text, options, globals) { text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function (wholeMatch, m1) { var spanGamut = showdown.subParser('spanGamut')(m1, options, globals), - hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', - hLevel = parseInt(options.headerLevelStart), - hashBlock = '' + spanGamut + ''; + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', + hLevel = headerLevelStart, + hashBlock = '' + spanGamut + ''; return showdown.subParser('hashBlock')(hashBlock, options, globals); }); text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function (matchFound, m1) { var spanGamut = showdown.subParser('spanGamut')(m1, options, globals), - hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', - hLevel = parseInt(options.headerLevelStart) + 1, + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', + hLevel = headerLevelStart + 1, hashBlock = '' + spanGamut + ''; return showdown.subParser('hashBlock')(hashBlock, options, globals); }); @@ -48,9 +49,9 @@ showdown.subParser('headers', function (text, options, globals) { text = text.replace(/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm, function (wholeMatch, m1, m2) { var span = showdown.subParser('spanGamut')(m2, options, globals), - hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"', - hLevel = parseInt(options.headerLevelStart) - 1 + m1.length, - header = '' + span + ''; + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"', + hLevel = headerLevelStart - 1 + m1.length, + header = '' + span + ''; return showdown.subParser('hashBlock')(header, options, globals); }); diff --git a/test/single.test.wrapper.js b/test/single.test.wrapper.js deleted file mode 100644 index 7a6a418..0000000 --- a/test/single.test.wrapper.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Created by Estevao on 10-07-2015. - */ -/* -var showdown = require('../dist/showdown.js'), - bootstrap = require('./bootstrap.js'), - assertion = bootstrap.assertion, - testsuite = bootstrap.getTestSuite('test/features/'); - -describe('makeHtml() single test', function () { - 'use strict'; -}); -*/