diff --git a/src/showdown.js b/src/showdown.js index 25bed63..cc9a42d 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -375,7 +375,7 @@ Showdown.converter = function (converter_options) { ) // attacklab: there are sentinel newlines at end of document /gm,function(){...}}; */ - text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm, hashElement); + text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside|address|audio|canvas|figure|hgroup|output|video)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement); // Special case just for
. It was easier to make a special case than // to make the other regex more complicated. diff --git a/test/cases/html5-strutural-tags.html b/test/cases/html5-strutural-tags.html index 98698e8..90fbcb8 100644 --- a/test/cases/html5-strutural-tags.html +++ b/test/cases/html5-strutural-tags.html @@ -14,10 +14,63 @@
read -me
+ me -

the end

\ No newline at end of file +

the end

+ + + + + + + + +
Foo
Bar
+ + + + + + + + + + + + + + + +
Foo
Bar
Bar
+ + + + + +
My street
+ + + Sorry, your browser doesn't support the <canvas> element. + + +
+ An awesome picture +
Caption for the awesome picture
+
+ +
+

Main title

+

Secondary title

+
+ + \ No newline at end of file diff --git a/test/cases/html5-strutural-tags.md b/test/cases/html5-strutural-tags.md index 5b27728..c326836 100644 --- a/test/cases/html5-strutural-tags.md +++ b/test/cases/html5-strutural-tags.md @@ -13,4 +13,57 @@ me ignore me -the end \ No newline at end of file +the end + + + + + + + + +
Foo
Bar
+ + + + + + + + + + + + + + + +
Foo
Bar
Bar
+ + + + + +
My street
+ + + Sorry, your browser doesn't support the <canvas> element. + + +
+ An awesome picture +
Caption for the awesome picture
+
+ +
+

Main title

+

Secondary title

+
+ + \ No newline at end of file