Packages

p

laika

bundle

package bundle

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. trait BlockParserBuilder extends ParserBuilder[BlockParserDefinition]

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

  2. case class BlockParserBuilderOps(parserFactory: (RecursiveParsers) ⇒ Parser[Block], recursive: Boolean = false, position: BlockPosition = BlockPosition.Any, precedence: Precedence = Precedence.High, paragraphLineCheck: Option[PrefixedParser[Any]] = None) extends BlockParserBuilder with Product with Serializable

    Builder API for block parsers that allows to set the parser precedence.

  3. case class BlockParserDefinition(startChars: Set[Char], parser: Parser[Block], isRecursive: Boolean, position: BlockPosition, precedence: Precedence, paragraphLineCheck: Option[PrefixedParser[Any]] = None) extends ParserDefinition[Block] with Product with Serializable

    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.

    startChars

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

    parser

    the parser for the block element

    isRecursive

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

    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

    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

  4. sealed trait BlockPosition extends AnyRef

    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.

  5. sealed trait BundleOrigin extends AnyRef

    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.

  6. trait ConfigProvider extends AnyRef

    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.

  7. trait ExtensionBundle extends AnyRef

    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
  8. case class MarkupExtensions(blockParsers: Seq[BlockParserBuilder], spanParsers: Seq[SpanParserBuilder], syntaxHighlighters: Seq[SyntaxHighlighter], parserHooks: ParserHooks) extends Product with Serializable

    Bundles extensions for the text markup parsers defined for the host language to support additional syntax not recognized by the base parsers.

    Bundles extensions for the text markup parsers defined for the host language to support additional syntax not recognized by the base parsers.

    When extension parsers fail for a given input the built-in parsers will still be tried for the same block or span respectively.

    blockParsers

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

    spanParsers

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

    syntaxHighlighters

    parsers for syntax highlighting of code blocks

    parserHooks

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

  9. sealed trait ParserBuilder[T <: ParserDefinition[_]] extends AnyRef

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

    Builds a 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.

  10. case class ParserBundle(blockParsers: Seq[BlockParserBuilder] = Nil, spanParsers: Seq[SpanParserBuilder] = Nil, syntaxHighlighters: Seq[SyntaxHighlighter] = Nil, markupParserHooks: Option[ParserHooks] = None, configProvider: Option[ConfigProvider] = None, templateParser: Option[Parser[TemplateRoot]] = None, styleSheetParser: Option[Parser[Set[StyleDeclaration]]] = None) extends Product with Serializable

    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.

    blockParsers

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

    spanParsers

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

    syntaxHighlighters

    parsers for syntax highlighting of code blocks

    markupParserHooks

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

    configProvider

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

    templateParser

    parser for template documents

    styleSheetParser

    parser for CSS documents

  11. sealed trait ParserDefinition[E <: Element] extends AnyRef

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

  12. case class ParserHooks(postProcessBlocks: (Seq[Block]) ⇒ Seq[Block] = identity, postProcessDocument: (UnresolvedDocument) ⇒ UnresolvedDocument = identity, preProcessInput: (DocumentInput) ⇒ DocumentInput = identity) extends Product with Serializable

    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.

    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

  13. sealed trait Precedence extends AnyRef

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

  14. trait RenderOverrides extends AnyRef

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

  15. trait SpanParserBuilder extends ParserBuilder[SpanParserDefinition]

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

  16. case class SpanParserBuilderOps(parserFactory: (RecursiveSpanParsers) ⇒ PrefixedParser[Span], recursive: Boolean, precedence: Precedence) extends SpanParserBuilder with Product with Serializable

    Builder API for span parsers that allows to set the parser precedence.

  17. case class SpanParserDefinition(startChars: NonEmptySet[Char], parser: Parser[Span], isRecursive: Boolean, precedence: Precedence) extends ParserDefinition[Span] with Product with Serializable

    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.

    startChars

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

    parser

    the parser for the span element

    isRecursive

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

    precedence

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

  18. trait SyntaxHighlighter extends AnyRef

Value Members

  1. object BlockParser

    Builder API for block parsers.

    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.

  2. object BlockPosition
  3. object BundleOrigin
  4. object ConfigProvider
  5. object DocumentTypeMatcher

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

  6. object ExtensionBundle

    Provides default ExtensionBundle instances.

  7. object Precedence
  8. object SpanParser

    Builder API for span parsers.

    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.

Ungrouped