Package org.commonmark.parser.beta
Interface LinkProcessor
-
- All Known Implementing Classes:
CoreLinkProcessor,FootnoteLinkProcessor
public interface LinkProcessorAn interface to decide how links/images are handled.Implementations need to be registered with a parser via
Parser.Builder.linkProcessor(org.commonmark.parser.beta.LinkProcessor). Then, when inline parsing is run, each parsed link/image is passed to the processor. This includes links like these:
And images:[text](destination) [text] [text][] [text][label]
See ![text] ![text][] ![text][label]LinkInfofor accessing various parts of the parsed link/image.The processor can then inspect the link/image and decide what to do with it by returning the appropriate
LinkResult. If it returnsLinkResult.none(), the next registered processor is tried. If none of them apply, the link is handled as it normally would.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LinkResultprocess(LinkInfo linkInfo, Scanner scanner, InlineParserContext context)
-
-
-
Method Detail
-
process
LinkResult process(LinkInfo linkInfo, Scanner scanner, InlineParserContext context)
- Parameters:
linkInfo- information about the parsed link/imagescanner- the scanner at the current position after the parsed link/imagecontext- context for inline parsing- Returns:
- what to do with the link/image, e.g. do nothing (try the next processor), wrap the text in a node, or replace the link/image with a node
-
-