Simple script to convert highlights from your Kindle to Markdown files. A free and simpler alternative to Clippings and Readwise.
For each book highlights_parser.py
will create a separate <author_title of book>.md
file with its highlights. These files will be stored in a directory (defaults to ./books/
). The target directory will be created if it does not exist.
-
Connect your Kindle to your computer and download the
documents/My Clippings.txt
file. -
Create a local copy of
highlights_parser.py
in the same folder asMy Clippings.txt
. -
Run
python highlights_parser.py
.
Note: Python 3.10 or higher is required.
Run python highlights_parser.py -h
for help.
Use -f
or --format
to change the formatting of individual highlights. Currently supported are the following formats.
Format | Example |
---|---|
bullet |
- Writers can profit by reading more than one style guide, and much of Strunk and White (as it is commonly called) is as timeless as it is charming. But much of it is not. (Added on Friday, March 22, 2024 - Page 8) |
quote |
> Writers can profit by reading more than one style guide, and much of Strunk and White (as it is commonly called) is as timeless as it is charming. But much of it is not. (Added on Friday, March 22, 2024 - Page 8) |
paragraph |
Writers can profit by reading more than one style guide, and much of Strunk and White (as it is commonly called) is as timeless as it is charming. But much of it is not. (Added on Friday, March 22, 2024 - Page 8) |
Use -d
or --date
to add the date the highlight was created to the output of each highlight.
Example: Writers can profit by reading more than one style guide, and much of Strunk and White (as it is commonly called) is as timeless as it is charming. But much of it is not. (Added on Friday, March 22, 2024)
Use -p
or --page
to add the page of the highlight to the output of each highlight.
Example: Writers can profit by reading more than one style guide, and much of Strunk and White (as it is commonly called) is as timeless as it is charming. But much of it is not. (Page 8)
If you do not like books/
as the directory for your Markdown notes, you can pass in a custom path using the --save_path
flag. The directory will get created if it does not exist.
By default the script will skip files that already exists.
[!NOTE] If you added new highlights to an existing file, they will not be added by default.
You can overwrite all existing files using the -o
or --overwrite
flag. There is currently no way to add new highlights to an existing file without overwriting other files, too.
An example can be found in the example
folder. The output was generated by running the following from the example
folder.
python3 highlights_parser.py -d -p -f quote
-
Overwriting files is turned off by default since I wanted to optimize the script for heavy readers with slow computers.
-
The target directory is created if it does not exist because it makes the script faster to use.
-
I only have a fixed number of formatting options to keep the script simple. Feel free to add your own formats in the
Formatting
class. -
I used
argparse
to create the CLI so that you do not have topip install
anything to run this script.
This script is an evolution of highlight_parser.py.