markdown-it-img-replacer

1.0.0 • Public • Published

markdown-it-img-replacer

Replace markdown image URLs.

Actions Status

Usage

const md = require('markdown-it')()
const mir = require('markdown-it-img-replacer')

const html = await mir(md, 'Image: ![alt text](https://example.com/image.png)', url => url + '?size=512')

/* html is
<p>Image: <img src="https://example.com/image.png?size=512" alt="alt text"></p>
*/

Documentation

  • Global exports
    • mir(md, markdown, replacer)
      • Replaces image URLs in a markdown string.

      • md: markdownit - A markdownit instance, tailored to your project.

      • markdown: string - The markdown string to replace the images of.

      • replacer: (url: string) => string | Promise<string> - Called for every image in the markdown string. The URL is replaced with the returned string.

Readme

Keywords

none

Package Sidebar

Install

npm i markdown-it-img-replacer

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

6.87 kB

Total Files

9

Last publish

Collaborators

  • fiws