diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/html.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown/html.js.es6 index 64a237ca464..0e5c5e4a18c 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/html.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/html.js.es6 @@ -1,7 +1,7 @@ const BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote', 'canvas', 'dd', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'iframe', 'noscript', 'ol', 'output', - 'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video']; + 'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video', 'summary']; function splitAtLast(tag, block, next, first) { const endTag = ``; @@ -34,7 +34,7 @@ export function setup(helper) { } } - const m = /^<([^>]+)\>/.exec(block); + const m = /^\s*<\/?([^>]+)\>/.exec(block); if (m && m[1]) { const tag = m[1].split(/\s/); if (tag && tag[0] && BLOCK_TAGS.indexOf(tag[0]) !== -1) { diff --git a/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 b/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 index fe263538c53..59e8d9266d4 100644 --- a/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 +++ b/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 @@ -57,11 +57,11 @@ test("pollOptionsCount", function() { const controller = this.subject(); controller.siteSettings = Discourse.SiteSettings; - controller.set("pollOptions", "1\n2\n") + controller.set("pollOptions", "1\n2\n"); equal(controller.get("pollOptionsCount"), 2, "it should equal 2"); - controller.set("pollOptions", "") + controller.set("pollOptions", ""); equal(controller.get("pollOptionsCount"), 0, "it should equal 0"); }); diff --git a/test/javascripts/lib/pretty-text-test.js.es6 b/test/javascripts/lib/pretty-text-test.js.es6 index e4ef370a01e..9549d06566b 100644 --- a/test/javascripts/lib/pretty-text-test.js.es6 +++ b/test/javascripts/lib/pretty-text-test.js.es6 @@ -696,3 +696,13 @@ test("emoji - emojiSet", () => { { emojiSet: 'twitter' }, `

:smile:

`); }); + +test("details", () => { + cooked(`
Infocoucou
`, + `
Info\n\n

coucou

\n\n
`, + "manual HTML for details"); + cooked(`
Infocoucou
`, + `
Info\n\n

coucou

\n\n
`, + "manual HTML for details with a space"); +}); +