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: improve markdown component name #16

Open
privatenumber opened this issue Mar 11, 2023 · 3 comments
Open

feat: improve markdown component name #16

privatenumber opened this issue Mar 11, 2023 · 3 comments

Comments

@privatenumber
Copy link

Problem

When using this plugin in conjunction with vite-plugin-pages, creating a markdown page with a specific name can cause component resolution issues with unplugin-vue-components.

For example, if I create a projects.md, behind the scenes, this plugin transforms it a component named "Projects". So when trying to auto-import the ~/components/Projects.vue component via <Projects /> using unplugin-vue-components, it doesn't work because Vue.js thinks I'm self-referencing the current page-component.

Feature request

To avoid this problem, I suggest implementing one of the following solutions:

  • Add a "Md" or "Markdown" suffix to the component name to differentiate it from other components. For example, the component generated from projects.md would be named "ProjectsMd" or "ProjectsMarkdown".
    Add an option to configure the component name during transformation, so that users can customize the component name to suit their needs.

  • I believe that implementing one of these solutions would resolve the issue and improve the user experience for those using these plugins together.

@antfu
Copy link
Member

antfu commented Mar 23, 2023

Yeah, I think it makes sense to have a better default and a custom function for users to customize the naming convention. PR welcome :)

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

No branches or pull requests

3 participants