markdown-preview.nvim icon indicating copy to clipboard operation
markdown-preview.nvim copied to clipboard

Feature: Interpret absolute image links relative to `g:mkdp_images_path`

Open helins opened this issue 1 year ago • 5 comments

Some common workflows interpret absolute links relative to a well-known directory rather than the actual root of the filesystem, akin to how a web server interpret absolute links relative to the domain. I don't think there is currently a way for this plugin to behave like that regarding images.

I would suggest an additional boolean option for interpreting absolute image links relative to the existing g:mkdp_images_path (if provided). For instance, if g:mkdp_images_path is set to /foo/bar, then an image like ![](/baz.png) would resolve to /foo/bar/baz.png.

This should be an easy add-on and would turn this plugin from "great" to "excellent" :)

helins avatar Mar 13 '24 22:03 helins

I'm new mkdp user, could anyone please help me understand on how to use images in the markdown preview. Do I need to update something in my vim configs?

pk0dev avatar Jul 31 '24 11:07 pk0dev

Not for the preview to work, as long as you have the correct syntax and path the image it should display.

![Some description](./path/to/image.png)

image

Tweekism avatar Jul 31 '24 13:07 Tweekism

thank you @Tweekism and also I was having issue loading the images. I noticed that the image name contained spaces and so I remove the spaces and it worked.

pk0dev avatar Aug 02 '24 01:08 pk0dev

Oh ok, well I haven't tested this, but if your images have spaces in them, replacing spaces in your link it %20 should also work.

Tweekism avatar Aug 02 '24 02:08 Tweekism

thanks

pk0dev avatar Aug 02 '24 09:08 pk0dev