Interface LinkResolverContext

    • Method Detail

      • getDocument

        @NotNull
        @NotNull com.vladsch.flexmark.util.ast.Document getDocument()
        Specified by:
        getDocument in interface LinkResolverBasicContext
        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.Unknown

        A 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 own
        url - link url text
        urlEncode - whether the link should be url encoded, if null then the value of HtmlRenderer.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.Unknown

        A 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 own
        url - link url text
        attributes - link attributes
        urlEncode - whether the link should be url encoded, if null then the value of HtmlRenderer.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