Subdocument

sealed interface Subdocument

A subdocument in a Quarkdown document is an independent unit that can be rendered separately, can be linked from other documents, and can link to other subdocuments in order to create a graph of subdocuments, available via com.quarkdown.core.context.Context.subdocumentGraph.

Additionally, a com.quarkdown.core.rendering.PostRenderer may adopt different strategies for rendering different kinds of subdocuments. For instance, an HTML post-renderer may render the root subdocument as a full HTML structure, with HTML, CSS and JS, while a non-root subdocument may be just a single HTML resource linked from another document.

Inheritors

Types

Link copied to clipboard
data class Resource(val name: String, val path: String, val workingDirectory: File? = null, val content: CharSequence) : Subdocument

A Subdocument that is bound to a file or resource available at a specific path and can be referenced by a link from the main document or another subdocument.

Link copied to clipboard
data object Root : Subdocument

The root Subdocument, which is the main document of the Quarkdown pipeline. This is always the entry point of the compilation process, as it is the input content that is supplied to the pipeline.

Properties

Link copied to clipboard
abstract val name: String

The name of the subdocument, without any file extension.

Link copied to clipboard
open val uniqueName: String

A unique name for the subdocument, which reduces the risk of name collisions. This is a suitable name for output resources.

Functions

Link copied to clipboard

Returns the output file name for the subdocument, based on the context's options. If the pipeline enforces minimal subdocument collisions (com.quarkdown.core.pipeline.PipelineOptions.minimizeSubdocumentCollisions), Subdocument.uniqueName is returned, otherwise just Subdocument.name, which is more human-readable but prone to collisions.