Add optional spans for list blocks

This commit is contained in:
Dimitry Ivanov 2019-04-19 13:50:14 +03:00
parent 7f3f3368be
commit 83995b05f4

View File

@ -17,10 +17,16 @@ public class SimpleBlockNodeVisitor implements MarkwonVisitor.NodeVisitor<Node>
@Override
public void visit(@NonNull MarkwonVisitor visitor, @NonNull Node node) {
// @since 3.0.1-SNAPSHOT we keep track of start in order to apply spans (optionally)
final int length = visitor.length();
visitor.ensureNewLine();
visitor.visitChildren(node);
// @since 3.0.1-SNAPSHOT we apply optional spans
visitor.setSpansForNodeOptional(node, length);
if (visitor.hasNext(node)) {
visitor.ensureNewLine();
visitor.forceNewLine();