markdown-it-lazy-image

0.0.1 • Public • Published

markdown-it-lazy-image

Lazy image plugin for markdown-it parser, replace 'src' attributes with 'data-src' for use with lazyload.

Install

yarn add markdown-it-lazy-image

Usage

var md = require('markdown-it')();
var lazy_image = require('markdown-it-lazy-image');
 
md.use(lazy_image [, options]);
 
md.render(`![](example.png "image title")`);
 
// returns:
//
//<p><img src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" data-src="example.png" alt title="image title" /></p>

Options are not mandatory:

  • placeholder (String or Url) - replace 'src' attributes with give placeholder

License

MIT © h404bi

Website · GitHub @h404bi · Twitter @h404bi

Package Sidebar

Install

npm i markdown-it-lazy-image

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

3 kB

Total Files

4

Last publish

Collaborators

  • h404bi