Obsidian.md plugin to sync highlights/notes from koreader

Overview

Obsidian KOReader Plugin

Sync KOReader notes in your Obsidian vault. The KOReader device must be connected to the device running obsidian to let the plugin scan through it's files.

In the beginning of each note there a series of YAML data knwon as Frontmatter. Those data are mainly used by the plugin itself (you can use them as shown in dataview examples) but messing with them will cause unexpected behaviour so use the provided commands to properly interact with them.

When you're comfy reading your notes in obsidian think about how useful is this plugin to you and express your gratitude with a tweet or with a coffee

Twitter URL Buy Me A Coffee

Configuration

There ara four main settings:

  • KOReader mounted path that MUST be set correctly to the path where KOReader is mounted
  • Highlights folder location that can be let as the default / (or you can create a folder and select it from the dropdown)
  • Keep in sync that define if the plugin should keep the notes in sync with KOReader importing them again (see sync)
  • Create a folder for each book if you are a fan of folders enabling this setting the new notes will be created in a subfolder named as the book itself

Danger Zone

This area contains settings that can be useful in a very few edga cases and can be dangerous in a day to day usage.

  • Enable reset of imported notes enable a one shot execution of the command Reset Sync List

View configuration

The plugin use Eta.js as template engine to create the body of the note (the same used from the plugin Templater). The default template is pretty minimal

## Title: [[<%= it.bookPath %>|<%= it.title %>]]

### by: [[<%= it.authors %>]]

### Chapter: <%= it.chapter %>

Page: <%= it.page %>

**==<%= it.highlight %>==**

<%= it.text %>

In the View settings section you can found the the option to use a custom template. If you chose to do so you must create a .md file in the vault and write your template in it (I suggest to copy the default in it as a starting point) and write the path in Template file

The template receive the following arguments:

  • bookPath: koreader/(book) How to Take Smart Notes_... {book suffix}-Sönke Ahrens
  • title: How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking - for Students, Academics and Nonfiction Book Writers
  • authors: Sönke Ahrens
  • chapter: 1.1 Good Solutions are Simple – and Unexpected
  • highlight: Clance and Imes 1978; Brems et al. 1994
  • text: Clance (1978) first identified the Impostor Phenomenon in therapeutic sessions with highly successful women who attributed achievements to external factors
  • datetime: 2022-01-22 09:57:29
  • page: 19

Book view configuration

The default template is minimal but complex

<%= it.metadata.percent_finished %>" max="100"> ```dataviewjs const title = dv.current()['koreader-sync'].metadata.managed_title dv.pages().where(n => { return n['koreader-sync'] && n['koreader-sync'].type == 'koreader-sync-note' && n['koreader-sync'].metadata.managed_book_title == title }).sort(p => p['koreader-sync'].data.page).forEach(p => dv.paragraph(dv.fileLink(p.file.name, true), {style: 'test-css'})) ```">
# Title: <%= it.data.title %>

 
```dataviewjs
const title = dv.current()['koreader-sync'].metadata.managed_title
dv.pages().where(n => {
return n['koreader-sync'] && n['koreader-sync'].type == 'koreader-sync-note' && n['koreader-sync'].metadata.managed_book_title == title
}).sort(p => p['koreader-sync'].data.page).forEach(p => dv.paragraph(dv.fileLink(p.file.name, true), {style: 'test-css'}))
```

