JSPM

@fabien88/kindlequotes

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q17799F

Parse highlighted passages from Kindle's 'My Clippings' file to JSON

Package Exports

  • @fabien88/kindlequotes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@fabien88/kindlequotes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Kindle Quotes

Transform Kindle 'My Clippings' text file to JSON.

Features

  • Replaces dumbquotes ' ' " " with smartquotes ‘ ’ “ ”
  • Prepends highlights starting mid-sentence with an …ellipsis
  • Trims large sections of spacing (from epub or pdf highlights)
  • Standardises author format as Firstname Lastname
  • Skips bookmarks, duplicates, and empty highlights

Transform this:

==========
The Third Bear (VanderMeer, Jeff)
- Your Highlight at location 1856-1857 | Added on Monday, 1 September 2014 12:58:20

Blake says, "Where?" He's a man who measures words as if he had only a few given to him by Fate; too generous a syllable from his lips, and he might fall over dead.
==========
Songs of the Dying Earth (Dozois, Gardner;Martin, George R.R.)
- Your Highlight at location 11849-11850 | Added on Thursday, 30 April 2015 20:58:20

and eyeing the wizard speculatively across the room. A glance was enough to tell Molloqos that she was a woman of the evening, though in her case evening was edging on toward night.
==========

Into this:

[
  {
    "title": "The Third Bear",
    "authors": ["Jeff VanderMeer"],
    "loc": "1856-1857",
    "date": "2014-09-01T12:58:20.000Z",
    "content": "Blake says, “Where?” He’s a man who measures words as if he had only a few given to him by Fate; too generous a syllable from his lips, and he might fall over dead."
  },
   {
    "title": "Songs of the Dying Earth",
    "authors": ["Gardner Dozois", "George R.R. Martin"],
    "loc": "11849-11850",
    "date": "2015-04-30T20:58:20.000Z",
    "content": "…and eyeing the wizard speculatively across the room. A glance was enough to tell Molloqos that she was a woman of the evening, though in her case evening was edging on toward night."
  }
]

Usage

As Global CLI

$ npm install -g kindlequotes
$ kindlequotes -i 'My Clippings.txt' -o 'my-quotes.json'
Options
-i, --infile [value]   Filename to read kindle highlights [Default: My Clippings.txt]
-o, --outfile [value]  Filename to write JSON [Default: quotes.json]
-d, --dirname [value]  Path to write outfile to [Default: current working directory]
-v, --version          Output the version number
-h, --help             Output this usage information

As Import in a Local Project

$ npm install kindlequotes
const transformQuotes = require('kindlequotes');
const fs = require('fs');
const quotes = transformQuotes(
  fs.readFileSync('./My Clippings.txt', 'utf8')
);