laika.api.bundle

Members list

Type members

Classlikes

The API for declaring directives that can be used as block elements in markup documents.

The API for declaring directives that can be used as block elements in markup documents.

Attributes

Source
directives.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Builder API for block parsers.

Builder API for block parsers.

Builds a span parser definition lazily by passing the recursive parsers of the host language.

This indirection is needed when supplying parser implementations as many parsers recursively parse child elements. A list parser for example needs to be able to detect any other block or span element within a list item. But since it has no way of knowing which extensions a user might have added to the host language, those parsers are supplied from the outside by the parser engine.

Attributes

Companion
object
Source
ParserBuilder.scala
Supertypes
class Object
trait Matchable
class Any

Entry points for the builder API for block parsers.

Entry points for the builder API for block parsers.

The entry points provide access to the parsers for child blocks (recursive), child spans (withSpans) or escape sequences (withEscapedText). These are methods with decreasing power, as the parser for recursive blocks does also provide the span parsers.

If your parser implementation is completely independent from the host markup language you can use the standalone method.

Attributes

Companion
class
Source
ParserBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class BlockParserDefinition(val startChars: Set[Char], val parser: Parser[Block], val isRecursive: Boolean, val position: BlockPosition, val precedence: Precedence, val paragraphLineCheck: Option[PrefixedParser[Any]]) extends ParserDefinition[Block]

Defines a parser for a single kind of block element, like a quoted block or a bullet list for example.

Defines a parser for a single kind of block element, like a quoted block or a bullet list for example.

Value parameters

isRecursive

indicates whether this parser produces child elements by recursively applying the parsers for the host language

paragraphLineCheck

a test for the start of each line in plain paragraphs that indicates whether the line might be the start of a block identified by this parser

parser

the parser for the block element

position

indicates whether this parser is responsible for root or nested elements only, or for both

precedence

indicates whether the parser should be applied before the base parsers of the host language (high precedence) or after them

startChars

the optional start characters that can start this block (allows performance optimizations when defined)

Attributes

Source
ParserDefinition.scala
Supertypes
class Object
trait Matchable
class Any
sealed trait BlockPosition

Specifies the position a block element is allowed to appear in.

Specifies the position a block element is allowed to appear in.

RootOnly elements can only appear on the top level of the document hierarchy, while NestedOnly can only appear nested within other elements, e.g. as part of a list item or within a quoted block. Any allows block elements in any position.

Attributes

Companion
object
Source
ParserDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Any.type
object NestedOnly.type
object RootOnly.type
object BlockPosition

Attributes

Companion
trait
Source
ParserDefinition.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait BundleOrigin

Indicates whether an extension bundle is a built-in default provided by the library, a collection of extensions installed by a markup format or user-defined.

Indicates whether an extension bundle is a built-in default provided by the library, a collection of extensions installed by a markup format or user-defined.

This is relevant for determining the precedence of installed bundles when merging them, as user-supplied functionality always overrides library defaults.

Attributes

Companion
object
Source
BundleOrigin.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Library.type
object Mixed.type
object Parser.type
object Theme.type
object User.type
object BundleOrigin

Attributes

Companion
trait
Source
BundleOrigin.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Provides parser implementation for configuration header sections in text markup files, which are expected to be in HOCON format.

Provides parser implementation for configuration header sections in text markup files, which are expected to be in HOCON format.

Attributes

Source
ConfigHeaderParser.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Responsible for providing the parsers for configuration files and configuration headers in markup documents as part of an ExtensionBundle.

Responsible for providing the parsers for configuration files and configuration headers in markup documents as part of an ExtensionBundle.

Laika has a built-in implementation of this API that parses configuration as HOCON, but these can be overridden by adding an instance of this trait to a ParserBundle within an ExtensionBundle.

Attributes

Companion
object
Source
ConfigProvider.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
ConfigProvider.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Provides the basic building blocks for Laika's Directive API.

Provides the basic building blocks for Laika's Directive API. This trait is not used directly, but instead its three sub-traits Blocks, Spans and Templates, which represent the concrete implementations for the three directive types.

Attributes

