FIX: Don't surround oneboxes by paragraphs

This commit is contained in:
Robin Ward 2014-07-04 15:12:30 -04:00
parent 7ab98bb0e7
commit 914f0c3512
1 changed files with 8 additions and 3 deletions

View File

@ -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) {