-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Local markdown/images using LoaderContect.renderMarkdown #14620
Description
Astro Info
Astro v5.15.1
Node v24.5.0
System macOS (arm64)
Package Manager bun
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Hello, all. I'm trying to implement a custom loader using the Object loader API.
The purpose is to split a single markdown file with multiple sections into different content entries.
https://github.com/abhijit-hota/astro-markdown-splitter/blob/main/src/loader.ts
While it works, it doesn't load images. (404 errors because of wrong path).
How to fix this?
I've found that the renderMarkdown method is an @astrojs/markdown-remark wrapper which can have a renderOpts option passed with a fileURL but isn't doing so now.
So I've tried following what glob does. I imported the createMarkdownProcessor directly to pass a fileURL but it still doesn't work.
Relevant issue I found: #14205
What's the expected result?
renderMarkdown should support local markdown files, etc.
Link to Minimal Reproducible Example
https://github.com/abhijit-hota/astro-markdown-splitter
https://stackblitz.com/edit/github-tdyozzko?file=package.json (Stackblitz doesn't really work because of Bun. Will fix that.)
Participation
- I am willing to submit a pull request for this issue.