Package

laika

api

Permalink

package api

Visibility
  1. Public
  2. All

Type Members

  1. class Parse extends ParseConfigBuilder with InputOps with InputTreeOps

    Permalink

    API for performing a parse operation from various types of input to obtain a document tree without a subsequent render operation.

    API for performing a parse operation from various types of input to obtain a document tree without a subsequent render operation.

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

    Example for parsing Markdown from a file:

    val doc = Parse as Markdown fromFile "hello.md"

    Example for parsing from an entire directory:

    val tree = Parse as Markdown fromDirectory "path/to/source"

    Example for parsing a directory that contains markup documents in different formats:

    val tree = Parse as Markdown or ReStructuredText fromDirectory "path/to/source"
  2. abstract class Render[Writer] extends RenderConfigBuilder[Writer]

    Permalink

    API for performing a render operation to various types of output using an existing document tree model.

    API for performing a render operation to various types of output using an existing document tree model.

    In cases where a render operation follows a parse operation immediately, it is more convenient to use the laika.api.Transform API instead which combines a parse and a render operation directly.

    Example for rendering HTML to a file:

    val doc: Document = ...
    
    Render as HTML from doc toFile "hello.html"

    Example for rendering HTML from an entire tree of documents to a directory:

    val tree: DocumentTree = ...
    
    Render as HTML from tree toDirectory "path/to/output"

    Example for rendering PDF from an entire tree of documents to a single target file:

    val tree: DocumentTree = ...
    
    Render as PDF from tree toFile "hello.pdf"
    Writer

    the writer API to use which varies depending on the renderer

  3. abstract class Transform[Writer] extends TransformConfigBuilder[Writer] with InputOps with InputTreeOps

    Permalink

    API for performing a transformation operation from and to various types of input and output, combining a parse and render operation.

    API for performing a transformation operation from and to various types of input and output, combining a parse and render operation.

    In cases where a parse or render operation should be performed separately, for example for manually processing the document tree model between these operations, the laika.api.Parse and laika.api.Render APIs should be used instead.

    Example for transforming from Markdown to HTML using files for both input and output:

    Transform from Markdown to HTML fromFile "hello.md" toFile "hello.html"

    Example for transforming an entire directory and its subdirectories to HTML in a target directory:

    Transform from Markdown to HTML fromDirectory "source" toDirectory "target"

    Example for transforming an entire directory and its subdirectories to a single PDF file:

    Transform from Markdown to PDF fromDirectory "source" toFile "hello.pdf"

    Or for transforming a document fragment from a string to the AST format for debugging purposes:

    val input = "some *emphasized* text"
    
    Transform from Markdown to AST fromString input toString
    
    res0: java.lang.String =
    Document - Blocks: 1
    . Paragraph - Spans: 3
    . . Text - 'some '
    . . Emphasized - Spans: 1
    . . . Text - 'emphasized'
    . . Text - ' text'

    Apart from specifying input and output, the Transform API also allows to customize the operation in various ways. The usingRule and creatingRule methods allow to rewrite the document tree between the parse and render operations and the rendering method allows to customize the way certain types of elements are rendered.

    Writer

    the writer API to use which varies depending on the renderer

Value Members

  1. object Parse

    Permalink

    Serves as an entry point to the Parse API.

  2. object Render

    Permalink

    Serves as an entry point to the Render API.

  3. object Transform

    Permalink

    Serves as an entry point to the Transform API.

Ungrouped