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 c3ff79aae4b..64a237ca464 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,5 +1,5 @@ -const BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote', 'canvas', 'dd', 'div', - 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', +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']; diff --git a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6 b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6 index 8416c8ec91d..af0cfca5db1 100644 --- a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6 +++ b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6 @@ -12,7 +12,8 @@ function replaceDetails(text) { // add new lines to make sure we *always* have a

element after and around // otherwise we can't hide the content since we can't target text nodes via CSS - return text.replace(/<\/summary>/ig, "\n\n").replace(/<\/details>/ig, "\n\n\n\n"); + return text.replace(/<\/summary>/ig, "\n\n") + .replace(/<\/details>/ig, "\n\n\n\n"); } registerOption((siteSettings, opts) => { @@ -20,6 +21,12 @@ registerOption((siteSettings, opts) => { }); export function setup(helper) { - helper.whiteList('details.elided'); + helper.whiteList([ + 'summary', + 'summary[title]', + 'details', + 'details.elided' + ]); + helper.addPreProcessor(text => replaceDetails(text)); }