org.commonmark.node.HtmlBlock Java Examples

The following examples show how to use org.commonmark.node.HtmlBlock. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonmarkPreviewRenderer.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void printAttributes(StringBuilder buf, Node node) {
	if (node instanceof Text)
		printAttribute(buf, "literal", ((Text)node).getLiteral());
	else if (node instanceof Code)
		printAttribute(buf, "literal", ((Code)node).getLiteral());
	else if (node instanceof IndentedCodeBlock)
		printAttribute(buf, "literal", ((IndentedCodeBlock)node).getLiteral());
	else if (node instanceof FencedCodeBlock)
		printAttribute(buf, "literal", ((FencedCodeBlock)node).getLiteral());
	else if (node instanceof HtmlBlock)
		printAttribute(buf, "literal", ((HtmlBlock)node).getLiteral());
	else if (node instanceof HtmlInline)
		printAttribute(buf, "literal", ((HtmlInline)node).getLiteral());
	else if (node instanceof Link) {
		printAttribute(buf, "destination", ((Link)node).getDestination());
		printAttribute(buf, "title", ((Link)node).getTitle());
	} else if (node instanceof Image) {
		printAttribute(buf, "destination", ((Image)node).getDestination());
		printAttribute(buf, "title", ((Image)node).getTitle());
	} else if (node instanceof Heading)
		printAttribute(buf, "level", ((Heading)node).getLevel());
}
 
Example #2
Source File: CorePlugin.java    From Markwon with Apache License 2.0 5 votes vote down vote up
/**
 * @return a set with enabled by default block types
 * @since 4.4.0
 */
@NonNull
public static Set<Class<? extends Block>> enabledBlockTypes() {
    return new HashSet<>(Arrays.asList(
            BlockQuote.class,
            Heading.class,
            FencedCodeBlock.class,
            HtmlBlock.class,
            ThematicBreak.class,
            ListBlock.class,
            IndentedCodeBlock.class
    ));
}
 
Example #3
Source File: MarkwonVisitorImpl.java    From Markwon with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(HtmlBlock htmlBlock) {
    visit((Node) htmlBlock);
}