1.1.0-0 • Published 6 years ago

remark-embed-images-continued v1.1.0-0

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

remark-embed-images-continued

Embed images with data: URIs, inlining base64-encoded sources. Based on remark-embed-images, which I felt was too restrictive in that all images needed to have a path that began in either ./ or ../ to work. Absolute paths failed, web URL:s failed, etc.

Usage

Input:

![A PNG](./foo.png)

Process:

const embedImage = require('remark-embed-images-continued');
const vfile = require('to-vfile')
const MARKDOWN = vfile.readSync('myfile.md');

remark()
  .use(embedImages)
  .process(MARKDOWN, function (err, file) {
    vfile.writeSync({path: 'myfile_inlined.md', contents: String(file)});
  });

Output:

![A PNG](data:image/png;base64,0000...)