1.0.1 • Published 10 years ago
embed-images v1.0.1
embed-images
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 --saveOr install as a command line tool with
npm install embed-images -gexample
If you have a file example.md with
# this is a markdown file with an image
And call
embed-images example.mdYou'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.mdOr specify an output file
embed-images input.md -o output.md