Streamline extension API
Is your feature request related to a problem? Please describe.
What is the current stance on plugins for vitepress? I'm aware that it was decided to not maintain a plugin system similar to vuepress, but how'd you generally advice authoring an extension for vitepress, which has to access both config and app context?
I'm working on a plugin that needs to inject an md parser (which is done via vitepress config) and attach a route changed listener (which is done via enhanceApp).
It's all fine as long as you're performing this one-time in your own project, but sharing such extension as a package/plugin is bothersome, as the user has to both inject it in the config and create a boilerplate theme/index.js to inject the route listener.
Unless I'm mussing something (like, maybe it's somehow possible to attach the listener via a header script specified in the config?), could you please consider exposing an enhanceApp hook in the config? This way we would be able to install vitepress plugins by overriding the config, eg:
import { defineConfig } from "vitepress";
import plugin from "plugin";
export default defineConfig(plugin({
...
}));Event better would be adding a prop to the config with a (config) => config array, so it'd feel more familiar to how we inject plugins in general:
import { defineConfig } from "vitepress";
import plugin from "plugin";
export default defineConfig({
plugins: [plugin]
});Describe the solution you'd like
Describe alternatives you've considered
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the docs.
- Read the Contributing Guidelines.
- Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.
Source: vuejs/vitepress