private void visitList(Node node) { newLine(); visitChildren(node); if (hasNext(node)) { newLine(); forceNewLine(); } }
/** * @since 1.0.1 */ @Override public void visit(CustomBlock customBlock) { if (customBlock instanceof TaskListBlock) { blockIndent += 1; visitChildren(customBlock); blockIndent -= 1; if (hasNext(customBlock)) { newLine(); forceNewLine(); } } else { super.visit(customBlock); } }
@Override public void visit(ThematicBreak thematicBreak) { newLine(); final int length = builder.length(); builder.append('\u00a0'); // without space it won't render setSpan(length, factory.thematicBreak(theme)); if (hasNext(thematicBreak)) { newLine(); forceNewLine(); } }
@Override public void visit(BlockQuote blockQuote) { newLine(); final int length = builder.length(); blockIndent += 1; visitChildren(blockQuote); setSpan(length, factory.blockQuote(theme)); blockIndent -= 1; if (hasNext(blockQuote)) { newLine(); forceNewLine(); } }
/** * @param info tag of a code block * @param code content of a code block * @since 1.0.4 */ private void visitCodeBlock(@Nullable String info, @NonNull String code, @NonNull Node node) { newLine(); final int length = builder.length(); // empty lines on top & bottom builder.append('\u00a0').append('\n'); builder.append( configuration.syntaxHighlight() .highlight(info, code) ); newLine(); builder.append('\u00a0'); setSpan(length, factory.code(theme, true)); if (hasNext(node)) { newLine(); forceNewLine(); } }
@Override public void visit(Heading heading) { newLine(); final int length = builder.length(); visitChildren(heading); setSpan(length, factory.heading(theme, heading.getLevel())); if (hasNext(heading)) { newLine(); // after heading we add another line anyway (no additional checks) forceNewLine(); } }
@Override public void visit(Paragraph paragraph) { final boolean inTightList = isInTightList(paragraph); if (!inTightList) { newLine(); } final int length = builder.length(); visitChildren(paragraph); // @since 1.1.1 apply paragraph span setSpan(length, factory.paragraph(inTightList)); if (hasNext(paragraph) && !inTightList) { newLine(); forceNewLine(); } }