Code Monkey home page Code Monkey logo

remark-unwrap-images's Introduction

remark-unwrap-images

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to remove the wrapping paragraph for images.

Note!

This plugin is ready for the new parser in remark (remarkjs/remark#536). No change is needed: it works exactly the same now as it did before!

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.

Security

Use of remark-unwrap-images does not involve rehype (hast) or user content, it only removes some existing nodes, so there are no openings for cross-site scripting (XSS) attacks.

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, organization, or community you agree to abide by its terms.

License

MIT © Compositor and Vercel, Inc.

remark-unwrap-images's People

Contributors

wooorm avatar johno avatar salahaddin avatar jxnblk avatar michelebertoli avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.