diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js index 5a79493..d8dfc2f 100644 --- a/src/subParsers/headers.js +++ b/src/subParsers/headers.js @@ -40,7 +40,7 @@ showdown.subParser('headers', function (text, options, globals) { // ... // ###### Header 6 // - 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(m2) + '"', hLevel = headerLevelStart - 1 + m1.length, diff --git a/test/features/#69.header-level-start.md b/test/features/#69.header-level-start.md index e7d12c6..62a24dc 100644 --- a/test/features/#69.header-level-start.md +++ b/test/features/#69.header-level-start.md @@ -1,8 +1,8 @@ -#Given +# Given -#When +# When -#Then +# Then foo === diff --git a/test/issues/#nnn.headers-require-spaces.html b/test/issues/#nnn.headers-require-spaces.html new file mode 100644 index 0000000..990c1c3 --- /dev/null +++ b/test/issues/#nnn.headers-require-spaces.html @@ -0,0 +1,3 @@ +
#I am not a header
diff --git a/test/issues/#nnn.headers-require-spaces.md b/test/issues/#nnn.headers-require-spaces.md new file mode 100644 index 0000000..3b51b9f --- /dev/null +++ b/test/issues/#nnn.headers-require-spaces.md @@ -0,0 +1,3 @@ +# I am a header + +#I am not a header