Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support markdown options in markdown plugins #145

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Mister-Hope
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented May 17, 2024

Pull Request Test Coverage Report for Build 9124427441

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 49.759%

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

💛 - Coveralls

@pengzhanbo
Copy link
Member

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
Copy link
Member Author

Mister-Hope commented May 17, 2024

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
Copy link
Member

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
Copy link
Member Author

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

"outDir": "./lib"
"outDir": "./lib",
"paths": {
"@vuepress/markdown": ["./src/types.d.ts"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be verbose to require this config. What about putting the declare module clause inside options.ts?

@meteorlxy
Copy link
Member

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

@Mister-Hope Mister-Hope marked this pull request as draft September 11, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants