Interface LinkResolverContext
-
- All Superinterfaces:
LinkResolverBasicContext
- All Known Subinterfaces:
NodeFormatterContext
,NodeRendererContext
- All Known Implementing Classes:
NodeFormatterSubContext
,NodeRendererSubContext
public interface LinkResolverContext extends LinkResolverBasicContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull String
encodeUrl(@NotNull CharSequence url)
@NotNull com.vladsch.flexmark.util.ast.Node
getCurrentNode()
@NotNull com.vladsch.flexmark.util.ast.Document
getDocument()
@NotNull com.vladsch.flexmark.util.data.DataHolder
getOptions()
Get the current rendering contextDataHolder
.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 ResolvedLink
resolveLink(@NotNull LinkType linkType, @NotNull CharSequence url, @Nullable com.vladsch.flexmark.util.html.Attributes attributes, @Nullable Boolean urlEncode)
Resolve link for rendering.default @NotNull ResolvedLink
resolveLink(@NotNull LinkType linkType, @NotNull CharSequence url, @Nullable Boolean urlEncode)
Resolve link for rendering.
-
-
-
Method Detail
-
getOptions
@NotNull @NotNull com.vladsch.flexmark.util.data.DataHolder getOptions()
Get the current rendering contextDataHolder
. These are the options passed or set on theHtmlRenderer.builder()
or passed toHtmlRenderer.builder(DataHolder)
. To get the document options you should usegetDocument()
as the data holder.- Specified by:
getOptions
in interfaceLinkResolverBasicContext
- Returns:
- the current renderer options
DataHolder
-
getDocument
@NotNull @NotNull com.vladsch.flexmark.util.ast.Document getDocument()
- Specified by:
getDocument
in interfaceLinkResolverBasicContext
- Returns:
- the
Document
node of the current context
-
encodeUrl
@NotNull @NotNull String encodeUrl(@NotNull @NotNull CharSequence url)
- Parameters:
url
- to be encoded- Returns:
- an encoded URL (depending on the configuration)
-
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.- 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- Parameters:
parent
- node the children of which are to be rendered
-
getCurrentNode
@NotNull @NotNull com.vladsch.flexmark.util.ast.Node getCurrentNode()
- Returns:
- the current node being rendered
-
resolveLink
@NotNull default @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, @Nullable @Nullable Boolean urlEncode)
Resolve link for rendering. Link Resolvers are going to be called until one returns ResolvedLink with getStatus() != LinkStatus.UnknownA resolver can replace the url but not change the status letting downstream resolvers handle the rest. This is useful when a resolver does partial processing like macro expansion but does not know how to handle the rest.
Core processing will simply pass the link as is. It is up to extension LinkResolvers and AttributeProviders to make sense of the link and applicable attributes based on status.
- Parameters:
linkType
- type of link being rendered. Core defined links are Link, Image. Extensions can define their ownurl
- link url texturlEncode
- whether the link should be url encoded, if null then the value ofHtmlRenderer.PERCENT_ENCODE_URLS
will be used to determine whether the resolved URL is to be encoded.- Returns:
- resolved link url for this link and its resolved status
-
resolveLink
@NotNull @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, @Nullable @Nullable com.vladsch.flexmark.util.html.Attributes attributes, @Nullable @Nullable Boolean urlEncode)
Resolve link for rendering. Link Resolvers are going to be called until one returns ResolvedLink with getStatus() != LinkStatus.UnknownA resolver can replace the url but not change the status letting downstream resolvers handle the rest. This is useful when a resolver does partial processing like macro expansion but does not know how to handle the rest.
Core processing will simply pass the link as is. It is up to extension LinkResolvers and AttributeProviders to make sense of the link and applicable attributes based on status.
- Parameters:
linkType
- type of link being rendered. Core defined links are Link, Image. Extensions can define their ownurl
- link url textattributes
- link attributesurlEncode
- whether the link should be url encoded, if null then the value ofHtmlRenderer.PERCENT_ENCODE_URLS
will be used to determine whether the resolved URL is to be encoded.- Returns:
- resolved link url for this link and its resolved status
-
-