diff --git a/app/assets/javascripts/discourse/dialects/dialect.js b/app/assets/javascripts/discourse/dialects/dialect.js index 32c1fed30dd..d8fd7298dec 100644 --- a/app/assets/javascripts/discourse/dialects/dialect.js +++ b/app/assets/javascripts/discourse/dialects/dialect.js @@ -101,6 +101,14 @@ function parseTree(tree, path, insideCounts) { insideCounts[tagName] = insideCounts[tagName] - 1; } + + // If raw nodes are in paragraphs, pull them up + if (tree.length === 2 && tree[0] === 'p' && tree[1] instanceof Array && tree[1][0] === "__RAW") { + var text = tree[1][1]; + tree[0] = "__RAW"; + tree[1] = text; + } + path.pop(); } return tree; @@ -149,9 +157,6 @@ Discourse.Dialect = { var tree = parser.toHTMLTree(text, 'Discourse'), result = parser.renderJsonML(parseTree(tree)); - // This feature is largely for MDTest. We prefer to strip comments - // in Discourse - if (opts.sanitize) { result = Discourse.Markdown.sanitize(result); } else if (opts.sanitizerFunction) {