All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.commonmark.renderer.NodeRenderer Maven / Gradle / Ivy

package org.commonmark.renderer;

import org.commonmark.node.Node;

import java.util.Set;

/**
 * A renderer for a set of node types.
 */
public interface NodeRenderer {

    /**
     * @return the types of nodes that this renderer handles
     */
    Set> getNodeTypes();

    /**
     * Render the specified node.
     *
     * @param node the node to render, will be an instance of one of {@link #getNodeTypes()}
     */
    void render(Node node);

    /**
     * Called before the root node is rendered, to do any initial processing at the start.
     *
     * @param rootNode the root (top-level) node
     */
    default void beforeRoot(Node rootNode) {
    }

    /**
     * Called after the root node is rendered, to do any final processing at the end.
     *
     * @param rootNode the root (top-level) node
     */
    default void afterRoot(Node rootNode) {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy