@pondorasti/remark-img-links

1.0.8 • Public • Published

Lint and Test NPM NPM Downloads Size

remark-img-links

remark plugin to prefix relative image paths with an absolute URL.

Installation

npm install @pondorasti/remark-img-links

Usage

Source

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))
  })

Yields

<p><img src="https://cdn.domain.com/images/screenshot.png" alt="Screenshot"></p>

API

remark.use(imgLinks[, options])

  • options.absolutePath (required) - the absolute path that will be prepended to the begging of image links.

Contributions

If you are interested in contributing to this project, please open an issue with a description of what you would like to add.

License

MIT © Alexandru Turcanu

Package Sidebar

Install

npm i @pondorasti/remark-img-links

Weekly Downloads

518

Version

1.0.8

License

MIT

Unpacked Size

6.61 kB

Total Files

9

Last publish

Collaborators

  • pondorasti