Open jhildenbiddle opened 8 years ago
OK, I figured out a command line solution.
You need to install pngpaste first, then when you have an image in the clipboard, run the following command on the terminal to have the data URL string in your clipboard.
pngpaste - | base64 | sed 's/^/<img src="data:image\/png;base64,/' | sed 's/$/" \/>/' | pbcopy
I made a tool to support encoding images as base64 when exporting HTML. hayd1n/typora-img-to-base64
When adding images to documents, it would be great if Typora had the ability to embed images within the markdown file using base64 encoding. This would prevent the need to maintain external images and the proper paths (which becomes tricky when working on multiple devices). I realize this may not be standard practice for markdown files, but it would make files infinitely more portable and prevent the need to deal with external files and paths.
For those instances where a markdown file with embedded base64 images causes issues (like uploading a README to GitHub which strips base64 images), an option to export to separate image files and a clean markdown file which references them could be used.