Top Description Methods
com.vladsch.flexmark.parser

public Interface LinkRefProcessor

Imports
com.vladsch.flexmark.util.ast.Document, .Node, com.vladsch.flexmark.util.sequence.BasedSequence, org.jetbrains.annotations.NotNull

Processing of elements which are based on a link ref: [] or ![] This includes footnote references [^...] and wiki links [[...]]

Method Summary

Modifier and TypeMethod and Description
public @NotNull BasedSequence

Returns:

adjusted sequence to use for this node's child text
adjustInlineText
(@NotNull Document
document, can be used to get parsing options
document
,
@NotNull Node
node whose inline text is to be adjusted to reflect some of the text having been used as part of the opener and/or closer sequence.
node
)

Adjust child nodes' text as needed when some of the link ref text was used in the opening or closing sequence of the node or if the children are not desired then removeIndex them.

public boolean
allowDelimiters(@NotNull BasedSequence
character sub-sequence to test
chars
,
@NotNull Document
document, can be used to get options
document
,
@NotNull Node
delimited node created by this processor @return true if delimiters are allowed in this part of the node's text
node
)

Allows the delimiter processor to allow/disallow other delimiters in its inline text

public @NotNull Node

Returns:

Node element to be inserted into the tree
createNode
(@NotNull BasedSequence
char sequence from which to create the node
nodeChars
)

Create the desired element that was previously matched with isMatch

public int

Returns:

desired nesting level for references, >0 for nested, 0 for not nested
getBracketNestingLevel
()

Whether the element consists of nested [] inside the link ref.

public boolean

Returns:

true if ! is part of the desired element, false otherwise
getWantExclamationPrefix
()

Whether the image ref is desired, if not then !

public boolean

Returns:

true if it is a match
isMatch
(@NotNull BasedSequence
text to match, including [] or ![]
nodeChars
)

Test whether the element matches desired one.

public void
updateNodeElements(@NotNull Document
document, can be used to get parsing options
document
,
@NotNull Node
node whose elements can be adjusted
node
)

Allows the processor to adjust nodes' elements after all delimiters have been processed inside the inlined text

Method Detail

adjustInlineTextback to summary
public @NotNull BasedSequence adjustInlineText(@NotNull Document document, @NotNull Node node)

Adjust child nodes' text as needed when some of the link ref text was used in the opening or closing sequence of the node or if the children are not desired then removeIndex them.

Parameters
document:@NotNull Document

document, can be used to get parsing options

node:@NotNull Node

node whose inline text is to be adjusted to reflect some of the text having been used as part of the opener and/or closer sequence.

Returns:@NotNull BasedSequence

adjusted sequence to use for this node's child text

Annotations
@NotNull
allowDelimitersback to summary
public boolean allowDelimiters(@NotNull BasedSequence chars, @NotNull Document document, @NotNull Node node)

Allows the delimiter processor to allow/disallow other delimiters in its inline text

Parameters
chars:@NotNull BasedSequence

character sub-sequence to test

document:@NotNull Document

document, can be used to get options

node:@NotNull Node

delimited node created by this processor @return true if delimiters are allowed in this part of the node's text

createNodeback to summary
public @NotNull Node createNode(@NotNull BasedSequence nodeChars)

Create the desired element that was previously matched with isMatch

Parameters
nodeChars:@NotNull BasedSequence

char sequence from which to create the node

Returns:@NotNull Node

Node element to be inserted into the tree

Annotations
@NotNull
getBracketNestingLevelback to summary
public int getBracketNestingLevel()

Whether the element consists of nested [] inside the link ref. For example Wiki link [[]] processor would return 1 Only immediately nested [] are considered. [[ ]] is nesting 1, [ [ ]] is not considered

When >0 then preview of next characters is used and if they will match then inner reference will not be created to allow outer one to match the desired element

Returns:int

desired nesting level for references, >0 for nested, 0 for not nested

getWantExclamationPrefixback to summary
public boolean getWantExclamationPrefix()

Whether the image ref is desired, if not then ! will be stripped off the prefix and treated as plain text

Returns:boolean

true if ! is part of the desired element, false otherwise

isMatchback to summary
public boolean isMatch(@NotNull BasedSequence nodeChars)

Test whether the element matches desired one. For processors that allow nesting this will be called one additional. time for each nesting level. Last call for the actual match, all others to pre-match to prevent a non-nested element from being created.

Parameters
nodeChars:@NotNull BasedSequence

text to match, including [] or ![]

Returns:boolean

true if it is a match

updateNodeElementsback to summary
public void updateNodeElements(@NotNull Document document, @NotNull Node node)

Allows the processor to adjust nodes' elements after all delimiters have been processed inside the inlined text

Parameters
document:@NotNull Document

document, can be used to get parsing options

node:@NotNull Node

node whose elements can be adjusted