class ThemeBuilder[F[_]] extends AnyRef
Builder API for constructing Theme
instances, providing several shortcuts for defining the contents
of a theme.
A theme can consist of inputs like templates, CSS or JavaScript files and optionally of one or more
extension bundles for customizing Laika with features like directives or parser extensions.
The API is entirely optional and can be used to avoid boilerplate when implementing a laika.theme.ThemeProvider.
- Self Type
- ThemeBuilder[F]
- Alphabetic
- By Inheritance
- ThemeBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addBaseConfig(config: Config): ThemeBuilder[F]
Add pre-populated configuration to the theme that will be merged with the user-supplied configuration.
Add pre-populated configuration to the theme that will be merged with the user-supplied configuration. User configuration has always higher precedence than theme configuration. It is recommended to put all theme-specific configuration into a namespace to avoid clashes.
Most common use case for pre-populating configuration is to provide AST nodes and strings to be used in the theme templates.
-
def
addExtensions(bundles: ExtensionBundle*): ThemeBuilder[F]
Adds one or more extension bundles to the theme.
Adds one or more extension bundles to the theme. For the most common bundle features like pre-populated configuration, rewrite rules or render overrides, the respective shortcuts of this class can be used to avoid the boilerplate of extending
ExtensionBundle
yourself. The shortcuts areaddBaseConfig
,addRewriteRules
andaddRenderOverrides
. -
def
addInputs(inputBuilders: F[InputTreeBuilder[F]]): ThemeBuilder[F]
Adds the specified inputs, suspended in the effect
F
, to the theme.Adds the specified inputs, suspended in the effect
F
, to the theme. When the method is invoked multiple times the respective input trees will be merged. -
def
addInputs(inputs: InputTreeBuilder[F]): ThemeBuilder[F]
Adds the specified inputs to the theme.
Adds the specified inputs to the theme. When the method is invoked multiple times the respective input trees will be merged.
-
def
addRenderOverrides(overrides: RenderOverrides): ThemeBuilder[F]
Adds overrides for the renderer which can be used for theme-specific UI elements.
Adds overrides for the renderer which can be used for theme-specific UI elements. One example is to provide custom icons for some of Laika's decorated blocks, like those produced by the
@:callout
directive. -
def
addRewriteRules(rules: RewriteRules): ThemeBuilder[F]
Adds a custom rewrite rule that can swap or remove individual nodes from the document AST.
Adds a custom rewrite rule that can swap or remove individual nodes from the document AST. In contrast to the
processTree
hook which looks at the entire tree of documents, a rewrite rule looks at the individual AST nodes within a document. -
def
addRewriteRules(rules: RewriteRulesBuilder): ThemeBuilder[F]
Adds a custom rewrite rule that can swap or remove individual nodes from the document AST.
Adds a custom rewrite rule that can swap or remove individual nodes from the document AST. In contrast to the
processTree
hook which looks at the entire tree of documents, a rewrite rule looks at the individual AST nodes within a document.This is an overload that allows to construct the rules based on looking at the corresponding
DocumentCursor
first. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
build: Resource[F, Theme[F]]
Builds a theme resource based on the elements passed to this builder instance.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
processTree(f: TreeProcessor[F], format: Format): ThemeBuilder[F]
Adds a function that processes the document tree between parsing and rendering, to be executed only for the specified output format.
Adds a function that processes the document tree between parsing and rendering, to be executed only for the specified output format.
In contrast to the
addRewriteRule
hook which looks at AST nodes within a document, this function can look at the entire tree and add, swap or remove documents for example.In case of binary formats like EPUB or PDF this processing step happens before the renderer for the interim format is invoked. As a consequence you need to pass their interim formats to this method, which is
EPUB.XHTML
for EPUB andXSLFO
for PDF. This also avoids a dependency on the PDF module as the user of your theme might not use it.The laika.theme.TreeProcessorBuilder provides several shortcuts for constructing a
TreeProcessor
(which is just a type alias for a plainKleisli
). -
def
processTree(f: (Format) ⇒ TreeProcessor[F]): ThemeBuilder[F]
Adds a function that processes the document tree between parsing and rendering.
Adds a function that processes the document tree between parsing and rendering. In contrast to the
addRewriteRule
hook which looks at AST nodes within a document, this function can look at the entire tree and add, swap or remove documents for example.The laika.theme.TreeProcessorBuilder provides several shortcuts for constructing a
TreeProcessor
(which is just a type alias for a plainKleisli
). -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()