diff --git a/README.md b/README.md index 863960e..bca5d44 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ by: [[<%= it.authors %>]] ## Chapter: <%= it.chapter %> +Page: <%= it.page %> + **==<%= it.highlight %>==** <%= it.text %> diff --git a/manifest.json b/manifest.json index 091b333..f4423c0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-koreader-plugin", "name": "KOReader Highlights", - "version": "0.2.0", + "version": "0.2.1", "minAppVersion": "0.12.0", "description": "This is a plugin for Obsidian. This plugin syncs highlights and notes taken in KOReader.", "author": "Federico \"Edo\" Granata", diff --git a/package-lock.json b/package-lock.json index 1b3c17c..5d44e71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-koreader-plugin", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "obsidian-koreader-plugin", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "dependencies": { "eta": "^1.12.3", diff --git a/package.json b/package.json index 839acf3..562fd92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-koreader-plugin", - "version": "0.2.0", + "version": "0.2.1", "description": "This is a plugin for Obsidian. This plugin syncs highlights and notes taken in KOReader.", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 8c2bf60..924df50 100644 --- a/src/main.ts +++ b/src/main.ts @@ -112,6 +112,8 @@ export default class KOReader extends Plugin { }) { const { path, uniqueId, bookmark, managedBookTitle, book, keepInSync } = note; + // the page is always the first number in the bookmark's text (eg. 'Pagine 12 foo bar') + const page = parseInt(bookmark.text.match(/\d+/g)[0]); const noteItself = bookmark.text ? bookmark.text.split(bookmark.datetime)[1].replace(/^\s+|\s+$/g, '') : ''; @@ -129,6 +131,8 @@ by: [[<%= it.authors %>]] ## Chapter: <%= it.chapter %> +Page: <%= it.page %> + **==<%= it.highlight %>==** <%= it.text %>`; @@ -147,6 +151,7 @@ by: [[<%= it.authors %>]] highlight: bookmark.notes, text: noteItself, datetime: bookmark.datetime, + page, })) as string; const frontmatterData: { [key: string]: FrontMatter } = { @@ -156,6 +161,7 @@ by: [[<%= it.authors %>]] title: book.title, authors: book.authors, chapter: bookmark.chapter, + page, highlight: bookmark.notes, datetime: bookmark.datetime, text: noteItself, diff --git a/src/types.d.ts b/src/types.d.ts index b06ffb9..a18b017 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -28,6 +28,7 @@ export interface FrontMatterData { title: string; authors: string; chapter: string; + page: number; highlight: string; datetime: string; text: string; diff --git a/versions.json b/versions.json index 732d3a4..04843c0 100644 --- a/versions.json +++ b/versions.json @@ -8,5 +8,6 @@ "0.1.0": "0.12.0", "0.1.1": "0.12.0", "0.1.2": "0.12.0", - "0.2.0": "0.12.0" + "0.2.0": "0.12.0", + "0.2.1": "0.12.0" }