Package org.commonmark.parser.delimiter
Interface DelimiterProcessor
-
- All Known Implementing Classes:
AsteriskDelimiterProcessor
,EmphasisDelimiterProcessor
,ImageAttributesDelimiterProcessor
,InsDelimiterProcessor
,StaggeredDelimiterProcessor
,StrikethroughDelimiterProcessor
,UnderscoreDelimiterProcessor
public interface DelimiterProcessor
Custom delimiter processor for additional delimiters besides_
and*
.Note that implementations of this need to be thread-safe, the same instance may be used by multiple parsers.
- See Also:
InlineContentParserFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description char
getClosingCharacter()
int
getMinLength()
Minimum number of delimiter characters that are needed to activate this.char
getOpeningCharacter()
int
process(DelimiterRun openingRun, DelimiterRun closingRun)
Process the delimiter runs.
-
-
-
Method Detail
-
getOpeningCharacter
char getOpeningCharacter()
- Returns:
- the character that marks the beginning of a delimited node, must not clash with any built-in special characters
-
getClosingCharacter
char getClosingCharacter()
- Returns:
- the character that marks the the ending of a delimited node, must not clash with any built-in special characters. Note that for a symmetric delimiter such as "*", this is the same as the opening.
-
getMinLength
int getMinLength()
Minimum number of delimiter characters that are needed to activate this. Must be at least 1.
-
process
int process(DelimiterRun openingRun, DelimiterRun closingRun)
Process the delimiter runs.The processor can examine the runs and the nodes and decide if it wants to process or not. If not, it should not change any nodes and return 0. If yes, it should do the processing (wrapping nodes, etc) and then return how many delimiters were used.
Note that removal (unlinking) of the used delimiter
Text
nodes is done by the caller.- Parameters:
openingRun
- the opening delimiter runclosingRun
- the closing delimiter run- Returns:
- how many delimiters were used; must not be greater than length of either opener or closer
-
-