vuepress / ecosystem

Official plugins and themes for VuePress2
https://ecosystem.vuejs.press
MIT License
20 stars 26 forks source link

feat: support markdown options in markdown plugins #145

Open Mister-Hope opened 1 month ago

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 9124427441

Details


Totals Coverage Status
Change from base Build 9123655949: 0.0%
Covered Lines: 681
Relevant Lines: 1238

💛 - Coveralls
pengzhanbo commented 1 month ago

Removed plugin-markdown-image.d.ts and plugin-markdown-math.d.ts, and migrated to types.d.ts, as well as exported it by name.

Users can import types in the following ways:

/// <reference types="@vuepress/plugin-markdown-image/types" />
/// <reference types="@vuepress/plugin-markdown-math/types" />

export default {
  markdown: {
    image: {},
    math: {},
  }
}
Mister-Hope commented 1 month ago

I am expecting these types can be automatically loaded when users are importing those plugins.

Can we do that by importing the reference inside the node entrance?

pengzhanbo commented 1 month ago

I am expecting these types can be automatically loaded when users are importing those plugins.

Can we do that by importing the reference inside the node entrance?

Currently, this is the only way to ensure the correct extension of typescript types.

Mister-Hope commented 1 month ago

Cc @meteorlxy , So I think we might need a string unknown for markdown, or a new generic for defineUserConfig

meteorlxy commented 1 month ago

declare module should be allowed in a common .ts file (not only in .d.ts files).

Here's an example: https://github.com/mdit-vue/mdit-vue/blob/0a1eb8580499aa7d0db6ea7c14fad58717448fbb/packages/plugin-sfc/src/types.ts#L78