Resource

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.

Parameters

name

the name of the subdocument, without extension

path

the absolute path to the subdocument file or resource

workingDirectory

the working directory to be used to resolve relative file paths within the subdocument. Note that if this is null, then the pipeline's working directory should be used. To get consistent results, rely on the context's com.quarkdown.core.context.file.FileSystem.workingDirectory.

content

the subdocument text content

Constructors

Link copied to clipboard
constructor(name: String, path: String, workingDirectory: File? = null, content: CharSequence)

Properties

Link copied to clipboard
Link copied to clipboard
open override val name: String
Link copied to clipboard
Link copied to clipboard
open override val uniqueName: String

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

Link copied to clipboard
val workingDirectory: File? = null

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.