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].mdentry point, with only this:<!--@content-->And here's an abstract of the logic in
[version]/[path].paths.ts:Show
[version]/[path].paths.tsUnfortunately, Vitepress only supports the Paths Loader for a base file like
[path].md, where.mdis mandatory.The solution I've tried fails at rendering, for example, an image with
[path]=lake.jpg, because it sees it aslake.jpg.mdand 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.tsfiles.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