TransformerBuilderOps
API for specifying configuration options that apply to all kinds of operations that contain both, a parsing and a rendering step (only Transform API).
Attributes
- Graph
-
- Supertypes
-
trait RendererBuilderOps[FMT]trait ParserBuilderOpstrait CommonBuilderOpsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class TransformerBuilder[FMT]
Members list
Type members
Types
The type of the operation being configured by this instance.
The type of the operation being configured by this instance.
Attributes
Value members
Concrete methods
Specifies a rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
Specifies a rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
The difference of this method to the usingRules
method is that it expects a function that takes a DocumentCursor
instance and returns the rewrite rules. This way the full document can be queried before any rule is applied. This is necessary in cases where the rule (which gets applied node-by-node) depends on information from other nodes. An example from the built-in rewrite rules is the rule that resolves link references. To replace all link reference elements with actual link elements, the rewrite rule needs to know all LinkDefinitions the document tree contains.
For being able to perform inspection tasks like this, the rule is executed in a later phase than rules added via usingRules
. This means that such a rule is not supposed to insert any link targets itself, as the processing for those has already happened when this rule is run.
The builder function returns an Either[ConfigError, RewriteRules]
which allows for validation of document configuration before creating the rule.
The rules themselves are partial functions of type PartialFunction[T, RewriteRule[T]]
where T
is either Span
, Block
or TemplateSpan
, the 3 main categories of element types that support rewriting.
If the partial function is not defined for a specific element or the rule returns a Retain
action as a result the old block remains in the tree unchanged.
If it returns Remove
then the element gets removed from the ast, if it returns Replace
with a new element it will replace the old one.
The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
Attributes
Specifies a single block rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
Specifies a single block rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
The rule is a type alias for a partial function of type PartialFunction[Block, RewriteRule[Block]]
.
If the partial function is not defined for a specific block or the rule returns a Retain
action as a result the old block remains in the tree unchanged.
If it returns Remove
then the block gets removed from the ast, if it returns Replace
with a new block it will replace the old one.
The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
Attributes
Specifies rewrite rules to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
Specifies rewrite rules to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
The rules are partial functions of type PartialFunction[T, RewriteRule[T]]
where T
is either Span
, Block
or TemplateSpan
, the 3 main categories of element types that support rewriting.
If the partial function is not defined for a specific element or the rule returns a Retain
action as a result the old element remains in the tree unchanged.
If it returns Remove
then the element gets removed from the ast, if it returns Replace
with a new element it will replace the old one.
The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
Attributes
Specifies a single span rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
Specifies a single span rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
The rule is a type alias for a partial function of type PartialFunction[Span, RewriteRule[Span]
.
If the partial function is not defined for a specific span or the rule returns a Retain
action as a result the old span remains in the tree unchanged.
If it returns Remove
then the span gets removed from the ast, if it returns Replace
with a new span it will replace the old one.
The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
Attributes
Specifies a single rewrite rule for template spans to be applied to the template tree model between the parse and render operations. This is identical to calling TemplateDocument.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
Specifies a single rewrite rule for template spans to be applied to the template tree model between the parse and render operations. This is identical to calling TemplateDocument.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.
The rule is a type alias for a partial function of type PartialFunction[TemplateSpan, RewriteRule[TemplateSpan]
.
If the partial function is not defined for a specific span or the rule returns a Retain
action as a result the old span remains in the tree unchanged.
If it returns Remove
then the span gets removed from the ast, if it returns Replace
with a new span it will replace the old one.
The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
Attributes
Deprecated methods
Attributes
- Deprecated
- true
Inherited methods
The current configuration for this instance.
Specifies the filter to apply to runtime messages that should cause a transformation to fail.
Specifies the filter to apply to runtime messages that should cause a transformation to fail.
The default is to fail transformations on messages of level Error
or higher.
Attributes
- Inherited from:
- ParserBuilderOps
Attributes
- Inherited from:
- RendererBuilderOps
Specifies the minimum required level for a runtime message to get included into the output by this renderer.
Specifies the minimum required level for a runtime message to get included into the output by this renderer.
Attributes
- Inherited from:
- RendererBuilderOps
Specifies a custom render function that overrides one or more of the default renderers for the output format this instance uses.
Specifies a custom render function that overrides one or more of the default renderers for the output format this instance uses.
This method expects a partial function that takes a formatter and the element to render. It will then be invoked for each element it is defined at.
Simple example for customizing the HTML output for emphasized text, adding a specific style class:
val transformer = Transformer.from(Markdown).to(HTML).rendering {
case (fmt, Emphasized(content, opt)) => fmt.element("em", opt, content, "class" -> "big")
}.build
Attributes
- Inherited from:
- RendererBuilderOps
Turns strict mode on for the target parser, switching off any features not part of the original markup syntax. This includes the registration of markup directives (custom tags) as well as configuration sections at the start of the document.
Turns strict mode on for the target parser, switching off any features not part of the original markup syntax. This includes the registration of markup directives (custom tags) as well as configuration sections at the start of the document.
Attributes
- Inherited from:
- ParserBuilderOps
Renders without any formatting (line breaks or indentation). Useful when storing the output in a database for example.
Renders without any formatting (line breaks or indentation). Useful when storing the output in a database for example.
Attributes
- Inherited from:
- RendererBuilderOps
Returns a new instance with the specified extension bundles installed. Features in the new bundles may override features in already installed bundles.
Returns a new instance with the specified extension bundles installed. Features in the new bundles may override features in already installed bundles.
Bundles are usually provided by libraries (by Laika itself or a 3rd-party extension library) or as re-usable building blocks by application code.
Attributes
- Inherited from:
- CommonBuilderOps
Returns a new instance with the specified configuration.
Returns a new instance with the specified configuration.
This method discards any previously specified options. It is usually meant to be used when copying over the configuration from a fully configured object to an unconfigured one.
Attributes
- Inherited from:
- CommonBuilderOps
Returns a new instance with the specified configuration value added.
Returns a new instance with the specified configuration value added.
The specified value with have higher precedence than any value with the same key registered by extension bundles, but lower precedence than any value with the same key specified in a configuration file for a directory or a configuration header in a markup document.
Attributes
- Inherited from:
- ParserBuilderOps
Returns a new instance with the specified configuration value added.
Returns a new instance with the specified configuration value added.
The specified value with have higher precedence than any value with the same key registered by extension bundles, but lower precedence than any value with the same key specified in a configuration file for a directory or a configuration header in a markup document.
Attributes
- Inherited from:
- ParserBuilderOps
Returns a new instance with the specified configuration value added.
Returns a new instance with the specified configuration value added.
The specified value with have higher precedence than any value with the same key registered by extension bundles, but lower precedence than any value with the same key specified in a configuration file for a directory or a configuration header in a markup document.
Attributes
- Inherited from:
- ParserBuilderOps
Enables all extensions that process raw content embedded into the host markup language. These are disabled by default as Laika is designed to render to multiple output formats from a single input document. With raw content embedded the markup document is tied to a specific output format.
Enables all extensions that process raw content embedded into the host markup language. These are disabled by default as Laika is designed to render to multiple output formats from a single input document. With raw content embedded the markup document is tied to a specific output format.
Attributes
- Inherited from:
- ParserBuilderOps