Package com.vladsch.flexmark.formatter
Interface NodeFormatterContext
-
- All Superinterfaces:
ExplicitAttributeIdProvider
,LinkResolverBasicContext
,LinkResolverContext
,com.vladsch.flexmark.util.format.NodeContext<com.vladsch.flexmark.util.ast.Node,NodeFormatterContext>
,TranslationContext
- All Known Implementing Classes:
NodeFormatterSubContext
public interface NodeFormatterContext extends com.vladsch.flexmark.util.format.NodeContext<com.vladsch.flexmark.util.ast.Node,NodeFormatterContext>, TranslationContext, LinkResolverContext, ExplicitAttributeIdProvider
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 handler@NotNull com.vladsch.flexmark.util.sequence.BasedSequence
getBlockQuoteLikePrefixChars()
@NotNull com.vladsch.flexmark.util.misc.CharPredicate
getBlockQuoteLikePrefixPredicate()
@NotNull com.vladsch.flexmark.util.ast.Document
getDocument()
@NotNull FormatterOptions
getFormatterOptions()
@NotNull FormattingPhase
getFormattingPhase()
@NotNull MarkdownWriter
getMarkdown()
@NotNull com.vladsch.flexmark.util.data.DataHolder
getOptions()
Get the current rendering contextDataHolder
.@NotNull com.vladsch.flexmark.util.format.TrackedOffsetList
getTrackedOffsets()
@NotNull com.vladsch.flexmark.util.sequence.BasedSequence
getTrackedSequence()
NOTE: parser can only use a contiguous sequence, not segmented.boolean
isRestoreTrackedSpaces()
@NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node>
nodesOfType(@NotNull Class<?>[] classes)
Get iterable of nodes of given types, in order of their appearance in the document tree, depth first traversal.@NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node>
nodesOfType(@NotNull Collection<Class<?>> classes)
void
render(@NotNull com.vladsch.flexmark.util.ast.Node node)
Render the specified node and its children using the configured renderers.void
renderChildren(@NotNull com.vladsch.flexmark.util.ast.Node parent)
Render the children of the node, used by custom renderers@NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node>
reversedNodesOfType(@NotNull Class<?>[] classes)
Get iterable of nodes of given types, in reverse order of their appearance in the document tree, depth first traversal.@NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node>
reversedNodesOfType(@NotNull Collection<Class<?>> classes)
-
Methods inherited from interface com.vladsch.flexmark.formatter.ExplicitAttributeIdProvider
addExplicitId
-
Methods inherited from interface com.vladsch.flexmark.html.renderer.LinkResolverContext
encodeUrl, getCurrentNode, resolveLink, resolveLink
-
Methods inherited from interface com.vladsch.flexmark.util.format.NodeContext
getCurrentNode, getSubContext, getSubContext, getSubContext
-
Methods inherited from interface com.vladsch.flexmark.formatter.TranslationContext
customPlaceholderFormat, getIdGenerator, getMergeContext, getRenderPurpose, getTranslationStore, isPostProcessingNonTranslating, isTransformingText, nonTranslatingSpan, postProcessNonTranslating, postProcessNonTranslating, transformAnchorRef, transformNonTranslating, transformTranslating, translatingRefTargetSpan, translatingSpan
-
-
-
-
Method Detail
-
getMarkdown
@NotNull @NotNull MarkdownWriter getMarkdown()
- Returns:
- the HTML writer to use
-
render
void render(@NotNull @NotNull com.vladsch.flexmark.util.ast.Node node)
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:
render
in interfaceLinkResolverContext
- Parameters:
node
- the node to render
-
renderChildren
void renderChildren(@NotNull @NotNull com.vladsch.flexmark.util.ast.Node parent)
Render the children of the node, used by custom renderers- Specified by:
renderChildren
in interfaceLinkResolverContext
- Parameters:
parent
- node the children of which are to be rendered
-
getFormattingPhase
@NotNull @NotNull FormattingPhase getFormattingPhase()
- Returns:
- current rendering phase
-
delegateRender
void delegateRender()
pass node rendering to previously registered handler
-
getOptions
@NotNull @NotNull com.vladsch.flexmark.util.data.DataHolder 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:
getOptions
in interfaceLinkResolverBasicContext
- Specified by:
getOptions
in interfaceLinkResolverContext
- Specified by:
getOptions
in interfacecom.vladsch.flexmark.util.format.NodeContext<com.vladsch.flexmark.util.ast.Node,NodeFormatterContext>
- Returns:
- the current renderer options
DataHolder
-
getFormatterOptions
@NotNull @NotNull FormatterOptions getFormatterOptions()
- Returns:
- the
FormatterOptions
for the context.
-
getDocument
@NotNull @NotNull com.vladsch.flexmark.util.ast.Document getDocument()
- Specified by:
getDocument
in interfaceLinkResolverBasicContext
- Specified by:
getDocument
in interfaceLinkResolverContext
- Returns:
- the
Document
node of the current context
-
getBlockQuoteLikePrefixPredicate
@NotNull @NotNull com.vladsch.flexmark.util.misc.CharPredicate getBlockQuoteLikePrefixPredicate()
- Returns:
- predicate for prefix chars which compact like block quote prefix char
-
getBlockQuoteLikePrefixChars
@NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence getBlockQuoteLikePrefixChars()
- Returns:
- char sequence of all prefix chars which compact like block quote prefix char
-
getTrackedOffsets
@NotNull @NotNull com.vladsch.flexmark.util.format.TrackedOffsetList getTrackedOffsets()
- Returns:
- tracked offset list
-
isRestoreTrackedSpaces
boolean isRestoreTrackedSpaces()
-
getTrackedSequence
@NotNull @NotNull com.vladsch.flexmark.util.sequence.BasedSequence 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.NULL
when 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
@NotNull @NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node> nodesOfType(@NotNull @NotNull Class<?>[] classes)
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.CoreNodeFormatter
registersRefNode
ifFormatter.REFERENCE_SORT
is set toElementPlacementSort.SORT_UNUSED_LAST
so that- Parameters:
classes
- node classes to return- Returns:
- iterable
-
nodesOfType
@NotNull @NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node> nodesOfType(@NotNull @NotNull Collection<Class<?>> classes)
-
reversedNodesOfType
@NotNull @NotNull Iterable<? extends com.vladsch.flexmark.util.ast.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.CoreNodeFormatter
registersRefNode
ifFormatter.REFERENCE_SORT
is set toElementPlacementSort.SORT_UNUSED_LAST
so that- Parameters:
classes
- node classes to return- Returns:
- iterable
-
reversedNodesOfType
@NotNull @NotNull Iterable<? extends com.vladsch.flexmark.util.ast.Node> reversedNodesOfType(@NotNull @NotNull Collection<Class<?>> classes)
-
-