JSPM

markdown-it-img-lazy

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 268
  • Score
    100M100P100Q89974F
  • License MIT

a markdown-it plugin to better supporting image lazy loading

Package Exports

  • markdown-it-img-lazy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (markdown-it-img-lazy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

markdown-it-img-lazy

a markdown-it plugin to better supporting image lazy loading

The plugin will preferentially use native image lazy-loading, if the browser does not support it, it will be implemented through lozad


Installation

yarn add markdown-it-img-lazy
# or
npm i markdown-it-img-lazy

Usage

md.use(require('markdown-it-img-lazy'), /* Options */)

then you need

load Lozad.js in the head tag of your page

load imgLazy.js closer the </body> tag of your page

Options

useLoading

  • Type: Boolben
  • Default: true

Use the native image lazy-loading for the web

if useLoading = true
![img](img.jpg) -> <p><img alt="img" data-src="img.jpg" loading="lazy" class="lazy"></p>

if useLoading = false
![img](img.jpg) -> <p><img alt="img" data-src="img.jpg" class="lazy"></p>

selector

  • Type: string
  • Default: lazy

Default class name for image