- java.lang.Object
-
- org.commonmark.parser.block.BlockStart
-
- Direct Known Subclasses:
BlockStartImpl
public abstract class BlockStart extends java.lang.ObjectResult object for starting parsing of a block, see static methods for constructors.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBlockStart()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract BlockStartatColumn(int newColumn)Continue parsing at the specified column (for tab handling).abstract BlockStartatIndex(int newIndex)Continue parsing at the specified index.static BlockStartnone()Result for when there is no block start.static BlockStartof(BlockParser... blockParsers)Start block(s) with the specified parser(s).abstract BlockStartreplaceActiveBlockParser()Deprecated.usereplaceParagraphLines(int)instead; please raise an issue if that doesn't work for you for some reason.abstract BlockStartreplaceParagraphLines(int lines)Replace a number of lines from the current paragraph (as returned byMatchedBlockParser.getParagraphLines()) with the new block.
-
-
-
Method Detail
-
none
public static BlockStart none()
Result for when there is no block start.
-
of
public static BlockStart of(BlockParser... blockParsers)
Start block(s) with the specified parser(s).
-
atIndex
public abstract BlockStart atIndex(int newIndex)
Continue parsing at the specified index.- Parameters:
newIndex- the new index, seeParserState.getIndex()
-
atColumn
public abstract BlockStart atColumn(int newColumn)
Continue parsing at the specified column (for tab handling).- Parameters:
newColumn- the new column, seeParserState.getColumn()
-
replaceActiveBlockParser
@Deprecated public abstract BlockStart replaceActiveBlockParser()
Deprecated.usereplaceParagraphLines(int)instead; please raise an issue if that doesn't work for you for some reason.
-
replaceParagraphLines
public abstract BlockStart replaceParagraphLines(int lines)
Replace a number of lines from the current paragraph (as returned byMatchedBlockParser.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 ===
TheFooline 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.
- Parameters:
lines- the number of lines to replace (at least 1); useInteger.MAX_VALUEto replace the whole paragraph
-
-