Exception thrown when parsing a text markup document or fragment fails.
Reader implementation that keeps the current nest level in case of recursive parsing of block-level elements.
Provides additional combinator methods to parsers via implicit conversion.
Abstracts the internal process of building up the result of an inline parser.
ResultBuilder that produces a list of spans.
ResultBuilder that produces a String.
API for specifying further constraints on the parsers provided by this base trait.
Consumes any kind of input, always succeeds.
Consumes any kind of input, always succeeds.
This parser would consume the entire input unless a max
constraint
is specified.
Consumes any number of consecutive characters that are not one of the specified characters.
Consumes any number of consecutive characters that are not one of the specified characters. Always succeeds unless a minimum number of required matches is specified.
Consumes any number of consecutive characters that are in one of the specified character ranges.
Consumes any number of consecutive characters that are in one of the specified character ranges. Always succeeds unless a minimum number of required matches is specified.
Consumes any number of consecutive occurrences of the specified characters.
Consumes any number of consecutive occurrences of the specified characters. Always succeeds unless a minimum number of required matches is specified.
Consumes any number of characters for which the specified parser fails on the corresponding offset.
Consumes any number of characters for which the specified parser fails on the corresponding offset.
This parser fails if the end of input is reached without the specified parser ever succeeding or
if the parser causes an Error result instead of a plain Failure or Success.
Further constraints like minimum or maximum number of required matching characters can be specified
through the API of the returned TextParser
instance.
Consumes any number of consecutive characters that are not one of the specified characters.
Consumes any number of consecutive characters that are not one of the specified characters.
This parser is identical to the anyBut
parser except for two differences: this parser fails
if it reaches the end of the input without seeing any of the specified
characters and it also consumes this final character, without adding it
to the result. This parser is usually used when a construct like a span
enclosed between two characters needs to be parsed.
Consumes any number of consecutive characters which satisfy the specified predicate.
Consumes any number of consecutive characters which satisfy the specified predicate. Always succeeds unless a minimum number of required matches is specified.
Succeeds at the start of the input.
Succeeds at the start of the input.
Parses an ATX header, a line that starts with 1 to 6 '#'
characters,
with the number of hash characters corresponding to the level of the header.
Parses an ATX header, a line that starts with 1 to 6 '#'
characters,
with the number of hash characters corresponding to the level of the header.
Markdown also allows to decorate the line with trailing '#'
characters which
this parser will remove.
Parses a blank line from the current input offset (which may not be at the start of the line).
Parses a blank line from the current input offset (which may not be at the start of the line). Fails for lines that contain any non-whitespace character. Does always produce an empty string as the result, discarding any whitespace characters found in the line.
Since it also succeeds at the end of the input
it should never be used in the form of (blankLine *)
or (blankLine +)
. Use
the blankLines
parser instead in these cases.
Parses one or more blanklines, producing a list of empty strings corresponding to the number of blank lines consumed.
Parses one or more blanklines, producing a list of empty strings corresponding to the number of blank lines consumed.
Parses a full block based on the specified helper parsers.
Parses a full block based on the specified helper parsers.
parser that recognizes the start of the first line of this block
parser that recognizes the start of subsequent lines that still belong to the same block
parser that recognizes whether a line after one or more blank lines still belongs to the same block
Builds a parser for a list of blocks based on the parser for a single block.
Builds a parser for a list of blocks based on the parser for a single block.
Parses a bullet list, called "unordered list" in the Markdown syntax description.
Parses a bullet list, called "unordered list" in the Markdown syntax description.
Parses the start of a bullet list item.
Parses the start of a bullet list item.
Implicit conversion that allows to pass a single
character to the range-based anyIn
parser.
Implicit conversion that allows to pass a single
character to the range-based anyIn
parser.
Parses a span of emphasized text enclosed by one occurrence of the specified character.
Parses a span of emphasized text enclosed by one occurrence of the specified character.
Parses a span enclosed by two consecutive occurrences of the specified character.
Parses a span enclosed by two consecutive occurrences of the specified character. Recursively parses nested spans, too.
Parses a span enclosed by a single occurrence of the specified character.
Parses a span enclosed by a single occurrence of the specified character. Recursively parses nested spans, too.
Parses an enumerated list, called "ordered list" in the Markdown syntax description.
Parses an enumerated list, called "ordered list" in the Markdown syntax description.
Parses the start of an enumerated list item.
Parses the start of an enumerated list item.
Succeeds at the end of the input.
Succeeds at the end of the input.
Succeeds at the end of a line, including the end of the input.
Succeeds at the end of a line, including the end of the input. Produces an empty string as a result and consumes any new line characters.
Parses a single escaped character, only recognizing the characters the Markdown syntax document specifies as escapable.
Parses a single escaped character, only recognizing the characters the Markdown syntax document specifies as escapable.
Note: escaping > is not mandated by the official syntax description, but by the official test suite.
Parses a span of text until the specified character is seen, while also processing escaped characters, but no other nested spans.
Parses a span of text until the specified character is seen, while also processing escaped characters, but no other nested spans.
Parses a single attribute, consisting of the name and (optional) equals sign and value.
Parses quoted and unquoted attribute values.
Parses a full HTML block, with the root element being a block-level HTML element and without parsing any standard Markdown markup.
Elements that the HTML specification does not define as "Phrasing Content".
Elements that the HTML specification does not define as "Phrasing Content". These elements can serve as the root of a Block instance in the Document model. For an HTML renderer this means that it can avoid to wrap these blocks inside p tags as it would do with a normal paragraph.
Parses the start tag of an HTML block, only matches when the tag name is an actual block-level HTML tag.
Parses a numeric or named character reference without the leading '&'
.
Parses an HTML comment without the leading '<'
.
Parses an HTML element without the leading '<'
, but including
all the nested HTML and Text elements.
Parses an empty HTML element without the leading '<'
.
Parses an empty HTML element without the leading '<'
.
Only recognizes empty tags explicitly closed.
Parses an HTML end tag if it matches the specified tag name.
Parses an HTML end tag without the leading '<'
.
Parses a numeric character reference (decimal or hexadecimal) without the leading '&'
.
The mapping of start characters to their corresponding HTML span parsers.
Parses an attribute value enclosed by the specified character.
Parses any of the HTML span elements supported by this trait, but no standard markdown inside HTML elements.
Parses any of the HTML span elements supported by this trait, plus standard markdown inside HTML elements.
Parses an HTML start tag without the leading '<'
.
Parses an HTML start tag without the leading '<'
.
Only recognizes empty tags explicitly closed.
Parses an HTML tag without the enclosing '<'
and '>'
characters.
Parses and consumes optional whitespace, always succeeds.
Parses an inline image.
Parses an inline image.
Recognizes both, an inline image ![text](url)
and an image reference ![text][id]
.
Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first.
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.
the minimum indentation that each line in this block must have
parser that recognizes the start of subsequent lines that still belong to the same block
indicates whether parsing should end on the first blank line
indicates whether the first line is expected to be indented, too
the maximum indentation that will get dropped from the start of each line of the result
a parser that produces an instance of IndentedBlock
Generic base parser that parses inline elements based on the specified helper parsers.
Generic base parser that parses inline elements based on the specified helper parsers. Usually not used directly by parser implementations, this is the base parser the other inline parsers of this trait delegate to.
the element type produced by a single parser for a nested span
the type of the result this parser produces
a mapping from the start character of a span to the corresponding parser for nested span elements
responsible for building the final result of this parser based on the results of the helper parsers
the resulting parser
Parses up to 3 space characters.
Parses up to 3 space characters. In Markdown an indentation of up to 3 spaces is optional and does not have any influence on the parsing logic.
Parses an explicit hard line break.
Parses an explicit hard line break.
Merges the specified list of lines into a single string, while looking for lines ending with double spaces which stand for a hard line break in Markdown.
Merges the specified list of lines into a single string, while looking for lines ending with double spaces which stand for a hard line break in Markdown.
Parses a link, including nested spans in the link text.
Parses a link, including nested spans in the link text.
Recognizes both, an inline link [text](url)
and a link reference [text][id]
.
Parses a link definition in the form [id]: <url> "title"
.
Parses a link definition in the form [id]: <url> "title"
.
The title is optional as well as the quotes around it and the angle brackets around the url.
Parses a list based on the specified helper parsers.
Parses a list based on the specified helper parsers.
parser that recognizes the start of a list item, result will be discarded
function that produces a block element for the document tree
function that produces a new list item element based on position and content arguments
Parses a single list item.
Parses a single list item.
parser that recognizes the start of a list item, result will be discarded
Parses a literal block, text indented by a tab or 4 spaces.
Parses a literal block, text indented by a tab or 4 spaces.
Parses a literal span enclosed by double backticks.
Parses a literal span enclosed by double backticks. Does neither parse nested spans nor Markdown escapes.
Parses a literal span enclosed by a single backtick.
Parses a literal span enclosed by a single backtick. Does neither parse nested spans nor Markdown escapes.
Applies the specified parser at the specified offset behind the current position.
Applies the specified parser at the specified offset behind the current position. Never consumes any input.
The maximum level of block nesting.
The maximum level of block nesting. Some block types like lists and blockquotes contain nested blocks. To protect against malicious input or accidentally broken markup, the level of nesting is restricted.
Parses a single Markdown block.
Parses a single Markdown block. In contrast to the generic block parser of the super-trait this method also consumes and ignores up to three optional space characters at the start of each line.
parser that recognizes the start of the first line of this block
parser that recognizes the start of subsequent lines that still belong to the same block
parser that recognizes whether a line after one or more blank lines still belongs to the same block
Returns the current nest level from the specified input or 0 if it cannot be determined.
Returns the current nest level from the specified input or 0 if it cannot be determined.
The nest level is usually only used to prevent endless recursion of nested blocks.
Parses any kind of nested block supported by a concrete markup language.
Parses any kind of nested block supported by a concrete markup language.
Parses a single paragraph nested inside another block.
Parses a single paragraph nested inside another block. Markdown allows nested lists without preceding blank lines, therefore will detect list items in the middle of a parapraph, whereas a top level paragraph won't do that. One of the questionable Markdown design decisions.
Parses reStructuredText blocks, except for blocks that allow nesting of blocks.
Parses reStructuredText blocks, except for blocks that allow nesting of blocks. Only used in rare cases when the maximum nest level allowed had been reached
Parses 0 or 1 space character, always succeeds.
Parses 0 or 1 space character, always succeeds.
Returns an optimized, Array-based lookup function for the specified characters.
Returns an optimized, Array-based lookup function for the specified characters.
Returns an optimized, Array-based lookup function for the specified ranges of characters.
Returns an optimized, Array-based lookup function for the specified ranges of characters.
Parses a single paragraph.
Parses a single paragraph. Everything between two blank lines that is not recognized as a special Markdown block type will be parsed as a regular paragraph.
Fully parses the input from the specified reader and returns the configuration and root element.
Fully parses the input from the specified reader and returns the configuration and root element.
Fully parses the input from the specified reader and returns the document tree.
Fully parses the input from the specified reader and returns the document tree. This function is expected to always succeed, errors would be considered a bug of this library, as the parsers treat all unknown or malformed markup as regular text.
Fully parses the input string and produces a list of spans, using the
default span parsers returned by the spanParsers
method.
Fully parses the input string and produces a list of spans, using the
default span parsers returned by the spanParsers
method.
This function is expected to always succeed, errors would be considered a bug of this library, as the parsers treat all unknown or malformed markup as regular text. Some parsers might additionally insert system message elements in case of markup errors.
the input to parse
the result of the parser in form of a list of spans
Fully parses the input string and produces a list of spans.
Fully parses the input string and produces a list of spans.
This function is expected to always succeed, errors would be considered a bug of this library, as the parsers treat all unknown or malformed markup as regular text. Some parsers might additionally insert system message elements in case of markup errors.
the input to parse
a mapping from the start character of a span to the corresponding parser
the result of the parser in form of a list of spans
Fully parses the input from the specified reader and returns the result.
Fully parses the input from the specified reader and returns the result. This function is expected to always succeed, errors would be considered a bug in this library, as the parsers treat all unknown or malformed markup as regular text.
Fully parses the specified input string and returns the result.
Fully parses the specified input string and returns the result. This function is expected to always succeed, errors would be considered a bug in this library, as the parsers treat all unknown or malformed markup as regular text.
Parses all nested blocks inside the specified indented block.
Parses all nested blocks inside the specified indented block.
Parses all nested blocks for the specified input and nest level.
Parses all nested blocks for the specified input and nest level.
Delegates to the abstract nestedBlock
parser that sub-traits need to define.
The nest level is primarily used as a protection against malicious
input that forces endless recursion.
the input to parse
the level of nesting with 0 being the outermost level
the parser result as a list of blocks
Parses all nested blocks for the specified input and nest level.
Parses all nested blocks for the specified input and nest level.
Delegates to the abstract nestedBlock
parser that sub-traits need to define.
The nest level is primarily used as a protection against malicious
input that forces endless recursion.
the input to parse
the level of nesting with 0 being the outermost level
the parser result as a list of blocks
Extension hook for assembling the block parsers for a particular markup format.
Extension hook for assembling the block parsers for a particular markup format.
true if these are parsers for nested blocks, false if they are for top level blocks
a list of block parsers which later will be interpreted as choices in the specified order
Creates a new mapping from the start character of an inline span to the corresponding parser.
Creates a new mapping from the start character of an inline span to the corresponding parser. May be overridden by subtraits.
Parses a quoted block, a paragraph starting with a '>'
character,
with subsequent lines optionally starting with a '>'
, too.
Parses a quoted block, a paragraph starting with a '>'
character,
with subsequent lines optionally starting with a '>'
, too.
A parser generator for repetitions where all subsequent parsers after the first depend on the result of the previous.
A parser generator for repetitions where all subsequent parsers after the first depend on the result of the previous.
the parser to use for the first piece of input
a function that determines the next parser based on the result of the previous
(Changed in version 2.9.0) The p0
call-by-name arguments is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.
Uses the parser for at most the specified number of repetitions, always succeeds.
Uses the parser for at most the specified number of repetitions, always succeeds. The result is the list of results from applying the parser repeatedly.
Uses the parser for at least the specified number of repetitions or otherwise fails.
Uses the parser for at least the specified number of repetitions or otherwise fails. Continues to apply the parser after the minimum has been reached until if fails. The result is the list of results from applying the parser repeatedly.
Helper function that abstracts the common parser logic of links and images.
Helper function that abstracts the common parser logic of links and images.
factory function for creating a new inline link or image based on the text, url and optional title parameters
factory function for creating a new link or image reference based on the text and id parameters
Parses the rest of the line from the current input offset no matter whether it consist of whitespace only or some text.
Parses the rest of the line from the current input offset no matter whether it consist of whitespace only or some text. Does not include the eol character(s).
Parses a full document, delegating most of the work to the topLevelBlock
parser.
Parses a full document, delegating most of the work to the topLevelBlock
parser.
Parses a horizontal rule, a line only decorated with three or more '*'
, '-'
or '_'
characters with optional spaces between them
Parses a horizontal rule, a line only decorated with three or more '*'
, '-'
or '_'
characters with optional spaces between them
Parses a 1st or 2nd level Setext header.
Parses a 1st or 2nd level Setext header. A first level header consists of the
text of the header followed by a line of one or more '='
characters, a 2nd
level header uses '-'
characters instead.
In contrast to several other Markdown parsers this parser requires a blank line before the header.
Parses a simple inline link in the form of <http://someURL/>
Parses a simple inline link in the form of <http://someURL/>
Creates a parser for an inline span based on the specified parsers that represent the start and end condition.
Creates a parser for an inline span based on the specified parsers that represent the start and end condition.
the parser that parses the beginning of the span, result will be discarded
the parser that recognizes the end of the span, result will be discarded
The mapping of markup start characters to their corresponding span parsers.
The mapping of markup start characters to their corresponding span parsers.
A parser mapped to a start character is not required to successfully parse the subsequent input. If it fails the character that triggered the parser invocation will be treated as normal text. The mapping is merely used as a performance optimization. The parser will be invoked with the input offset pointing to the character after the one specified as the key for the mapping.
Parses a list of spans based on the specified helper parsers.
Parses a list of spans based on the specified helper parsers.
the parser for the text of the current span element
the resulting parser
Parses all of the standard Markdown blocks, except normal paragraphs and those blocks that deal with verbatim HTML.
Parses all of the standard Markdown blocks, except normal paragraphs and those blocks that deal with verbatim HTML. For the latter parsers are provided by a separate, optional trait.
Parses a span of strong text enclosed by two consecutive occurrences of the specified character.
Parses a span of strong text enclosed by two consecutive occurrences of the specified character.
Parses a single tab or space character.
Parses a single tab or space character.
Parses text based on the specified helper parsers.
Parses text based on the specified helper parsers.
the parser for the text of the current element
a mapping from the start character of a span to the corresponding parser for nested span elements
the resulting parser
Parses a single text line from the current input offset (which may not be at the start of the line.
Parses a single text line from the current input offset (which may not be at the start of the line. Fails for blank lines. Does not include the eol character(s).
Parses any kind of top-level block supported by a concrete markup language.
Parses any kind of top-level block supported by a concrete markup language.
Creates a new parser that produces a tuple containing the current nest level as well as the result from the specified parser.
Creates a new parser that produces a tuple containing the current nest level as well as the result from the specified parser.
The nest level is usually only used to prevent endless recursion of nested blocks.
Parses horizontal whitespace (space and tab).
Parses horizontal whitespace (space and tab). Always succeeds, consuming all whitespace found.
(Since version 2.10.0) lastNoSuccess was not thread-safe and will be removed in 2.11.0
(Since version 2.10.0) lastNoSuccess was not thread-safe and will be removed in 2.11.0
Parses verbatim HTML elements which may interleave with standard Markdown markup. Extends the Markdown block and inline parsers, overriding several of their parsers to add the HTML functionality.