Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

remark-images

1.0.0 • Public • Published

remark-images

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to add an improved image syntax.

Install

npm:

npm install remark-images

Use

Say we have the following file, example.md:

#### A url
 
Below will render an image:
 
https://c8r-x0.s3.amazonaws.com/lab-components-macbook.jpg

And our script, example.js, looks as follows:

const vfile = require('to-vfile')
const remark = require('remark')
const images = require('remark-images')
 
remark()
  .use(images)
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

#### A url
 
Below will render an image:
 
[![](https://c8r-x0.s3.amazonaws.com/lab-components-macbook.jpg)](https://c8r-x0.s3.amazonaws.com/lab-components-macbook.jpg)

API

remark().use(images)

Add an improved image syntax. Transform URLs in text that reference images (png, svg, jpg, jpeg, or gif) to images.

Supported URLs / URIs:

  • https://example.com/image.jpg
  • /image.jpg
  • ./image.jpg
  • ../image.jpg

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © John Otander

Install

npm i remark-images

DownloadsWeekly Downloads

3,514

Version

1.0.0

License

MIT

Unpacked Size

7.31 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar