Closed nhoizey closed 1 year ago
It looks like there is a solution described here:
@manunamz do you know any Markdown-it plugin that already used this?
Hiya @nhoizey !
Yep! markdown-it-wikirefs
is setup to look for urls in a configurable way via its resolveHtmlHref
option.
You can also see it in action in eleventy-wikibonsai
, which gives several examples of how to access the inputPath
in its configuration.
Since you might be looking for image urls, I ended up doing something sort of hacky to just get it up and running, but it works if files are placed where the code expects them to be.
@manunamz thanks a lot, I'll look at these examples! 🙏
And now there's also markdown-it-image-size
thanks to @boyum:
It works without adding anything to my code, just adding the plugin. 🤩
I'm using a bunch of Markdown-it plugins, and face an issue with
markdown-it-image-size
which looks for an image in my project's root folder instead of the folder where the Markdown file is.Is there an existing way to know the path of the Markdown file in Markdown-it (and its plugins)?
I might use it with
markdown-it-replace-link
to add the Markdown path to the image, for example.