Recently I have had the urge to leave closed platforms behind -- again. I had a premium Evernote account for about a year, but to be honest I still don't use it much. At the beginning I was very excited because of all the things to check out. After a while though, I rarely put new notes into Evernote -- mainly because I didn't want it to grow too much, because I believe that knowledge one doesn't know exists, doesn't exist. So the more knowledge you put into Evernote, the harder it is to remember what knowledge you have, and what you don't. If you can't remember a thing, then it doesn't exist.
Anyway, I could write about that topic, or I could show you what's a cool way to leave things behind, and also a cool way to package up Markdown files along with their referenced images.
The basic idea is this. Let's imagine you want to take notes of something. You start to type, but then you draw something, then you type again, then you get the URL of an image and also put it in the Markdown file. Now you've got all these things all over the place. Wouldn't it be nice to have a single "thing" that contains everything?
Of course it would!
I remembered TextBundle but then quickly also realized that the format has fallen way behind what it promised -- practically no app that I use supports TextBundles. I think this was mainly due to the fact that it creates an opaque "bundle", which users can only access through right-click options.
The basic idea is good though. It's that we create a folder that contains all the "assets" referenced in a main document -- pretty much the same way an HTML file references files.
So to make a long story short. I thought it would be a really neat idea to create a somewhat TextBundle-ish folder that contains the main document, in Markdown format, along with referenced assets, especially images.
The script I whipped up does this:
- It processes a Markdown file you give it through the command line.
- It creates a new folder, and copies the Markdown file to it. It also creates an
assets
folder. - When it finds an
![inline image]()
or a![reference link image][]
it tries to copy it to anassets
folder, if the file is a local. If the file is an image somewhere on the Internet, it downloads it, and updates the image URL to point to the relative location in `assets. This way the "TextBundle" truly is transportable.
My idea was to use this is to export all Evernote notes to HTML files. When you do this, Evernote exports all images with it. We can convert all HTML files (relatively easily) to Markdown files using Pandoc. Afterwards TextBundle Packagizer would go ahead and convert everything to TextBundles.
Please note that these TextBundles are NOT true TextBundles! A true TextBundle would create a folder with the .textbundle
extension. The folder contains a main document file and it also contains a JSON file with some metadata information. I thought that's disadvantageous because I'm personally not a huge fan of all the JSON'ry. Secondly JSON is something I can use. Normal people, which I hope will be able to use this, do not grok JSON. Third is that I really don't like that the TextBundle folder is not a true folder. Users need to right click the file and choose "Show Package Contents" to access their stuff. Changing or exchanging assets is more hassle this way. And fourth I kind of like the idea that Markdown is HTML-ish, in the sense that a main document can reference other documents. This way you can reference other documents, which contain parts of your story, and a main document with all the setup around it. I did this for my thesis, and it worked well. Because of these reasons I have decided to leave the .textbundle
extension out. Feel free to change the script to create TextBundle folder, if that's your thing.
I did test this a lot, but did not mass-test it with my entire Evernote archive. If something doesn't work quite right, feel free to send me an improvement to the Gist below.
Download TextBundle Packagizer.sh
Here's a short script to export all notes in a specific notebook from Evernote as HTML:
tell application "Evernote"
set allmynotes to find notes "notebook:Snapchat"
set outputpath to "/Users/zettt/Desktop/Test"
export allmynotes to outputpath format HTML
end tell