From e0602fab75b7803b02bd1d5ec02089425f7beca3 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Wed, 19 Mar 2014 20:26:58 +0000 Subject: [PATCH] Add missing block elements fixes #90 --- src/showdown.js | 2 +- test/cases/html5-strutural-tags.html | 55 +++++++++++++++++++++++++++- test/cases/html5-strutural-tags.md | 55 +++++++++++++++++++++++++++- 3 files changed, 109 insertions(+), 3 deletions(-) diff --git a/src/showdown.js b/src/showdown.js index b488bad..dcae68b 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -375,7 +375,7 @@ var _HashHTMLBlocks = function(text) { ) // 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..8896a0e 100644 --- a/test/cases/html5-strutural-tags.html +++ b/test/cases/html5-strutural-tags.html @@ -20,4 +20,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 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