Class EmphasisDelimiterProcessor

java.lang.Object
org.commonmark.internal.inline.EmphasisDelimiterProcessor
All Implemented Interfaces:
DelimiterProcessor
Direct Known Subclasses:
AsteriskDelimiterProcessor, UnderscoreDelimiterProcessor

public abstract class EmphasisDelimiterProcessor extends Object implements DelimiterProcessor
  • Field Details

    • delimiterChar

      private final char delimiterChar
  • Constructor Details

    • EmphasisDelimiterProcessor

      protected EmphasisDelimiterProcessor(char delimiterChar)
  • Method Details

    • getOpeningCharacter

      public char getOpeningCharacter()
      Specified by:
      getOpeningCharacter in interface DelimiterProcessor
      Returns:
      the character that marks the beginning of a delimited node, must not clash with any built-in special characters
    • getClosingCharacter

      public char getClosingCharacter()
      Specified by:
      getClosingCharacter in interface DelimiterProcessor
      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

      public int getMinLength()
      Description copied from interface: DelimiterProcessor
      Minimum number of delimiter characters that are needed to activate this. Must be at least 1.
      Specified by:
      getMinLength in interface DelimiterProcessor
    • process

      public int process(DelimiterRun openingRun, DelimiterRun closingRun)
      Description copied from interface: DelimiterProcessor
      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.

      Specified by:
      process in interface DelimiterProcessor
      Parameters:
      openingRun - the opening delimiter run
      closingRun - the closing delimiter run
      Returns:
      how many delimiters were used; must not be greater than length of either opener or closer