Skip to content

How to obtain absolute file paths (for images)? #990

Answered by wooorm
stephanbogner asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there! The answer is: it depends. First of all. This is not what remark is for. remark is about markdown. This is about HTML. You want rehype. More on the difference is available in several docs, including this one in remark-rehype.

I have no reference to the actual image file.

Well, where are the images?

I am using Remark through Astro so the issue might also arise from there.

Perhaps!

→ The VFile only has the cwd which is obviously not the location of the markdown file

It should have a path (which is a getter, so you don’t easily see it in the console when printing file, what do you see if you print file.path). If it doesn’t, then that’s a bug in Astro.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@stephanbogner
Comment options

@wooorm
Comment options

@stephanbogner
Comment options

@stephanbogner
Comment options

@wooorm
Comment options

Answer selected by ChristianMurphy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants