FIX: Don't surround oneboxes by paragraphs
This commit is contained in:
parent
7ab98bb0e7
commit
914f0c3512
|
@ -101,6 +101,14 @@ function parseTree(tree, path, insideCounts) {
|
||||||
|
|
||||||
insideCounts[tagName] = insideCounts[tagName] - 1;
|
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();
|
path.pop();
|
||||||
}
|
}
|
||||||
return tree;
|
return tree;
|
||||||
|
@ -149,9 +157,6 @@ Discourse.Dialect = {
|
||||||
var tree = parser.toHTMLTree(text, 'Discourse'),
|
var tree = parser.toHTMLTree(text, 'Discourse'),
|
||||||
result = parser.renderJsonML(parseTree(tree));
|
result = parser.renderJsonML(parseTree(tree));
|
||||||
|
|
||||||
// This feature is largely for MDTest. We prefer to strip comments
|
|
||||||
// in Discourse
|
|
||||||
|
|
||||||
if (opts.sanitize) {
|
if (opts.sanitize) {
|
||||||
result = Discourse.Markdown.sanitize(result);
|
result = Discourse.Markdown.sanitize(result);
|
||||||
} else if (opts.sanitizerFunction) {
|
} else if (opts.sanitizerFunction) {
|
||||||
|
|
Loading…
Reference in New Issue