The Kindle app on your phone can export your annotations on a particular book to an HTML file.

However, I find that file quite noisy, and would rather have my annotations in a simpler format: markdown. Also, I would like to remove unnecessary information and make it less verbose.

For the first books, I did this conversion in a couple of minutes using macros in VIM. But as I needed to do it more and more often, the procedure quickly became tedious, and I wanted to automate it.

So I wrote a Python script to the job. The code is here.

By the way, if you are interested in exporting all your annotations from your Kindle directly to markdown, from your clippings file, take a look at my project Fyodor.