Theme

trait Theme[F[_]]

A theme is a way of pre-populating the input tree with a set of templates, styles and configurations to achieve a particular look & feel without the need for the user to craft their own templates, CSS or JavaScript.

Themes also allow the registration of extension bundles in case it offers custom directives, parser extensions or other customizations on top of its templates and styles.

Implementations of themes must provide an instance of the laika.theme.ThemeProvider trait to produce instances of this trait. The indirection is necessary as the concrete implementation of the F[_] effect and the thread pools for execution are meant to be chosen by the user.

Themes would also most likely come with a custom configuration API for tweaking the style and functionality of the theme. This is expected to be a type-safe Scala API as Laika avoids any kind of file-based, stringly configuration for global settings and only uses HOCON for local configuration (per-directory, per-document, per-directive).

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def extensions: Seq[ExtensionBundle]

Installs one or more extension bundles into all parsers, renderers and transformers using this theme.

Installs one or more extension bundles into all parsers, renderers and transformers using this theme.

The extensions should be essential for the theme to function. If their features are rather opt-in in nature, it is best to offer the bundles separately and let the user choose if and where to use them.

def inputs: InputTree[F]

The inputs to pre-populate when using parsers or transformers with this theme.

The inputs to pre-populate when using parsers or transformers with this theme.

For convenience, theme initialization code usually uses the laika.io.model.InputTreeBuilder API for assembling the inputs. The builder allows to collect inputs from the resource folder of the jar, from in-memory strings or streams or from document AST constructed on-the-fly, completely by-passing the parsing step.

It is not recommended to use the file-based options of the builder for themes, as this would limit the flexibility of the end-user.

def treeProcessor: Format => TreeProcessor[F]

Hook for transforming the document AST between parsing and rendering.

Hook for transforming the document AST between parsing and rendering.

The provided function accepts a Format instance as parameter which can be used to provide different processor per output format.