Interface NodeFormatterContext
- All Superinterfaces:
ExplicitAttributeIdProvider, LinkResolverBasicContext, LinkResolverContext, NodeContext<Node, NodeFormatterContext>, TranslationContext
- All Known Implementing Classes:
Formatter.MainNodeFormatter, Formatter.MainNodeFormatter.SubNodeFormatter, NodeFormatterSubContext
public interface NodeFormatterContext
extends NodeContext<Node, NodeFormatterContext>, TranslationContext, LinkResolverContext, ExplicitAttributeIdProvider
The context for node rendering, including configuration and functionality for the node renderer to use.
-
Method Summary
Modifier and TypeMethodDescriptionvoidpass node rendering to previously registered handler@NotNull BasedSequence@NotNull CharPredicate@NotNull Document@NotNull FormatterOptions@NotNull FormattingPhase@NotNull MarkdownWriter@NotNull DataHolderGet the current rendering contextDataHolder.@NotNull TrackedOffsetList@NotNull BasedSequenceNOTE: parser can only use a contiguous sequence, not segmented.booleannodesOfType(@NotNull Class<?>[] classes) Get iterable of nodes of given types, in order of their appearance in the document tree, depth first traversal.nodesOfType(@NotNull Collection<Class<?>> classes) voidRender the specified node and its children using the configured renderers.voidrenderChildren(@NotNull Node parent) Render the children of the node, used by custom renderersreversedNodesOfType(@NotNull Class<?>[] classes) Get iterable of nodes of given types, in reverse order of their appearance in the document tree, depth first traversal.reversedNodesOfType(@NotNull Collection<Class<?>> classes) Methods inherited from interface ExplicitAttributeIdProvider
addExplicitIdMethods inherited from interface LinkResolverContext
encodeUrl, getCurrentNode, resolveLink, resolveLinkMethods inherited from interface NodeContext
getCurrentNode, getSubContext, getSubContext, getSubContextMethods inherited from interface TranslationContext
customPlaceholderFormat, getIdGenerator, getMergeContext, getRenderPurpose, getTranslationStore, isPostProcessingNonTranslating, isTransformingText, nonTranslatingSpan, postProcessNonTranslating, postProcessNonTranslating, transformAnchorRef, transformNonTranslating, transformTranslating, translatingRefTargetSpan, translatingSpan
-
Method Details
-
getMarkdown
- Returns:
- the HTML writer to use
-
render
Render the specified node and its children using the configured renderers. This should be used to render child nodes; be careful not to pass the node that is being rendered, that would result in an endless loop.- Specified by:
renderin interfaceLinkResolverContext- Parameters:
node- the node to render
-
renderChildren
Render the children of the node, used by custom renderers- Specified by:
renderChildrenin interfaceLinkResolverContext- Parameters:
parent- node the children of which are to be rendered
-
getFormattingPhase
- Returns:
- current rendering phase
-
delegateRender
void delegateRender()pass node rendering to previously registered handler -
getOptions
Get the current rendering contextDataHolder. These are the options passed or set on theFormatter.builder()or passed toFormatter.builder(DataHolder). To get the document options you should usegetDocument()as the data holder.- Specified by:
getOptionsin interfaceLinkResolverBasicContext- Specified by:
getOptionsin interfaceLinkResolverContext- Specified by:
getOptionsin interfaceNodeContext<Node, NodeFormatterContext>- Returns:
- the current renderer options
DataHolder
-
getFormatterOptions
- Returns:
- the
FormatterOptionsfor the context.
-
getDocument
- Specified by:
getDocumentin interfaceLinkResolverBasicContext- Specified by:
getDocumentin interfaceLinkResolverContext- Returns:
- the
Documentnode of the current context
-
getBlockQuoteLikePrefixPredicate
- Returns:
- predicate for prefix chars which compact like block quote prefix char
-
getBlockQuoteLikePrefixChars
- Returns:
- char sequence of all prefix chars which compact like block quote prefix char
-
getTrackedOffsets
- Returns:
- tracked offset list
-
isRestoreTrackedSpaces
boolean isRestoreTrackedSpaces() -
getTrackedSequence
NOTE: parser can only use a contiguous sequence, not segmented. Therefore, the AST offsets and base sequence from AST nodes has always an index into sequence equal to the offset. This sequence is set to notBasedSequence.NULLwhen the format sequence used for tracked offsets is not contiguous and TrackedOffset.offset is an offset from this sequence and need to be converted to index into this sequence to be used as an offset into AST sequence for offset conversion- Returns:
- original sequence used for tracked offsets.
-
nodesOfType
Get iterable of nodes of given types, in order of their appearance in the document tree, depth first traversal. Only node classes returned byNodeFormatter.getNodeClasses()of all loaded extensions will be available to formatters.CoreNodeFormatterregistersRefNodeifFormatter.REFERENCE_SORTis set toElementPlacementSort.SORT_UNUSED_LASTso that- Parameters:
classes- node classes to return- Returns:
- iterable
-
nodesOfType
@NotNull @NotNull Iterable<? extends Node> nodesOfType(@NotNull @NotNull Collection<Class<?>> classes) -
reversedNodesOfType
@NotNull @NotNull Iterable<? extends Node> reversedNodesOfType(@NotNull @NotNull Class<?>[] classes) Get iterable of nodes of given types, in reverse order of their appearance in the document tree, depth first traversal. Only node classes returned byNodeFormatter.getNodeClasses()of all loaded extensions will be available to formatters.CoreNodeFormatterregistersRefNodeifFormatter.REFERENCE_SORTis set toElementPlacementSort.SORT_UNUSED_LASTso that- Parameters:
classes- node classes to return- Returns:
- iterable
-
reversedNodesOfType
@NotNull @NotNull Iterable<? extends Node> reversedNodesOfType(@NotNull @NotNull Collection<Class<?>> classes)
-