Paths

PluginPathsAPI — safe path resolution within the workspace for Boltdocs plugins with directory traversal protection.

ctx.paths — PluginPathsAPILink

Path resolution helpers that validate every result stays within the workspace. Both resolveDocs and resolveAsset reject paths that escape the base directory.

ts
const mdxFile = ctx.paths.resolveDocs('guides', 'getting-started', 'installation.mdx')
const image = ctx.paths.resolveAsset('public', 'logo.webp')
const fileUrl = ctx.paths.safeFileURL('/absolute/path/diagram.svg')

They throw an Error when the resolved path falls outside the workspace:

ts
// Throws: Path '../../etc/passwd' resolves to '/etc/passwd' which is
// outside the workspace boundary...
ctx.paths.resolveDocs('../../etc/passwd')

See alsoLink

Last updated on October 18, 2026

Was this page helpful?