Provides the basic building blocks for Laika's Directive API.
Registry for custom directives.
Registry for custom directives. Application code can define any number of instances mixing in this trait and then pass them to Parse, Render or Transform operations:
object MyDirectives extends DirectiveRegistry { val spanDirectives = Seq(...) val blockDirectives = Seq(...) val templateDirectives = Seq(...) } object OtherDirectives extends DirectiveRegistry { [...] } Transform .from(Markdown) .to(HTML) .using(MyDirectives, OtherDirectives) .fromFile("hello.md") .toFile("hello.html")
Internal API that processes all directives defined by one or more DirectiveRegistries.
Internal API that processes all directives defined by one or more DirectiveRegistries. This extension is installed by default, unless the transformation is run in strict mode.
Represents the failed computation of a directive part.
Represents the failed computation
of a directive part. This failure type
can be combined with other failures
to "collect" all error messages, in contrast
to the Either
type for example, which always
only carries one Left
value through a chain
of computations.
The id for a directive part.
Represents the result (or combined results) of processing one or more parts of a directive.
Represents the successful computation of a directive part.
The API for declaring directives that can be used as block elements in markup documents.
Generic support for builders that allow to combine container types with matching type classes into a final result.
Generic support for builders that allow to combine container types with matching type classes into a final result.
The concrete use case for Laika is a concise and type-safe API for setting up directives or text roles. For these APIs and sample code see laika.directive.BuilderContext.dsl, laika.rst.ext.Directives and laika.rst.ext.TextRoles.
This implementation is based on a concept outlined by Sadek Drobi in this gist: https://gist.github.com/sadache/3646092. The code used here is only a simplified subset of the demonstrated functionality.
Empty default instance without any directives installed.
The API for declaring directives that can be used as inline elements in markup documents.
Provides the implementation for the standard directives included in Laika.
Provides the implementation for the standard directives included in Laika.
These include:
toc
: Generates a table of content from a specified root node.fragment
: Marks a block in a markup document as being separate from the main content,
so that it can be placed separately in templates.for
: Accesses a value from the context and sets it as the reference context for its
body elements, executing the body if the referenced value is non-empty and executing
it multiple times when it is a collection.if
: Accesses a value from the context and processes the body element only when
it is a value recognized as true.format
: Process the body element only when the output format matches the format
specified in the directive (e.g. pdf
or html
).style
: Adds a style property to the body element.fragment
: Adds the body as a fragment to the target document, separate from the main
content, to be rendered in different locations of the output, like headers, footers or sidebars.pageBreak
: Inserts a page break element into the tree (will only be rendered by page-based
output, like XSL-FO or PDF.
The API for declaring directives that can be used in templates.
Provides the basic building blocks for Laika's Directive API. This trait is not used directly, but instead its three subtraits
Blocks
,Spans
andTemplates
, which represent the concrete implementations for the three directive types.