From 3a71b66d24e87516dac7a3a0ae3774748f135522 Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Mon, 8 Jun 2015 03:51:43 +0100 Subject: [PATCH] fix(subParsers/headers); fix bug introduced with noHeaderId option --- src/subParsers/headers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js index dd1a5e3..04e4dc3 100644 --- a/src/subParsers/headers.js +++ b/src/subParsers/headers.js @@ -13,14 +13,14 @@ 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) + '"', + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', 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) + '"', + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', hashBlock = '' + spanGamut + ''; return showdown.subParser('hashBlock')(hashBlock, options, globals); }); @@ -44,9 +44,9 @@ showdown.subParser('headers', function (text, options, globals) { /gm, function() {...}); */ - text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function (wholeMatch, m1, m2) { + 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(m1) + '"', + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"', header = '' + span + ''; return showdown.subParser('hashBlock')(header, options, globals);