3 module.exports = block;
5 /* Stringify a block node with block children (e.g., `root`
7 * Knows about code following a list, or adjacent lists
8 * with similar bullets, and places an extra newline
10 function block(node) {
13 var children = node.children;
14 var length = children.length;
19 while (++index < length) {
20 child = children[index];
23 /* Duplicate nodes, such as a list
24 * directly following another list,
25 * often need multiple new lines.
27 * Additionally, code blocks following a list
28 * might easily be mistaken for a paragraph
29 * in the list itself. */
30 if (child.type === prev.type && prev.type === 'list') {
31 values.push(prev.ordered === child.ordered ? '\n\n\n' : '\n\n');
32 } else if (prev.type === 'list' && child.type === 'code' && !child.lang) {
33 values.push('\n\n\n');
39 values.push(self.visit(child, node));
44 return values.join('');