note2md - Calibre Book Notes to Markdown
During the last weeks, I created note2md, an app designed to convert text copied from books in Calibre into a clean, organized Markdown format.
Itâs available online at note2md.chavinvan.com.
Every time I read a book on my Kobo I try to transfer the notes to Notion. However, I noticed that copying notes or highlights from Calibre often
left me with poorly formatted text and highlights scattered across the text. The copied text had the following format:
The Art of Focus: Mastering Mental Clarity by RocĂo Brunelli
Book last read: 2024-10-15 14:22:10
Percentage read: 85%
Chapter 1: The Origins of Distraction
Bookmark
Chapter Progress: 12.5%
Chapter 2: Breaking the Cycle
Highlight
Chapter Progress: 27.5%
Highlight: The constant battle for your attention is not just external. It's an internal struggle between short-term impulses and long-term goals.
Chapter 2: Breaking the Cycle
Highlight
Chapter Progress: 32.5%
Highlight: Achieving focus requires intentional decision-making. Every time you say 'yes' to a task, you're saying 'no' to countless others.
Formatting the notes manually was such an effort that I usually ended up abandoning it and never passing the notes.
I needed an easy, efficient way to clean up these notes for my own records and projects.
To this aim, I first created a Python script using regular expressions to that converted the previous format to markdown and grouped the notes by chapter:
### Chapter 1: The Origins of Distraction
### Chapter 2: Breaking the Cycle
- The constant battle for your attention is not just external. It's an internal struggle between short-term impulses and long-term goals.
- Achieving focus requires intentional decision-making. Every time you say 'yes' to a task, you're saying 'no' to countless others.
The script is quite easy, it uses regular expressions to find the patterns I want to extract from the text:
text = '...'
chapter_pattern = r"Chapter \d+: .+"
highlight_pattern = r"Highlight: (.+)"
markdown_output = ""
lines = text.splitlines()
current_chapter = None
for line in lines:
if re.match(chapter_pattern, line):
if current_chapter != f"### {line}\n":
current_chapter = f"### {line}\n"
markdown_output += current_chapter
elif match := re.match(highlight_pattern, line):
highlight = match.group(1)
markdown_output += f"- {highlight}\n"
Then I thought it might be a good idea to make a graphical interface and even publish it, in case someone could find it useful.
I developed a first version in Flutter, for which I used very_good_cli and flutter_bloc.
However, I saw that Flutter websites are not a good option for SEO optimisation [1],
so I decided to explore alternatives and one of the ones I saw was Astro.
I love Flutter and I'm not a big fan of Javascript, but with Astro's documentation (and ChatGPT's help) I was able to move everything I had in
Flutter to Astro very easily. So now, it's done.
note2md helps you process notes copied from Calibre by automatically identifying chapters, highlights, and other common patterns, then formatting everything in Markdown.
This way, it becomes easy to integrate notes into any Markdown-based tool or document.
I also designed the app to work entirely online, meaning thereâs no need to download or install anything. Also, the app works entirely
on the client side, so none of your data is sent to a serverâyour notes are processed securely and privately within your own browser.
This ensures that your information remains confidential.
If youâre a book lover or someone who works with notes often, I hope note2md saves you time and keeps your notes cleaner and more organized! As always, any feedback is welcome at chavinvan@gmail.com