Closed Mister-Hope closed 1 month ago
The page creation is based on markdown, and we extract page data by the markdown parser. If we want to support vue / ts pages, we need to parse the vue file / ts file when creating the page to keep the current process.
That means:
createPage
and bundler twice.data.headers
would be unavailable for sure.It might be ok if we skip the normal page creation process for vue / ts pages. However, I think this feature makes little sense for common users. Only some advance users might need this. IMO, no exceptions should be made for these rare cases.
In addition, for advanced users, they could already add pages via vue / ts by adding a custom Layout & node API.
Thus, I'm not in favor of adding extra complexity to this kind of feature that already has a way of being implemented.
If it's really a common use case, we can consider providing some method / utils to help adding pages programmatically
This issue is marked as stale
because it has not had recent activity. Issues marked with stale
will be closed if they have no activity within 7 days.
Clear and concise description of the problem
Generally,
.vue
and component with.js
.ts
could all be pages, so we can make vuepress support them out of box, while remaining the default pagesPattern to be only markdown.Suggested solution
A vue component:
The
lang="yaml"
is the default behavior, so we can make it optional, but declaring it provides volar with correct highlighting and formatting, we can also support lang='json'For js and ts component, a
frontmatter
named export is preferred: