vuejs/vitepress

Unified API for VitePress Plugins

开放

#3,966 创建于 2024年6月18日

 (2 条评论) (17 个反应) (0 位负责人)TypeScript (1,541 个派生)batch import
help wantedstale

仓库指标

星标
 (8,856 个星标)
PR 合并指标
 (平均合并 3小时 1分钟) (30 天内合并 20 个 PR)

描述

Is your feature request related to a problem? Please describe.

The VitePress community has develop a range of amazing plugins which elevate the user experience of VitePress to another level.

Unfortunately, there isn't a clear and unified way of how users add these plugins to their VitePress setup. For example

I understand the reason for why these different approaches are required, as different plugins might interact with different components of the VitePress stack (underlying architecture, markdown rendering, frontend Vue components...).

However, for a user this can be very confusing. Furthermore, if more plugins would start to adapt the wrapper way, we would quickly end up in a world where a config.ts starts like this:

export default withMermaid({withPageFind({withTabs({...

Which I (personally) find really hard to read and maintain.

Describe the solution you'd like

It would be great to have a common "API" for Vite Press plugins? I.e. providing hooks for all that required, underlying components for plugins to hook into (plugin developers would have a much better understand how requirements could look like). Once this is available, it would also be great to have a "suggested" plugin development guide.

Describe alternatives you've considered

There isn't really a good alternative, other than the way it is right now. It's the plugin developers responsibility to determine which of the above way they would choose for their plugin. Which puts an additional overhead on the developer potentially discouraging the development of new, great plugins.

Additional context

I'm not a plugin developer myself, so this issue was created from a user's PoV. However, there was a quick chat on Discord about this topic, where plugin developer also confirmed that this would be a nice addition to have.

Validations

贡献者指南