BlockParsers

object BlockParsers extends BlockParsers

Instance that allows to import all block parsers in isolation.

Usually it is more convenient to import laika.parse.api._ to get all parser builders with one import.

Companion:
class
class Object
trait Matchable
class Any

Value members

Inherited methods

def block(firstLinePrefix: Parser[Any], linePrefix: => Parser[Any], nextBlockPrefix: => Parser[Any]): Parser[BlockSource]

Parses a full block based on the specified helper parsers.

Parses a full block based on the specified helper parsers.

The result of this parser will not contain the characters consumed by any of the specified prefix parsers. The block source returned by this method maintains x-offsets for each individual line so that it can be passed down to recursive block or span parsers without losing position tracking.

Value parameters:
firstLinePrefix

parser that recognizes the start of the first line of this block

linePrefix

parser that recognizes the start of subsequent lines that still belong to the same block

nextBlockPrefix

parser that recognizes whether a line after one or more blank lines still belongs to the same block

Inherited from:
BlockParsers
def block(firstLinePrefix: Parser[Any], linePrefix: => Parser[Any]): Parser[BlockSource]

Parses a full block based on the specified helper parsers.

Parses a full block based on the specified helper parsers.

The string result of this parser will not contain the characters consumed by any of the specified prefix parsers.

Value parameters:
firstLinePrefix

parser that recognizes the start of the first line of this block

linePrefix

parser that recognizes the start of subsequent lines that still belong to the same block

Inherited from:
BlockParsers
def indentedBlock(minIndent: Int, linePredicate: => Parser[Any], endsOnBlankLine: Boolean, firstLineIndented: Boolean, maxIndent: Int): Parser[BlockSource]

Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.

Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.

Value parameters:
endsOnBlankLine

indicates whether parsing should end on the first blank line

firstLineIndented

indicates whether the first line is expected to be indented, too

linePredicate

parser that recognizes the start of subsequent lines that still belong to the same block

maxIndent

the maximum indentation that will get dropped from the start of each line of the result

minIndent

the minimum indentation that each line in this block must have

Returns:

a parser that produces the raw text of the parsed block with the indentation removed

Inherited from:
BlockParsers
def indentedBlockWithLevel(minIndent: Int, linePredicate: => Parser[Any], endsOnBlankLine: Boolean, firstLineIndented: Boolean, maxIndent: Int): Parser[(BlockSource, Int)]

Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.

Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.

Value parameters:
endsOnBlankLine

indicates whether parsing should end on the first blank line

firstLineIndented

indicates whether the first line is expected to be indented, too

linePredicate

parser that recognizes the start of subsequent lines that still belong to the same block

maxIndent

the maximum indentation that will get dropped from the start of each line of the result

minIndent

the minimum indentation that each line in this block must have

Returns:

a parser that produces the raw text of the parsed block with the indentation removed and the indentation level (number of whitespace characters removed from the text lines)

Inherited from:
BlockParsers