Class BlockStartImpl

java.lang.Object
org.commonmark.parser.block.BlockStart
org.commonmark.internal.BlockStartImpl

public class BlockStartImpl extends BlockStart
  • Field Details

    • blockParsers

      private final BlockParser[] blockParsers
    • newIndex

      private int newIndex
    • newColumn

      private int newColumn
    • replaceActiveBlockParser

      private boolean replaceActiveBlockParser
    • replaceParagraphLines

      private int replaceParagraphLines
  • Constructor Details

    • BlockStartImpl

      public BlockStartImpl(BlockParser... blockParsers)
  • Method Details

    • getBlockParsers

      public BlockParser[] getBlockParsers()
    • getNewIndex

      public int getNewIndex()
    • getNewColumn

      public int getNewColumn()
    • isReplaceActiveBlockParser

      public boolean isReplaceActiveBlockParser()
    • getReplaceParagraphLines

      int getReplaceParagraphLines()
    • atIndex

      public BlockStart atIndex(int newIndex)
      Description copied from class: BlockStart
      Continue parsing at the specified index.
      Specified by:
      atIndex in class BlockStart
      Parameters:
      newIndex - the new index, see ParserState.getIndex()
    • atColumn

      public BlockStart atColumn(int newColumn)
      Description copied from class: BlockStart
      Continue parsing at the specified column (for tab handling).
      Specified by:
      atColumn in class BlockStart
      Parameters:
      newColumn - the new column, see ParserState.getColumn()
    • replaceActiveBlockParser

      public BlockStart replaceActiveBlockParser()
      Specified by:
      replaceActiveBlockParser in class BlockStart
    • replaceParagraphLines

      public BlockStart replaceParagraphLines(int lines)
      Description copied from class: BlockStart
      Replace a number of lines from the current paragraph (as returned by MatchedBlockParser.getParagraphLines()) with the new block.

      This is useful for parsing blocks that start with normal paragraphs and only have special marker syntax in later lines, e.g. in this:

       Foo
       ===
       
      The Foo line is initially parsed as a normal paragraph, then === is parsed as a heading marker, replacing the 1 paragraph line before. The end result is a single Heading block.

      Note that source spans from the replaced lines are automatically added to the new block.

      Specified by:
      replaceParagraphLines in class BlockStart
      Parameters:
      lines - the number of lines to replace (at least 1); use Integer.MAX_VALUE to replace the whole paragraph