unified

Project:remarkjs/remark-unwrap-images

Package:remark-unwrap-images@1.0.0

  1. Dependencies:2·Dependents:31
  2. remark plugin to remove the wrapping paragraph for images
  1. remark 170
  2. unified 132
  3. plugin 88
  4. markdown 80
  5. mdast 68
  6. image 11

remark-unwrap-images

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to remove the wrapping paragraph for images.

Install

npm:

npm install remark-unwrap-images

Use

Say we have the following file, example.md. Imagine section titles and URLs a bit longer though.

![hi](there.png)

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

var vfile = require('to-vfile')
var remark = require('remark')
var html = require('remark-html')
var unwrapImages = require('remark-unwrap-images')

remark()
  .use(unwrapImages)
  .use(html)
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

<img src="there.png" alt="hi">

API

remark().use(unwrapImages)

Remove the wrapping paragraph for images. Supports multiple images, white space around images, and images in links as well.

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 © Compositor and Zeit, Inc.