Skip to content

ratoru/kindle-md-highlights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert Kindle highlights to Markdown notes

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.

Usage

  1. Connect your Kindle to your computer and download the documents/My Clippings.txt file.

  2. Create a local copy of highlights_parser.py in the same folder as My Clippings.txt.

  3. Run python highlights_parser.py.

Note: Python 3.10 or higher is required.

Options

Run python highlights_parser.py -h for help.

Formatting

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)

Add date

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)

Add page

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)

Custom save path

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.

Overwrite existing files

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.

Example

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

Design Decisions

  • 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 to pip install anything to run this script.

Credit

This script is an evolution of highlight_parser.py.

About

Convert Kindle highlights to Markdown files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages