Use a Paths Loader File for non-Markdown blobs #4882
Unanswered
its-miroma
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to build a Vitepress plugin for versioning by working with
git
.I have created a
[version]/[path].md
entry point, with only this:<!--@content-->
And here's an abstract of the logic in
[version]/[path].paths.ts
:Show
[version]/[path].paths.ts
Unfortunately, Vitepress only supports the Paths Loader for a base file like
[path].md
, where.md
is mandatory.The solution I've tried fails at rendering, for example, an image with
[path]=lake.jpg
, because it sees it aslake.jpg.md
and it errors:"Error parsing JavaScript expression"
Would it be possible to support using a Paths Loader with a non-Markdown raw blob, for example a JPG file, by creating a
[path]
file without the extension?Vitepress should either look for file names/paths containing square brackets, not necessarily
.md
, or base the search on thepaths.ts
files.Or, is there another way I can do this, since the Paths Loader is not designed to load binary or raw assets?
This would allow for dynamically loading binary assets or raw files through the Vitepress routing system, not just Markdown files.
Relevant source code in Vitepress: https://github.com/vuejs/vitepress/blob/main/src/node/plugins/dynamicRoutesPlugin.ts#L213
Beta Was this translation helpful? Give feedback.
All reactions