Interface NodeRendererContext
-
- All Superinterfaces:
LinkResolverBasicContext
,LinkResolverContext
- All Known Implementing Classes:
NodeRendererSubContext
public interface NodeRendererContext extends LinkResolverContext
The context for node rendering, including configuration and functionality for the node renderer to use.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delegateRender()
pass node rendering to previously registered handlervoid
doNotRenderLinks()
Increment the do not render links in this context.void
doNotRenderLinks(boolean doNotRenderLinks)
Increment/Decrement the do not render links in this context.void
doRenderLinks()
Decrement the do not render links in this context.MutableAttributes
extendRenderingNodeAttributes(AttributablePart part, Attributes attributes)
Extend the attributes by extensions for the node being currently rendered.MutableAttributes
extendRenderingNodeAttributes(Node node, AttributablePart part, Attributes attributes)
Extend the attributes by extensions for the node being currently rendered.NodeRendererContext
getDelegatedSubContext(boolean inheritIndent)
Creates a child rendering context that can be used to collect rendered html text of the previously registered node renderer.HtmlRendererOptions
getHtmlOptions()
HtmlWriter
getHtmlWriter()
java.lang.String
getNodeId(Node node)
Get the id attribute for the given node.RenderingPhase
getRenderingPhase()
NodeRendererContext
getSubContext(boolean inheritIndent)
Creates a child rendering context that can be used to collect rendered html text.boolean
isDoNotRenderLinks()
Whether the current rendering context has link rendering disabled.-
Methods inherited from interface com.vladsch.flexmark.html.renderer.LinkResolverContext
encodeUrl, getCurrentNode, getDocument, getOptions, render, renderChildren, resolveLink, resolveLink
-
-
-
-
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 attributesattributes
- 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 attributespart
- the tag of the node being rendered, some nodes render multiple tags with attributesattributes
- 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 theHtmlIdGenerator
assigned for the context. Default generator only creates ids forHeading
nodes or custom nodes that implementAnchorRefTarget
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)
-
doNotRenderLinks
void doNotRenderLinks()
Increment 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.
-
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
-
getHtmlOptions
@NotNull HtmlRendererOptions getHtmlOptions()
- Returns:
- the
HtmlRendererOptions
for the context.
-
-