remark plugin to prefix relative image paths with an absolute URL.
npm install @pondorasti/remark-img-links
const html = require("remark-html")
const remark = require("remark")
const imgLinks = require("@pondorasti/remark-img-links")
remark()
.use(imgLinks, { absolutePath: "https://cdn.domain.com/" })
.use(html)
.process("![Screenshot](images/screenshot.png)", (err, file) => {
if (err) throw err
console.log(String(file))
})
<p><img src="https://cdn.domain.com/images/screenshot.png" alt="Screenshot"></p>
options.absolutePath
(required) - the absolute path that will be prepended to the begging of image links.
If you are interested in contributing to this project, please open an issue with a description of what you would like to add.