Context

interface Context

Container of information about the current state of the pipeline, shared across the whole pipeline itself.

Inheritors

Properties

Link copied to clipboard
abstract val attachedPipeline: Pipeline?

The pipeline this context is attached to, if it exists. A context can have up to 1 attached pipeline.

Link copied to clipboard

Information about the node tree that is being processed by the attachedPipeline.

Link copied to clipboard

Mutable information about the final document that is being created.

Link copied to clipboard
abstract val fileSystem: FileSystem

The file system relative to this context which can be used to access files starting from a certain working directory.

Link copied to clipboard
abstract val flavor: MarkdownFlavor

The Markdown flavor in use.

Link copied to clipboard
abstract val libraries: Set<Library>

Loaded libraries to look up functions from.

Link copied to clipboard

External libraries that can be loaded by the user into libraries. These libraries are, for instance, fetched from the library directory (--libs option) and can be loaded via the .include {name} function.

Link copied to clipboard

Tables that store key-value localization pairs for each supported locale. Each table is identified by a unique name.

Link copied to clipboard

Media storage that contains all the media files that are referenced within the document. For example, if an image node references a local image file "image.png", the local file needs to be exported to the output directory in order for a browser to look it up. This storage is used to keep track of all the media files that may need to be exported.

Link copied to clipboard
abstract val options: ContextOptions

Global properties that affect several behaviors and that can be altered through function calls.

Link copied to clipboard
abstract val subdocument: Subdocument

The subdocument that is being processed by this context. A subdocument can be the root one or another referenced by a link.

Link copied to clipboard

Directed graph of the subdocuments that are part of the document complex. Each subdocument is a separate document file that can be rendered independently, and is referenced by a link from the main document or another subdocument.

Functions

Link copied to clipboard
abstract fun fork(subdocument: Subdocument = this.subdocument): ScopeContext
Link copied to clipboard
abstract fun getFunctionByName(name: String): Function<*>?

Looks up a function by name.

Link copied to clipboard
Link copied to clipboard
abstract fun localize(tableName: String, key: String, locale: Locale = documentInfo.locale ?: throw LocaleNotSetException()): String

Localizes a string to this context's language (the locale set in documentInfo) by looking up a key in a localization table.

Link copied to clipboard
fun Context.localizeOrDefault(tableName: String = STDLIB_LOCALIZATION_TABLE_NAME, key: String): String?

Localizes a key from the stdlib table. If the key is not found in the context's locale, it falls back to the default locale (English).

Link copied to clipboard
fun Context.localizeOrNull(tableName: String = STDLIB_LOCALIZATION_TABLE_NAME, key: String, locale: Locale? = null): String?

Localizes a key from a table.

Link copied to clipboard
open fun newUuid(): String

Generates a new UUID via ContextOptions.uuidSupplier.

Link copied to clipboard
abstract fun resolve(reference: ReferenceLink): LinkNode?

Tries to resolve a reference link to an actual link. If the resolution succeeds, ReferenceLink.onResolve callbacks are executed.

abstract fun resolve(call: FunctionCallNode): FunctionCall<*>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard