This repo is a fork of highlights-to-markdown on Gitlab. Thanks Juan Pallarès!
Here is the CHANGELOG after forking.
Node app to parse your Kindle (My Clippings.txt) or O'Reilly highlights and create a Markdown file per book grouping the quotes.
The quotes are grouped by Chapter (O'reilly) or Page (Kindle). The books have the date of the most recent quote assigned.
The script will attempt to get metadata from O'reilly Search API, fallback to openlibrary.org if failure.
Sample book generated from O'reilly: The Manager Path
- Install Node if you haven't
- Clone and move to folder
npm i
- Configure the output path
$MARKDOWN_PATH
- Copy
My Clippings.txt
to this repo npm run kindle
- New files are generated at
$MARKDOWN_PATH/highlights/kindle/
- Copy
oreilly-annotations.csv
to this repo npm run oreilly
- New files are generated at
$MARKDOWN_PATH/highlights/oreilly/
Provide an additional visual enhancement by adding the additional formatting from the highlighted area to the Markdown. With the help of Turndown, the HTML from the highlighted section will be converted into Markdown. Additional Turndown rules can be implemented to handle specific formatting of O'Reilly.
- Verify that there is no older copy of the JSON files in the
input
folder or files from a different book. - Copy the downloaded JSON files of a book into the
input
folder (Download instructions provided below). - Run the following command:
npm run oreillyjson
. - Retrieve the newly generated Markdown files from the output folder, for example:
$MARKDOWN_PATH/highlights/oreilly/
- Sign in to O’Reilly Learning and navigate to the Highlights section for the specific book.
- Open the specific book.
- Locate the book ID number (a 10-digit value) by from the URL in Address bar in you Browser
learning.o____.com/highlights/[BOOK ID]/
. - Instead of using the literal “Book ID,” open the link and extract the number obtained in the previous step. The link format is:
https://learning.o___.com/api/v1/annotations/[BOOK ID]/?page_size=100
. - Save the file as a JSON document, naming it something like
bookname_100.json
. - To retrieve additional highlights, follow the link provided after the “Next:” label and save the file with a different number (e.g., 200). Repeat this process until you reach the last batch of highlights until the next is “null”