Source
directives.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BlockDirectives.type
object SpanDirectives.type
object TemplateDirectives.type

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(...)
 val linkDirectives = Seq(...)
}
object OtherDirectives extends DirectiveRegistry {
 [...]
}

val transformer = Transformer
 .from(Markdown)
 .to(HTML)
 .using(MyDirectives, OtherDirectives)
 .build

Attributes

Source
DirectiveRegistry.scala
Supertypes
class Object
trait Matchable
class Any
Self type

The default implementations for determining the document type of the input based on its path.

The default implementations for determining the document type of the input based on its path.

Attributes

Source
DocumentTypeMatcher.scala
Supertypes
class Object
trait Matchable
class Any
Self type

An extension bundle is a collection of parser extensions, rewrite rules, render overrides and other features to be applied to parse, render and transform operations.

An extension bundle is a collection of parser extensions, rewrite rules, render overrides and other features to be applied to parse, render and transform operations. It serves as a central registry for all of Laika's extension and customization hooks.

The base trait contains empty implementations for all these features, therefore any bundle implementation only needs to override the relevant members.

If the bundle implementation is not parameterized, the most convenient choice for users would be to simply implement it as an object, like all built-in extensions do:

object MyExtensions extends ExtensionBundle {

 // override one or more members

}

This way a user can easily pass it to the operation builders:

val transformer = Transformer
 .from(Markdown)
 .to(HTML)
 .using(MyExtensions)
 .build

Attributes

Companion
object
Source
ExtensionBundle.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object LaikaDefaults.type
object PrettyURLs.type
object SyntaxHighlighting.type
object GitHubFlavor.type
Self type

Provides default ExtensionBundle instances.

Provides default ExtensionBundle instances.

Attributes

Companion
trait
Source
ExtensionBundle.scala
Supertypes
class Object
trait Matchable
class Any
Self type

The API for declaring directives that can be used in links.

The API for declaring directives that can be used in links.

Attributes

Source
directives.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait ParserBuilder[T <: ParserDefinition[_]]

Base trait for SpanParserBuilder and BlockParserBuilder APIs.

Base trait for SpanParserBuilder and BlockParserBuilder APIs.

Attributes

Source
ParserBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ParserBundle(val blockParsers: Seq[BlockParserBuilder], val spanParsers: Seq[SpanParserBuilder], val syntaxHighlighters: Seq[SyntaxHighlighter], val markupParserHooks: Option[ParserHooks], val configProvider: Option[ConfigProvider], val templateParser: Option[Parser[TemplateRoot]], val styleSheetParser: Option[Parser[Set[StyleDeclaration]]])

Bundles a collection of all types of parsers used in a transformation.

Bundles a collection of all types of parsers used in a transformation.

The parsers for text markup and configuration headers are meant to complement base parsers defined by the host language. If they fail for a given input the built-in parsers will still be tried for the same block, span or configuration header respectively.

The parsers for stylesheets and templates on the other hand are meant to overwrite any previously installed parsers.

Value parameters

blockParsers

parsers for block elements in text markup, complementing the parsers of the host language

configProvider

parser for configuration headers in text markup and template documents and configuration documents

markupParserHooks

hooks for markup parsers to control aspects beyond the individual span and block parsers

spanParsers

parsers for span elements in text markup, complementing the parsers of the host language

styleSheetParser

parser for CSS documents

syntaxHighlighters

parsers for syntax highlighting of code blocks

templateParser

parser for template documents

Attributes

Source
ParserBundle.scala
Supertypes
class Object
trait Matchable
class Any
sealed trait ParserDefinition[E <: Element]

Defines a parser for a single kind of text markup, like a literal text span or a bullet list for example.

Defines a parser for a single kind of text markup, like a literal text span or a bullet list for example.

Attributes

Source
ParserDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ParserHooks(val postProcessBlocks: Seq[Block] => Seq[Block], val postProcessDocument: UnresolvedDocument => UnresolvedDocument, val preProcessInput: String => String)

Hooks for markup parsers to control aspects beyond the individual span and block parsers defined for the host language.

Hooks for markup parsers to control aspects beyond the individual span and block parsers defined for the host language.

Value parameters

postProcessBlocks

