laika.api

package laika.api

Type members

Classlikes

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

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

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

Entry point for building a MarkupParser instance.

Entry point for building a MarkupParser instance.

Companion:
class
abstract class Renderer(val config: OperationConfig, skipRewrite: Boolean)

Performs a render operation from a document AST to a target format as a string. The document AST may be obtained by a preceding parse operation or constructed programmatically.

Performs a render operation from a document AST to a target format as a string. The document AST may be obtained by a preceding parse operation or constructed programmatically.

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

Example for rendering HTML:

val doc: Document = ???

val res: String = Renderer
  .of(HTML)
  .build
  .render(doc)

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
object Renderer

Entry point for building a Renderer instance.

Entry point for building a Renderer instance.

Companion:
class
class Transformer(val parser: MarkupParser, val renderer: Renderer)

Performs a transformation from text markup like Markdown or reStructuredText to a target format like HTML as a String.

Performs a transformation from text markup like Markdown or reStructuredText to a target format like HTML as a String.

Example for transforming from Markdown to HTML:

val res: Either[ParserError, String] = Transformer
  .from(Markdown)
  .to(HTML)
  .using(GitHubFlavor)
  .build
  .transform("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

Entry point for building a Transformer instance.

Entry point for building a Transformer instance.

Companion:
class