ei

embed-images

embed image files in markdown as base64

Showing:

Popularity

Downloads/wk

29

GitHub Stars

24

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

2

Size (min+gzip)

0.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

embed-images

NPM version js-standard-style

embed image files in markdown as base64

Takes a markdown file with images referenced by file and embeds the image content as base64. Useful if you want to render standalone markdown files without serving or hosting individual image files. Currently only handles png files.

install

Add to your project with

npm install embed-images --save

Or install as a command line tool with

npm install embed-images -g

example

If you have a file example.md with

# this is a markdown file with an image

![png](example.png)

And call

embed-images example.md

You'll get

# this is a markdown file with an image

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" />

use as a module

Just provide filenames for input and output and an optional callback.

require('embed-images')(input, output, cb)

If you don't specify an output the result will be logged to stdout.

use as a cli

Just specify an input and pipe to stdout

embed-images input.md > output.md

Or specify an output file

embed-images input.md -o output.md

license

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100