GitXplorerGitXplorer
e

calibre2color

public
0 stars
0 forks
1 issues

Commits

List of commits on branch main.
Unverified
6b41a2a3994f53b4ebb66dd986826e1dc7e85132

Support calibre_highlights input file extension

eelecnix committed a year ago
Unverified
f4c4222ec500f07b4955987cadbe12109e9c0bfa

Iterate through highlights only once

eelecnix committed a year ago
Unverified
56b74a9b763d3a1ef89f07d8643a4de6e0347514

Only print header if it has changed

eelecnix committed a year ago
Unverified
c2cb60529282ca04b765d8e156692ca6e51d42a0

Add note as a quote if present

eelecnix committed a year ago
Unverified
686d43ccb96a99c8c8e3c6a7542bf9f1091792f8

Rename to calibre2color

eelecnix committed a year ago
Unverified
a61ea1a623963e02c8bcbabea107993e180111c8

Convert from Calibre JSON highlight to Markdown

eelecnix committed a year ago

README

The README file for this repository.

calibre2color

Converts from Calibre JSON highlight to colored Markdown.

Calibre can export to Markdown, but does not preserve coloring. This script uses the JSON export to preserve colors by adding unicode color markers.

This python program converts the input JSON file (passed as argument) to a markdown file, appending .md. Highlights with the same chapter information will appear under the same Markdown header.

Markdown doesn't support color, so we add unicode characters:

🔴 red
🟠 orange
⚫ black
⚪ white
🟣 purple
🟢 green
🟡 yellow
🔵 blue

Simplified calibre JSON export example:

{
    "highlights": [
        {
            "highlighted_text": "In fact, research by Google on their own teams found that who is on the team matters less than the team dynamics; and that when it comes to measuring performance, teams matter more than individuals.",
            "notes": "Look into this",
            "style": {
                "kind": "color",
                "type": "builtin",
                "which": "yellow"
            },
            "toc_family_titles": [
                "PART I TEAMS AS THE MEANS OF DELIVERY",
                "Chapter 3: Team-First Thinking"
            ],
            "type": "highlight"
        }
    ],
    "type": "calibre_highlights",
    "version": 1
}

Sample output:

# Highlights
## PART I TEAMS AS THE MEANS OF DELIVERY
### Chapter 3: Team-First Thinking

🟡 In fact, research by Google on their own teams found that who is on the team matters less than the team dynamics; and that when it comes to measuring performance, teams matter more than individuals.

> Look into this

Multi-line highlights are represented as bullet items:

🟡 For teams to work, team members should put the needs of the team above their own. They should:

- Arrive for stand-ups and meetings on time.
- Keep discussions and investigations on track.
- Encourage a focus on team goals.
- Help unblock other team members before starting on new work.
- Mentor new or less experienced team members.
- Avoid “winning” arguments and, instead, agree to explore options.