Plugins
Install optional features without making them part of every project.
Explicit activation
RDX only executes plugins listed in rdx.config.ts. Merely installing a package
does not turn it on or create version files.
The official plugins include @lexibase/rdx-versioning for snapshots and
@lexibase/rdx-i18n for multiple content languages. Search, TOC, and
built-in MDX components do not need plugins.
Assisted installation
From your documentation project root:
pnpm rdx add versioning
The command installs the official package, adds the import and plugin entry to your configuration, validates it, and prepares the runtime. An already configured plugin is not added twice, and an installed version is preserved. Restart the development server after activation.
Use rdx add i18n to activate multilingual documentation. It uses the existing
lang setting, asks for additional language tags and prepares their translation
folders. See Languages for configuration and authoring.
Manual installation
pnpm add @lexibase/rdx-versioning@latest
Use the channel compatible with your runtime. Then configure it explicitly:
import { defineConfig } from '@lexibase/rdx'
import { versioning } from '@lexibase/rdx-versioning'
export default defineConfig({
metadata: { applicationName: 'My documentation' },
plugins: [versioning()],
})
Prepare the runtime, then continue with Versioning:
pnpm rdx prepare
Removal and failed installation
To deactivate a plugin, remove its entry and unused import from the configuration. You can then uninstall its package. Existing snapshots and manifests are not deleted automatically.
If dependency installation fails, inspect package and lockfile changes before retrying. For package-manager release-age policies, approve only releases you trust under your project's policy; do not disable supply-chain protections globally. See Troubleshooting.
Custom plugin authors
Plugins are trusted server-side code and run in configuration order. An
RdxPlugin declares a unique name, apiVersion: 1, and optional hooks or
commands. For example, this plugin publishes a separate documentation tree:
import type { RdxPlugin } from '@lexibase/rdx'
export function labs(): RdxPlugin {
return {
name: 'labs',
apiVersion: 1,
setup() {
return {
sources: [
{
id: 'labs',
label: 'Labs',
docsDir: 'labs/docs',
routePrefix: 'labs',
},
],
}
},
}
}
Add the returned plugin to plugins in rdx.config.ts. The source's
project-relative docsDir supplies content under /docs/labs. Each source
needs a unique ID and a unique, single-segment route prefix.
setup receives the absolute rootDir, resolved config, and current
command. It may be async and can run more than once, including on runtime
reads. Keep it idempotent and scope writes to explicit preparation or plugin
commands. Each entry in commands has a name, description, and
run(context), which also receives args: string[]. Command names must be
unique and avoid built-in CLI commands.