GithubHelp home page GithubHelp logo

hhy5277 / embed-images Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freeman-lab/embed-images

0.0 1.0 0.0 11 KB

embed image files in markdown as base64

License: MIT License

JavaScript 100.00%

embed-images's Introduction

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

embed-images's People

Contributors

freeman-lab avatar

Watchers

 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.