You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know @mattjennings has written a really useful plugin to get mdsvex-relative-images but I'm wanting to get image paths via a plugin from the .md files in my project.
I was hoping to use the rehype-local-image-to-cloudinary for the images on my project but it needs the image path to transform the image.
So the current setup I have is using an endpoint:
// src/routes/posts/_posts.jsimport{basename,dirname}from'path'constmodules=import.meta.globEager('/posts/**/*.md')exportconstposts=Object.entries(modules).map(([filepath,module])=>{constslug=basename(dirname(filepath))const{ metadata }=moduleconst{ html }=module.default.render()return{
slug,
html,
...metadata,}})
I'm getting the html here rather than the component and when SvelteKit builds the project the assets aren't in /_app/assets/ which I think Matt'sremark plugin does for the component.
So this is why I'm trying to find a way to replace the <img src with a url not local to the project.
Or if it doesn't have to be then even better, what I'm trying to avoid is having to add imports to each .md file for the images and instead use a plugin of some sort.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I know @mattjennings has written a really useful plugin to get
mdsvex-relative-images
but I'm wanting to get image paths via a plugin from the.md
files in my project.I was hoping to use the
rehype-local-image-to-cloudinary
for the images on my project but it needs the image path to transform the image.So the current setup I have is using an endpoint:
I'm getting the html here rather than the component and when SvelteKit builds the project the assets aren't in
/_app/assets/
which I think Matt'sremark plugin does for the component.So this is why I'm trying to find a way to replace the
<img src
with a url not local to the project.Or if it doesn't have to be then even better, what I'm trying to avoid is having to add imports to each
.md
file for the images and instead use a plugin of some sort.Any guidance greatly appreciated
Beta Was this translation helpful? Give feedback.
All reactions