get-md-image

get image from markdown article

Usage no npm install needed!

<script type="module">
  import getMdImage from 'https://cdn.skypack.dev/get-md-image';
</script>

README

get-md-image

NPM version Build Status Coveralls Status Dependency Status

get image from markdown article

Install

npm install --save get-md-image

Usage

import getImage from 'get-md-image';

const input = `
# title

description ![meow](http://placekitten.com/g/300)`;

getImage(input).alt;  // meow
getImage(input).src;  // http://placekitten.com/g/300
getImage(input).html; // <img src="http://placekitten.com/g/300" alt="meow" />
getImage('');         // undefined ¯\_(ツ)_/¯

API

getImage(input)

input

Required
Type: String

Markdown string.

Related

License

MIT © Vladimir Starkov