unified

Project: Pondorasti/remark-img-links

Package: @pondorasti/remark-img-links@1.0.8

  1. Dependents: 0
  2. Prefix relative image paths with an absolute URL.
  1. remark 214
  2. markdown 154
  3. plugin 140
  4. remark-plugin 82
  5. link 16
  6. url 13

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

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