package ru.noties.markwon.core;

import android.support.annotation.NonNull;

import org.commonmark.node.Node;

import ru.noties.markwon.MarkwonVisitor;

/**
 * A {@link ru.noties.markwon.MarkwonVisitor.NodeVisitor} that ensures that a markdown
 * block starts with a new line, all children are visited and if further content available
 * ensures a new line after self. Does not render any spans
 *
 * @since 3.0.0
 */
public class SimpleBlockNodeVisitor implements MarkwonVisitor.NodeVisitor<Node> {
    @Override
    public void visit(@NonNull MarkwonVisitor visitor, @NonNull Node node) {

        visitor.ensureNewLine();

        visitor.visitChildren(node);

        if (visitor.hasNext(node)) {
            visitor.ensureNewLine();
            visitor.forceNewLine();
        }
    }
}

@@ -597,68 +597,320 @@
     
-visitor.ensureNewLine();%0A%0A        visitor.visitChildren(node
+// @since 3.0.1-SNAPSHOT we keep track of start in order to apply spans (optionally)%0A        final int length = visitor.length();%0A%0A        visitor.ensureNewLine();%0A%0A        visitor.visitChildren(node);%0A%0A        // @since 3.0.1-SNAPSHOT we apply optional spans%0A        visitor.setSpansForNodeOptional(node, length
 );%0A%0A

Add optional spans for list blocks