kindle-highlight-to-markdown
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

kindle-highlight-to-markdown

Convert Your Kindle highlight & Note to Markdown/JSON

Install

Install with npm:

npm install kindle-highlight-to-markdown

Usage

Using Console script

const { parsePage, toMarkdown } = await import('https://cdn.skypack.dev/kindle-highlight-to-markdown');
const result = parsePage(window); // JSON Object
const markdown = toMarkdown(result); // Markdown
copy(markdown);

Using Bookmarklet

javascript:(function()%7B(async%20function()%7B%0Aconst%20%7B%20parsePage%2C%20toMarkdown%20%7D%20%3D%20await%20import('https%3A%2F%2Fcdn.skypack.dev%2Fkindle-highlight-to-markdown')%3B%0Aconst%20result%20%3D%20parsePage(window)%3B%20%2F%2F%20JSON%20Object%0Aconst%20markdown%20%3D%20toMarkdown(result)%3B%20%2F%2F%20Markdown%0Aawait%20navigator.clipboard.writeText(markdown)%3B%0A%7D)()%3B%7D)()%3B

Using Greasemonkey script

// ==UserScript==
// @name        Kindle Hightlight to Markdown- amazon.co.jp
// @namespace   My highlight to markdown
// @match       https://read.amazon.co.jp/notebook
// @grant       GM_setClipboard
// @version     1.0
// @author      azu
// ==/UserScript==


const h1 = document.querySelector("h1.kp-notebook-title");
h1.addEventListener("click", async () => {
  const { parsePage, toMarkdown } = await import('https://cdn.skypack.dev/kindle-highlight-to-markdown');
  const result = parsePage(window);
  console.log(result);
  const markdown = toMarkdown(result);
  console.log(markdown);
  GM_setClipboard(markdown);
});

Changelog

See Releases page.

Running tests

Add Cookie to .cookie file

and Edit test/node.ts and Run tests

npm run debug

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

Readme

Keywords

none

Package Sidebar

Install

npm i kindle-highlight-to-markdown

Weekly Downloads

4

Version

1.3.1

License

MIT

Unpacked Size

26.6 kB

Total Files

24

Last publish

Collaborators

  • azu