Paths
PluginPathsAPI — safe path resolution within the workspace for Boltdocs plugins with directory traversal protection.
ctx.paths — PluginPathsAPI
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 also
- PluginContext — base context object
- Virtual Modules — runtime virtual module declarations
- Middleware — transform middleware pipeline
Last updated on October 18, 2026