Interface NodeRendererContext
- All Superinterfaces:
LinkResolverBasicContext
,LinkResolverContext
- All Known Implementing Classes:
HtmlRenderer.MainNodeRenderer
,HtmlRenderer.MainNodeRenderer.SubNodeRenderer
,NodeRendererSubContext
The context for node rendering, including configuration and functionality for the node renderer to use.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
pass node rendering to previously registered handlervoid
Increment the do not render links in this context.void
doNotRenderLinks
(boolean doNotRenderLinks) Increment/Decrement the do not render links in this context.void
Decrement the do not render links in this context.@NotNull MutableAttributes
extendRenderingNodeAttributes
(@NotNull AttributablePart part, @Nullable Attributes attributes) Extend the attributes by extensions for the node being currently rendered.@NotNull MutableAttributes
extendRenderingNodeAttributes
(@NotNull Node node, @NotNull AttributablePart part, @Nullable Attributes attributes) Extend the attributes by extensions for the node being currently rendered.@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.@NotNull HtmlRendererOptions
@NotNull HtmlWriter
@Nullable String
Get the id attribute for the given node.@NotNull RenderingPhase
@NotNull NodeRendererContext
getSubContext
(boolean inheritIndent) Creates a child rendering context that can be used to collect rendered html text.boolean
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 Details
-
extendRenderingNodeAttributes
@NotNull @NotNull MutableAttributes extendRenderingNodeAttributes(@NotNull @NotNull AttributablePart part, @Nullable @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 @NotNull MutableAttributes extendRenderingNodeAttributes(@NotNull @NotNull Node node, @NotNull @NotNull AttributablePart part, @Nullable @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
- Returns:
- the HTML writer to use
-
getSubContext
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
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
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:
-
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:
-
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.- See Also:
-
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:
IllegalStateException
- if the current doNotRender links value is 0.- See Also:
-
getRenderingPhase
- Returns:
- current rendering phase
-
getHtmlOptions
- Returns:
- the
HtmlRendererOptions
for the context.
-