Interface NodeRendererContext

    • Method Detail

      • extendRenderingNodeAttributes

        @NotNull
        MutableAttributes extendRenderingNodeAttributes​(@NotNull
                                                        AttributablePart part,
                                                        @Nullable
                                                        Attributes attributes)
        Extend the attributes by extensions for the node being currently rendered.
        Parameters:
        part - the tag of the node being rendered, some nodes render multiple tags with attributes
        attributes - the attributes that were calculated by the renderer or null, these may be modified. To preserve originals pass a copy.
        Returns:
        the extended attributes with added/updated/removed entries
      • extendRenderingNodeAttributes

        @NotNull
        MutableAttributes extendRenderingNodeAttributes​(@NotNull
                                                        Node node,
                                                        @NotNull
                                                        AttributablePart part,
                                                        @Nullable
                                                        Attributes attributes)
        Extend the attributes by extensions for the node being currently rendered.
        Parameters:
        node - node for which to get attributes
        part - the tag of the node being rendered, some nodes render multiple tags with attributes
        attributes - the attributes that were calculated by the renderer or null, these may be modified. To preserve originals pass a copy.
        Returns:
        the extended attributes with added/updated/removed entries
      • getHtmlWriter

        @NotNull
        HtmlWriter getHtmlWriter()
        Returns:
        the HTML writer to use
      • getSubContext

        @NotNull
        NodeRendererContext getSubContext​(boolean inheritIndent)
        Creates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer, renderedNode, renderingHandler and doNotRenderLinksNesting from the parent.
        Parameters:
        inheritIndent - whether the html writer of the sub-context should inherit the current context's indentation level or start with 0 indentation
        Returns:
        a new rendering context with a given appendable for its output
      • getDelegatedSubContext

        @NotNull
        NodeRendererContext getDelegatedSubContext​(boolean inheritIndent)
        Creates a child rendering context that can be used to collect rendered html text of the previously registered node renderer. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.
        Parameters:
        inheritIndent - whether the html writer of the sub-context should inherit the current context's indentation level or start with 0 indentation
        Returns:
        a new rendering context with a given appendable for its output
      • delegateRender

        void delegateRender()
        pass node rendering to previously registered handler
      • getNodeId

        @Nullable
        java.lang.String getNodeId​(@NotNull
                                   Node node)
        Get the id attribute for the given node.
        Parameters:
        node - node for which to get an id, depends on the HtmlIdGenerator assigned for the context. Default generator only creates ids for Heading nodes or custom nodes that implement AnchorRefTarget interface.
        Returns:
        id string or null
      • isDoNotRenderLinks

        boolean isDoNotRenderLinks()
        Whether the current rendering context has link rendering disabled. When true any renderer that would render a link, should only output the text of that link and image links should not render anything.
        Returns:
        true if links should be output as only text.
        See Also:
        isDoNotRenderLinks(), doNotRenderLinks(), doRenderLinks(), doNotRenderLinks(boolean)
      • doNotRenderLinks

        void doNotRenderLinks​(boolean doNotRenderLinks)
        Increment/Decrement the do not render links in this context. This value will persist for the duration of the current node's render() method and will be restored upon return. Effectively it will persist for the rendering of the children of this node.
        Parameters:
        doNotRenderLinks - if true then increment the doNotRenderLinks value, else decrement it
        See Also:
        isDoNotRenderLinks(), doNotRenderLinks(), doRenderLinks(), doNotRenderLinks(boolean)
      • doRenderLinks

        void doRenderLinks()
        Decrement the do not render links in this context. This value will persist for the duration of the current node's render() method and will be restored upon return. Effectively it will persist for the rendering of the children of this node.
        Throws:
        java.lang.IllegalStateException - if the current doNotRender links value is 0.
        See Also:
        isDoNotRenderLinks(), doNotRenderLinks(), doRenderLinks(), doNotRenderLinks(boolean)
      • getRenderingPhase

        @NotNull
        RenderingPhase getRenderingPhase()
        Returns:
        current rendering phase