MediaPassthrough

Handles passthrough paths in link and image URLs.

A passthrough path starts with the PATH_PREFIX symbol (@) and usually resolves to the output root. This allows referencing shared assets (e.g. static files, images) from any subdocument without relying on fragile relative paths.

For example, when rendering to HTML, @/logo.png refers to logo.png at the output root, regardless of the current subdocument's depth.

Passthrough paths are:

The actual replacement of the @ prefix with a concrete relative path (e.g. . or ..) is performed by the active com.quarkdown.core.rendering.NodeRenderer.

See also

Properties

Link copied to clipboard
const val PATH_PREFIX: String

Symbol used in URLs to indicate the root of the output directory.

Functions

Link copied to clipboard

Whether the given path is a passthrough path, i.e. it equals PATH_PREFIX or starts with it followed by a path separator.

Link copied to clipboard
fun replacePassthroughPrefix(path: String, replacement: String): String

Replaces the PATH_PREFIX at the start of path with replacement, if present. If the path is not a passthrough path, it is returned unchanged.