The core of this template is a js dataview embedded query. Don't mess with it if you don't know what you are doing (I don't because I barely know Dataview).

The template receive exactly the same data you can see in the frontmatter. If it's not there you can't use it but you can create an issue asking for it.

Dataview embedded

Besides a native support for Dataview (look at the example) the plugin let the user chose to automatically create a note for each book with a dataview query inside. The note is created in the same folder of the notes of the book but can be moved and renamed and Obsidian will take care of updating the links. To use this feature Dataview needs to be installed and its Enable JavaScript Queries must be enabled. The query itself will embed the single notes and a CSS will hide every h2 and h3 tags (with the default template this will hide the title, the author and the chapter).

ATTENTION: this feature require at least Obsidian v0.13.19 but there is a glitch that sometimes show only the filename of the notes instead of their contents. Try to close the note and open it again (sorry, not my fault)

Usage

Once the plugin is configured properly you can plug the device with KOReader and click on the icon with two documents and the tooltip Sync your KOReader highlights. The plugin should propmplty create a single file for each note. The plugin should take care of automatically detect when you update the text of the note itself and update the frontmatter properties accordingly.

Commands

NOTE: if a command is suppose to set a frontmatter property equal to a certain value then it will be shown only if the open note has such property with a different value.

There are five commands:

  • Sync it's the same as clicking on the plugin's icon, it's trigger the sync of the notes
  • Reset Sync List empty the list of imported notes (see Danger Zone). Always try to retrieve the deleted notes from trash before using this command because all the rightfully discarded notes will be imported again. This command will also disable itself so you have to enable in the settings again if you wish to use it again.
  • Mark this note as Edited set the frontmatter propery yet_to_be_edited to false (see Note editing)
  • Mark this note as NOT Edited set the frontmatter propery yet_to_be_edited to true (see Note editing)
  • Enable Sync for this note set the frontmatter propery keep_in_sync to true (see sync)
  • Disable Sync for this note set the frontmatter propery keep_in_sync to false (see sync)

Note editing

When you edit a note you should avoit to change the frontmatter at all. Since version 0.6.0 the plugin itself should be able detect any changes to the note and to update:

  • the yet_to_be_edited value from true to false so the plugin know that you altered something and to avoid any loss in case of sync
  • the text value to mirror your edit

If you want to discard your manual edits you can use the command Mark this note as NOT Edited and overwrite it at the next sync. If you change something beside the text itself (eg. the chapter, the title of the book, etc) you must use the Mark this note as Edited to made the plugin aware of your changes (this should not be necessary in future releases)

It's easier/safer to use the proper commands instead of manually editing the frontmatter

Sync

WARNING Sync works by deleting a note and creating it again from KOReader. Anything added or updated (in Obsidian) will be lost like tears in rain. Consider yourself warned.

The syncing process rely on two property defined in the frontmatter metadata:

  • keep_in_sync
  • yet_to_be_edited

Both needs to be true for the note to be synced.

keep_in_sync can be controlled at global level through the setting Keep in sync or in each note while yet_to_be_edited is set to true when the note is imported from KOReader and can only be manually changed in the note itself.

The default value for keep_in_sync is false so the default behaviour is that once a note is in obsidian it will never be synced again.

If you modify your notes in KOReader and want them to be synced in obsidian you have to enable the Keep in sync setting OR use the proper commands to change the keep_in_sync frontmatter of a specific note from false to true and if the yet_to_be_edited of that note is true then the note will be deleted and recreated.

Dataview examples

Thanks to the frontmatter data in each note you can use Dataview to easily query your notes

Books

```dataview
list
where koreader-sync
group by koreader-sync.data.title
```

Chapters of a specific book (with notes in them)

```dataview
list
where koreader-sync.data.title = "How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking - for Students, Academics and Nonfiction Book Writers"
group by koreader-sync.data.chapter
```

Notes of a specific chapter of a specific book

```dataview
list
where koreader-sync.data.title = "How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking - for Students, Academics and Nonfiction Book Writers" and koreader-sync.data.chapter = "Introduction"
```

Text of notes of a specific book (without a link to the note and only where text is present)

```dataview
list without id koreader-sync.data.text
where koreader-sync.data.title = "How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking - for Students, Academics and Nonfiction Book Writers"
where koreader-sync.data.text
```

List of notes yet to be edited

```dataview
list 
where koreader-sync.metadata.yet_to_be_edited
```

List of notes that should be kept in sync

```dataview
list 
where koreader-sync.metadata.keep_in_sync
```

List of notes that will be kept in sync

```dataview
list 
where koreader-sync.metadata.keep_in_sync and koreader-sync.metadata.yet_to_be_edited
```
Comments
  • Generates a book folder, but no notes.

    Generates a book folder, but no notes.

    .. somehow the plugin is not importing notes any more. It does see my Kobo, because it generates a folder for each book, but it doesn't make any notes inside the folder. I tried reinstalling the plugin and use the default template, but to no avail.

    Originally posted by @heiders in https://github.com/Edo78/obsidian-koreader-sync/issues/23#issuecomment-1022898328

    bug 
    opened by heiders 8
  • Book Progress

    Book Progress

    Hi Edo, maybe it would be interesting to extract the progress of the book and put it in the general note of the book (the one with the dataview query). This with the latest minimal options would be very good to have a database of books.

    https://github.com/kepano/obsidian-minimal/releases/tag/4.4.5

    image

    enhancement 
    opened by javiavid 7
  • Separate date and time from datetime

    Separate date and time from datetime

    I'm an avid user of daily notes in Obsidian, which all have the title as [[yyyy-mm-dd]]. If the date in the KOReader notes is listed separately from the time in the frontmatter, I could use dataview to create an automatic "Books I read today" table in my daily note with:

    table without id koreader-sync.data.title AS Title
    where koreader-sync.data.datetime = date(today)
    

    Also, I would be able to use the custom template to include a link to my daily note.

    opened by heiders 7
  • Add options to put all highlights into one note/book

    Add options to put all highlights into one note/book

    Thank you for your wonderful plugin!!! I think it would be nice if the plugin have an option to sync all the book highlight into a single note (each book become one note). So it wont create too many notes in my vault, and I can synthesize the note easier. May I ask if this is possible?

    opened by trungng2006 5
  • Custom Template

    Custom Template

    It would be great to be able to create a template for the notes, something similar to what the Hypothesis plugin does. In this way you could do the plugin compatible with DataView.

    enhancement 
    opened by javiavid 4
  • Create command(s)

    Create command(s)

    Refactor the code to, at least have the sync function be an obsidian command.

    It may be useful to have command to:

    • toggle yet_to_be_edited
    • toggle keep_in_sync
    • try to sync an open note
    enhancement 
    opened by Edo78 1
  • Create dataview queries

    Create dataview queries

    Instead of #9 a faster and easier solution is to add a setting for the creation of a note with a dataview query in it to show, as embedded, al the notes of a specific book.

    enhancement 
    opened by Edo78 1
  • Capture page number

    Capture page number

    I would like to see the page number associated with the note/highlight for easy reference If I want to return to the original text.

    I guess KOReader does somehow capture it since this standalone utility seems to be able to capture the page number: https://www.mobileread.com/forums/showthread.php?t=265433

    enhancement 
    opened by heiders 1
  • Add more data to frontmatter

    Add more data to frontmatter

    Adding more data to frontmatter:

    • title
    • chapter
    • author

    Adding even some metadata can be really useful:

    • newly_imported (can be used to show the recently imported notes that should be managed)
    • body_hash (to check if the note is still the same and can be updated, if updated on koreader, or if it was manually update)

    Made the notes more useful because those data can be used by other plugin that can harness them (eg. dataview can be used to create list of notes of a chapter of a book or a list of all the notes about the books of a specific author)

    enhancement 
    opened by Edo78 1
  • KoReader Mounted Path - Cannot find the correct path when using the Koreader in the external e-reader

    KoReader Mounted Path - Cannot find the correct path when using the Koreader in the external e-reader

    Hi Edo78,

    I really really love your idea since you can provide the users the way to sync up their Koreader's note with Obsidian,

    But I got a problem with KOReader Mounted Path, since I cannot set it correctly,

    I have Koreader installed in my e-reader, and I plug it into the Ubuntu machine,

    And I open it in Nautilus, and get the path when I open the Terminal :

    pwd
    
    /run/user/1000/gvfs/mtp:host=Boyue_Likebook-T80D_CNBT80D20200700042/Internal shared storage/koreader
    

    I tried many alternative ways but it stills not working:

    /mtp:host=Boyue_Likebook-T80D_CNBT80D20200700042/Internal shared storage/koreader
    "/run/user/1000/gvfs/mtp:host=Boyue_Likebook-T80D_CNBT80D20200700042/Internal shared storage/koreader"
    '/run/user/1000/gvfs/mtp:host=Boyue_Likebook-T80D_CNBT80D20200700042/Internal shared storage/koreader'
    
    mtp://Boyue_Likebook-T80D_CNBT80D20200700042/Internal shared storage/koreader
    
    

    Could you guys help me,

    Thanks,

    opened by thinh105 0
  • chore(deps): bump ansi-regex from 4.1.0 to 4.1.1

    chore(deps): bump ansi-regex from 4.1.0 to 4.1.1

    Bumps ansi-regex from 4.1.0 to 4.1.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • change uniqueId

    change uniqueId

    To fix the problem of notes from pdf not being created.

    Example in pdf.lua file from Koreader :

    ["bookmarks"] = { [1] = { ["page"] = 286, ["chapter"] = "12. Routines: Workout Programs", ["datetime"] = "2022-12-07 22:17:38", ["notes"] = "True brawn and power are developed by hard training sessions, not by long training sessions. Quality over quantity is an excellent motto for strength.", ["pos0"] = { ["page"] = 286, ["x"] = 113.53055169962, ["rotation"] = 0, ["y"] = 94.348024444745, ["zoom"] = 2.4036458333333, }, ["pos1"] = { ["page"] = 286, ["x"] = 355.4808284805, ["rotation"] = 0, ["y"] = 104.26570541035, ["zoom"] = 2.4036458333333, },

    pos0 and pos1 not always a string, using datetime instead for uniqueId.

    opened by cedryck1 0
  • chore(deps): bump minimatch from 3.0.4 to 3.1.2

    chore(deps): bump minimatch from 3.0.4 to 3.1.2

    Bumps minimatch from 3.0.4 to 3.1.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Only getting highlights from books in the root folder of the KOreader device

    Only getting highlights from books in the root folder of the KOreader device

    I use calibre to add books to my KOreader device, which by default makes a separate folder for each author on the device. Therefore almost all my books are in sub-folders corresponding to authors. When I use the KOreader sync plugin, I only get the highlights from the handful of books in the root folder of the device.

    Is there a way around this or could you add a recursive folder sync option?

    opened by s-cassidy 2
  • Bug while trying to use the plugin

    Bug while trying to use the plugin

    Just trying to use the plugin (0.6.1) in win10, with koReader (last version) on D:\ and the Obsidian storage on H:\ .

    plugin:obsidian-koreader-plugin:12787 Uncaught (in promise) TypeError: Cannot read property '0' of null at KOReader.eval (plugin:obsidian-koreader-plugin:12787) at Generator.next () at eval (plugin:obsidian-koreader-plugin:63) at new Promise () at __async (plugin:obsidian-koreader-plugin:47) at KOReader.createNote (plugin:obsidian-koreader-plugin:12785) at KOReader.eval (plugin:obsidian-koreader-plugin:12925) at Generator.next () at fulfilled (plugin:obsidian-koreader-plugin:50)

    -> Apparently caused by const page = bookmark.text ? parseInt(bookmark.text.match(/\d+/g)[0]) : -1; -> text.match() is null, so [0] is incorrect.

    I don't know if this is due to unaccepted characters in the Book title or other bugs ?

    Uncaught (in promise) Error: ENOENT: no such file or directory, mkdir 'H:\Nextcloud\ ...-Christian Arnsperger Dominique Bourg'

    Uncaught (in promise) Error: ENOENT: no such file or directory, open 'H:\Nextcloud\DOCUMENTS\NOTES\OBSIDIAN\04-Other\KoReader_HIghlights(book) Ecologie intégrale_ Pour ...-Christian Arnsperger Dominique Bourg\on constate que la méthod... - Christian Arnsperger Dominique Bourg.md'

    Uncaught (in promise) Error: ENOENT: no such file or directory, open 'H:\Nextcloud\DOCUMENTS\NOTES\OBSIDIAN\04-Other\KoReader_HIghlights(book) Ecologie intégrale_ Pour ...-Christian Arnsperger Dominique Bourg\favoriserait une intensif... - Christian Arnsperger Dominique Bourg.md'

    opened by clemrdh 5
  • Add

    Add "Previous" and "Next" links to each note

    I would love to see a feature that would add two links to each note/highlight which would link to the previous and next notes taken based on page numbers. Would that be possible in any way?

    Somewhat as such:

    image

    opened by heiders 0
Releases(0.6.1)
Owner
Federico Granata
Federico Granata
Easily open daily notes and periodic notes in new pane; customize periodic notes background; quick append new line to daily notes.

Obsidian daily notes opener This plugin adds a command for opening daily notes in a new pane (so that a keyboard shortcut could be used!) and gives ex

Xiao Meng 16 Dec 26, 2022
Obsidian plugin to sync Pinboard.in links to Daily Notes

Obsidian Pinboard Sync An Obsidian plugin that adds links you've saved with Pinboard to your Obsidian Daily Notes, synchronizing periodically. Why? I'

Mathew Spolin 35 Dec 1, 2022
An Obsidian.md plugin that syncs highlights from Raindrop.

Obsidian Raindrop Highlights Plugin (Community Plugin) Obsidian Raindrop Highlights (Community Plugin) is an unofficial plugin to synchronize Raindrop

You-Kai Zheng 81 Jan 4, 2023
An Obsidian plugin for automatically creating notes when linking to non-existing notes

Note Auto Creator for Obsidian Automatically create notes when links are created to them. How to use After enabling the plugin in the settings menu, y

Simon Clement 31 Dec 14, 2022
A Zotero add-on that scans your Markdown reading notes, tags the associated Zotero items, and lets you open notes for the Zotero items in Obsidian.

Zotero Obsidian Citations Adds colored tags to Zotero items that have associated Markdown notes stored in an external folder. Open an associated Markd

Dae 210 Jan 4, 2023
A service for sharing encrypted Markdown notes from Obsidian. Notes are end-to-end-encrypted and are only stored temporarily.

?? Noteshare.space Noteshare.space is a service for sharing encrypted Markdown notes from Obsidian. Notes are end-to-end-encrypted and are only stored

Maxime Cannoodt 56 Dec 26, 2022
A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

Copy Search URL This plugin adds a button to Obsidian's search view. Clicking it will copy the Obsidian URL for the current search to the clipboard. T

Carlo Zottmann 6 Dec 26, 2022
Obsidian Web: Connect your browser with your Obsidian notes

Obsidian Web: Connect your browser with your Obsidian notes This is an unofficial Chrome extension for Obsidian that lets you send content from the we

Adam Coddington 97 Jan 3, 2023
Easily publish notes to the web This plugin integrates with obsius.site to publish markdown notes on the web.

Obsius Publish Easily publish notes to the web This plugin integrates with obsius.site to publish markdown notes on the web. Limitations The type of c

Jon Grythe Stødle 66 Dec 20, 2022
A solution for highlights extraction for sports games by The Unknowns.

Sportlight by The Unknowns Next.js, Express.js, NLTK, symbl.ai Inspiration - Problem Statement #3 by Experion Technologies Publishing highlights after

Arjun Sivaraman 5 Apr 19, 2022
A quick capture plugin for Obsidian, all data from your daily notes.

Obsidian Memos 中文文档 A new way for you to quick capture an idea in Obsidian. Which is highly based on the awesome open source project: memos and awesom

Boninall 551 Jan 3, 2023
Obsidian.md plugin to integrate with Zotero, create literature notes and insert citations from a Zotero library.

Obsidian Zotero Plugin Obsidian.md plugin to integrate with Zotero, create literature notes and insert citations from a Zotero library. Intro How to u

null 156 Jan 6, 2023
Plugin for Obsidian.md to send markdown notes to Buttondown.email

Obsidian Buttondown Plugin Buttondown is a tool for producing email newsletters. It likes emails written in Markdown, and has an API. This plugin allo

Caro 4 Nov 15, 2022
Obsidian plugin to export Graphviz graphs from vault's notes

What it is: an Obsidian plugin to generate hierarchical graphs, with the nodes are from your Obsidian vault How it does: convert the database from Bre

Ooker 22 Nov 14, 2022
This plugin allows you to track the progress of Atlassian Jira issues from your Obsidian notes.

Obsidian jira-issue This plugin allows you to track the progress of Atlassian Jira issues from your Obsidian notes. Usage Configuration Use the plugin

Marco Lucarella 74 Dec 30, 2022
This is an Obsidian plugin for taking math notes using Excalidraw.

Obsidian Math+ Obsidian Math+ is a plugin for taking math notes quickly and efficiently. Usage Run the Insert math block command, either using the com

Oscar Capraro 29 Dec 30, 2022
An Obsidian plugin to upload your notes' metadata to your database.

Obsidian + PostgreSQL = ❤️ An Obsidian plugin to upload your notes' metadata to your database. Features send the Dataview annotations of a page to a P

Camille Louédoc-Eyriès 33 Dec 19, 2022
A plugin for Obsidian that can create input fields inside your notes and bind them to metadata fields.

Obsidian Meta Bind Plugin This plugin can create input fields inside your notes and bind them to metadata fields. New docs I am currently working on n

Moritz Jung 57 Jan 4, 2023
PodNotes is a plugin for Obsidian that helps the user write notes on podcasts.

PodNotes You can find the documentation here. The one goal for PodNotes is to make it easier to write notes on podcasts. Here are the features that wi

Christian Bager Bach Houmann 108 Dec 26, 2022