function invoked for every block container, allowing post-processing of the result

postProcessDocument

function invoked after parsing but before rewriting, allowing to modify the document

preProcessInput

function invoked before parsing, allowing to pre-process the input

Attributes

Source
ParserBundle.scala
Supertypes
class Object
trait Matchable
class Any
sealed abstract class PathAttributes

Attributes

Companion
object
Source
PathTranslator.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
PathTranslator.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Translates paths of input documents to the corresponding output path.

Translates paths of input documents to the corresponding output path. The minimum translation that usually has to happen is to replace the suffix from the input document the path has been obtained from to the suffix of the output format. Further translations are allowed to happen based on user configuration.

Attributes

Companion
object
Source
PathTranslator.scala
Supertypes
class Object
trait Matchable
class Any

Builders that apply additional functionality to existing path translator instances.

Builders that apply additional functionality to existing path translator instances.

Attributes

Companion
trait
Source
PathTranslator.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait Precedence

Indicates whether a parser should be applied before the base parsers of the host language (high precedence) or after them (low precedence).

Indicates whether a parser should be applied before the base parsers of the host language (high precedence) or after them (low precedence).

Attributes

Companion
object
Source
ParserDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object High.type
object Low.type
object Precedence

Attributes

Companion
trait
Source
ParserDefinition.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Precedence.type

Collects custom render functions that adjust the rendered output of one or more AST nodes.

Collects custom render functions that adjust the rendered output of one or more AST nodes.

Attributes

Source
RenderOverrides.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Overrides
object SlugBuilder

Default implementation for the logic that transforms section titles, document names and user-provided ids to a slug that is compatible with HTML/XML ids, URLs and file names.

Default implementation for the logic that transforms section titles, document names and user-provided ids to a slug that is compatible with HTML/XML ids, URLs and file names.

Attributes

Source
SlugBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type

The API for declaring directives that can be used as inline elements in markup documents.

The API for declaring directives that can be used as inline elements in markup documents.

Attributes

Source
directives.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Builder API for span parsers.

Builder API for span parsers.

Attributes

Companion
object
Source
ParserBuilder.scala
Supertypes
class Object
trait Matchable
class Any

Entry points for the builder API for span parsers.

Entry points for the builder API for span parsers.

The two entry points are either recursive if your parser implementation needs to recursively parse child spans defined by the host language or standalone if it doesn't.

Attributes

Companion
class
Source
ParserBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class SpanParserDefinition(val startChars: Type[Char], val parser: Parser[Span], val isRecursive: Boolean, val precedence: Precedence) extends ParserDefinition[Span]

Defines a parser for a single kind of span element, like a literal text span or a link reference for example.

Defines a parser for a single kind of span element, like a literal text span or a link reference for example.

Value parameters

isRecursive

indicates whether this parser produces child elements by recursively applying the parsers for the host language

parser

the parser for the span element

precedence

indicates whether the parser should be applied before the base parsers of the host language (high precedence) or after them

startChars

all start characters that can start this span (allows performance optimizations)

Attributes

Source
ParserDefinition.scala
Supertypes
class Object
trait Matchable
class Any

Captures the parser implementation and aliases of the syntax highlighter for a particular language.

Captures the parser implementation and aliases of the syntax highlighter for a particular language.

Attributes

Source
SyntaxHighlighter.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AlloySyntax.type
object CSSSyntax.type
object DartSyntax.type
object DhallSyntax.type
object EBNFSyntax.type
object HOCONSyntax.type
object HTMLSyntax.type
object HaskellSyntax.type
object JSONSyntax.type
object JSX.type
object JavaScriptSyntax.type
object JavaSyntax.type
object LaikaASTSyntax.type
object MarkdownSyntax.type
object PythonSyntax.type
object SQLSyntax.type
object Scala3.type
object ScalaSyntax.type
object ShellSyntax.type
object TSX.type
object TypeScriptSyntax.type
object XMLSyntax.type
object YAMLSyntax.type
Show all

The API for declaring directives that can be used in templates.

The API for declaring directives that can be used in templates.

Attributes

Source
directives.scala
Supertypes
class Object
trait Matchable
class Any
Self type