MarkupParser

class MarkupParser(val format: MarkupFormat, val config: OperationConfig)

Performs a parse operation from text markup to a document tree without a subsequent render operation.

In cases where a render operation should follow immediately, it is more convenient to use a laika.api.Transformer instead which combines a parse and a render operation directly.

Example for parsing Markdown:

val res: Either[ParserError, Document] = MarkupParser
  .of(Markdown)
  .using(GitHubFlavor)
  .build
  .parse("hello *there*)

This is a pure API that does not perform any side-effects. For additional options like File and Stream I/O, templating or parallel processing, use the corresponding builders in the laika-io module.

Companion:
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def parse(input: String): Either[ParserError, Document]

Parses the specified markup string into a document AST structure.

Parses the specified markup string into a document AST structure.

def parse(input: String, path: Path): Either[ParserError, Document]

Parses the specified markup string into a document AST structure. The given (virtual) path will be assigned to the result.

Parses the specified markup string into a document AST structure. The given (virtual) path will be assigned to the result.

def parse(input: DocumentInput): Either[ParserError, Document]

Parses the specified markup input into a document AST structure.

Parses the specified markup input into a document AST structure.

def parseUnresolved(input: String): Either[ParserError, UnresolvedDocument]
def parseUnresolved(input: String, path: Path): Either[ParserError, UnresolvedDocument]

Returns an unresolved document without applying the default rewrite rules and without resolving the configuration header (if present).

Returns an unresolved document without applying the default rewrite rules and without resolving the configuration header (if present).

The default rewrite rules resolve link and image references and rearrange the tree into a hierarchy of sections based on the sequence of header instances found in the document.

The default configuration resolver allows for variable references in the HOCON header of the document to be resolved against values defined in the base configuration.

This low-level hook is rarely used by application code.

Concrete fields

val fileSuffixes: Set[String]

The file suffixes this parser will recognize as a supported format.

The file suffixes this parser will recognize as a supported format.