Keeps track of visited tags and provides a lookup for link ids.
Defines a lookup map for link definitions.
Defines a lookup map for link definitions.
A set of tags we have already created.
A set of tags we have already created. Used to prevent nesting a link in a link or an emphasis in an emphasis.
Succeeds if the given parsers succeeds and the given function is defined at the parse result.
Succeeds if the given parsers succeeds and the given function is defined at the parse result. Returns the result of the method applied to the given parsers result.
Matches exactly one char, no matter which.
Matches exactly one char, no matter which. This differs from "elem" as it returns a string consisting of that char.
Runs the given parser on the given input.
Runs the given parser on the given input. Expects the parser to succeed and consume all input. Throws an IllegalArgumentException if parsing failed.
Runs the inline parser on the given input and returns the result
Runs the inline parser on the given input and returns the result
Parses headers of the form: ### header ###
Matches a line starting with up to three spaces, a '>' and an optional whitespace.
Matches a line starting with up to three spaces, a '>' and an optional whitespace. (i.e.: the start or continuation of a block quote.)
Parses two spaces at the end of a line to a manual break (
)
Parses two spaces at the end of a line to a manual break (
)
Parses an inline code element.
Parses an inline code element.
An inline code element is surrounded by single backticks ("")
or double backticks ("
").
Matches a code example line: any line starting with four spaces or a tab.
Defines how the output is formatted and whether inline xml elements are allowed.
Defines how the output is formatted and whether inline xml elements are allowed.
An image with an explicit path.
An image with an explicit path.
Hand rolled parser that parses a chunk of special inline markdown (like links or emphasis) based on a one char lookahead.
Hand rolled parser that parses a chunk of special inline markdown (like links or emphasis) based on a one char lookahead.
Parses emphasized text wrapped in asterisks: *foo*
Parses emphasized text wrapped in asterisks: *foo*
Parses emphasized text wrapped in underscores: _foo_
Parses emphasized text wrapped in underscores: _foo_
Accepts an empty line.
Accepts an empty line. (A line that consists only of optional whitespace or the empty string.)
First tries if the line is empty, if not tries for a code line.
Either returns the XML escape sequence for the given char or null.
Either returns the XML escape sequence for the given char or null. This does not return Option[String] on purpose. While Option[String] would be a much cleaner solution, this is actually called so often that it is a noticeable difference if we use Option here.
Escapes the given char for XML.
Escapes the given char for XML. Returns Either the necessary XML escape Sequence or the same char in a String.
Escapes the given string so it it can be embedded in xml.
Escapes the given string so it it can be embedded in xml. Markdown escapes are not processed.
Matches the start of a fenced code block with additional language token: up to three spaces, three or more backticks, whitespace, an optional language token, optional whitespace
A shortcut markdown link of the form <http://example.
A shortcut markdown link of the form <http://example.com>
A fenced code line.
A fenced code line. Can be the start or the end of a fenced code block
Parses one of the fenced code lines
A markdown link with the full url given.
A markdown link with the full url given.
Parses an id reference.
Parses an id reference. (Any text that is not a square bracket) Succeeds only if the parsed id is found in the given lookup. Returns the found link definition and the matched text.
Parses either a referenced or a directly defined image.
Parses either a referenced or a directly defined image.
Parser for inline markdown, always consumes all input, returns the resulting HTML.
Parser for inline markdown, always consumes all input, returns the resulting HTML.
A link started by square brackets, either a reference or a a link with the full URL.
A link started by square brackets, either a reference or a a link with the full URL.
The Start of a link definition: the id in square brackets, optionally indented by three spaces
A link definition that later gets stripped from the output.
A link definition that later gets stripped from the output. Either a link definition on one line or the first line of a two line link definition.
The title in a link definition.
The link url in a link definition.
Inline markdown in a link.
Inline markdown in a link. Like normal inline stuff but stops when it reaches a closing square bracket.
Looks if the preceding char was one of the given chars.
Looks if the preceding char was one of the given chars. Never consumes any input.
Parses markdown text up to any of the chars defined in the given map.
Parses markdown text up to any of the chars defined in the given map. used to quickly escape any text between special inline markdown like emphasis.
Accepts a unix newline and returns a string containing a single newline.
Accepts a unix newline and returns a string containing a single newline.
A line not starting with an xml end tag
A line that starts an ordered list item.
A line that starts an ordered list item. Matches a line starting with up to three spaces followed by a number, a dot and a space, and any whitespace
Parses a single inline token.
Parses a single inline token. Either a span element or a chunk of text.
Matches one of the given char keys in the map.
Matches one of the given char keys in the map. Returns the string value for the matched char in the given map.
Matches one of the chars in the given set.
Matches one of the chars in the given set. Returns a string with the matched char.
Matches any line.
Matches any line. Only called when all other line parsers have failed. Makes sure line tokenizing does not fail and we do not loose any lines on the way.
accepts zero or more spaces or tabs returns the matched whitespace
accepts zero or more spaces or tabs returns the matched whitespace
Matches one char in the given range, returns the matched char.
Matches one char in the given range, returns the matched char.
A markdown reference of the form [text][id], [idText][] or [idText] Parser returns a tuple with the link definition first and the text to display second.
A markdown reference of the form [text][id], [idText][] or [idText] Parser returns a tuple with the link definition first and the text to display second.
Parses a referenced image.
Parses a referenced image.
Plaintext variant to refInline.
Plaintext variant to refInline. Escapable text until a square bracket is hit.
A markdown link which references an url by id.
A markdown link which references an url by id.
(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.
Matches everything in the parsed string up to the end.
Matches everything in the parsed string up to the end. Also matches the empty String. Returns the matched String.
Parses a horizontal rule.
First tries for a ruler, then for an unordered list item start.
First tries for a setext header level 2, then for a ruler.
Parses the line under a setext style level 1 header: =====
Parses the line under a setext style level 2 header: -----
Whitespace is sometimes important in markdown parsing, we handle it manually.
Whitespace is sometimes important in markdown parsing, we handle it manually. So this returns false.
Parses a span element like foo or *bar*
Parses a span element like foo or *bar*
Either an emphasis or a strong text wrapped in asterisks.
Either an emphasis or a strong text wrapped in asterisks.
Parses inline in a span element like bold or emphasis or link up until the given end marker
Parses inline in a span element like bold or emphasis or link up until the given end marker
Either an emphasis or strong text wrapped in underscores.
Either an emphasis or strong text wrapped in underscores.
Chars that may indicate the start of a special Markdown inline sequence.
Chars that may indicate the start of a special Markdown inline sequence.
Chars that may indicate the start of a special markdown inline sequence or the end of a link text.
Chars that may indicate the start of a special markdown inline sequence or the end of a link text.
Parses strong text in asterisks: **foo**
Parses strong text in asterisks: **foo**
Parses strong text in underscores: foo
Parses strong text in underscores: foo
A title is everything in quotation marks.
A title is everything in quotation marks. We allow even quotation marks in quotation marks. We look ahead if we hit the closing brace after the quotation marks to detect if the title ends or not.
A line that starts an unordered list item.
A line that starts an unordered list item. Matches a line starting with up to three spaces followed by an asterisk, a space, and any whitespace.
We parse everything as a link/img url until we hit whitespace or a closing brace.
We parse everything as a link/img url until we hit whitespace or a closing brace.
Returns a verbose description of a char (printed char & hex code).
Returns a verbose description of a char (printed char & hex code). Used for debugging.
accepts one or more spaces or tabs returns the matched whitespace
accepts one or more spaces or tabs returns the matched whitespace
Parses an XML Attribute with simplified value handling like xmlAttrVal.
Parses an XML Attribute with simplified value handling like xmlAttrVal.
Parses a Simplified xml attribute: everything between quotes ("foo") everything between the quotes is run through the escape handling That way you can omit xml escaping when writing inline XML in markdown.
Parses a Simplified xml attribute: everything between quotes ("foo") everything between the quotes is run through the escape handling That way you can omit xml escaping when writing inline XML in markdown.
A line that ends an xml block: a line starting with an xml end tag
A line that starts an xml block: an opening xml element fragment.
Parses closing xml tags.
Parses closing xml tags.
Parses an XML name (tag or attribute name)
Parses an XML name (tag or attribute name)
Parses an XML name char according to W3C spec except that range #x10000 to #xEFFFF is excluded
Parses an XML name char according to W3C spec except that range #x10000 to #xEFFFF is excluded
Parser for one char that starts an XML name.
Parser for one char that starts an XML name. According to W3C specs except that range #x10000 to #xEFFFF is excluded (cannot be expressed by char literals)
Parses an xml start or empty tag, attribute values are escaped.
Parses an xml start or empty tag, attribute values are escaped.
Parses any xml tag and escapes attribute values.
Parses any xml tag and escapes attribute values.
(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 single lines into tokens. Markdown lines are differentiated by their beginning. These lines are then organized in blocks by the BlockParsers.