Fix html stripping related to preview mode (#70)

* Don't strip top level html

* Fix html stripping related to preview mode
This commit is contained in:
Tony Tomarchio
2018-01-27 17:08:51 -08:00
committed by Tom MacWright
parent 3f9a511f9a
commit 4999028cac

View File

@ -53,16 +53,8 @@ function chunkifyAST(ast, language) {
} else if (node.type === 'heading' && node.depth < 4 && !title) { } else if (node.type === 'heading' && node.depth < 4 && !title) {
title = node.children[0].value; title = node.children[0].value;
left.push(node); left.push(node);
} else if (node.type === 'html') { } else if (node.type === 'html' && node.value.match(/^<!--\s*preview\s*-->$/)) {
if (node.value.indexOf('<!--') === 0) { preview = true;
var content = node.value
.replace(/^<!--/, '')
.replace(/-->$/, '')
.trim();
if (content === 'preview') {
preview = true;
}
}
} else { } else {
left.push(node); left.push(node);
} }