1.0.0 • Published 5 years ago
markdown-it-img-replacer v1.0.0
markdown-it-img-replacer
Replace markdown image URLs.
Usage
const md = require('markdown-it')()
const mir = require('markdown-it-img-replacer')
const html = await mir(md, 'Image: ', 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.
 
 
1.0.0
5 years ago