diff --git a/manifest.json b/manifest.json index 550de18..476b058 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "id": "obsidian-raindrop-highlights", "name": "Raindrop Highlights", - "version": "0.0.1", - "minAppVersion": "0.12.0", + "version": "0.0.2", + "minAppVersion": "0.14.0", "description": "Sync your Raindrop.io highlights.", "author": "kaiiiz", "authorUrl": "https://github.com/kaiiiz", diff --git a/package.json b/package.json index 2478ed2..5d73237 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-raindrop-highlights", - "version": "0.0.1", + "version": "0.0.2", "description": "Sync your Raindrop.io highlights.", "main": "main.js", "scripts": { diff --git a/src/assets/defaultTemplate.njk b/src/assets/defaultTemplate.njk index d91aa7d..3ab4f34 100644 --- a/src/assets/defaultTemplate.njk +++ b/src/assets/defaultTemplate.njk @@ -1,5 +1,4 @@ -{%- if is_new_article -%} - +{% if is_new_article %} # Metadata {% if link %}Source URL:: {{link}}{% endif %} @@ -8,8 +7,21 @@ {% if excerpt %}{{excerpt}}{% endif %} -{%- endif -%}{%- for highlight in highlights %} -{{highlight.text}} — Updated on {{highlight.lastUpdate}} -{% if highlight.note %}> {{highlight.note}}{% endif %} ---- -{% endfor -%} +## Highlights +{% endif -%}{% for highlight in highlights %} +{% if highlight.color == "red" -%} + {%- set callout = "danger" -%} +{%- elif highlight.color == "blue" -%} + {%- set callout = "info" -%} +{%- elif highlight.color == "green" -%} + {%- set callout = "check" -%} +{%- else -%} + {%- set callout = "quote" -%} +{%- endif -%} +> [!{{callout}}]+ Updated on {{highlight.lastUpdate}} +> +> {{highlight.text.split("\n") | join("\n>")}} +{% if highlight.note -%}> +> > {{highlight.note}} +{%- endif %} +{%- endfor -%} diff --git a/src/main.ts b/src/main.ts index 646a8d7..269b571 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,7 +10,7 @@ const DEFAULT_SETTINGS: RaindropPluginSettings = { highlightsFolder: '', syncCollections: {}, template: DEFAULT_TEMPLATE, - dateTimeFormat: 'YYYY-MM-DD HH:mm:ss', + dateTimeFormat: 'YYYY/MM/DD HH:mm:ss', }; export default class RaindropPlugin extends Plugin { diff --git a/src/sync.ts b/src/sync.ts index c50e95d..b71a7a8 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -28,6 +28,7 @@ export default class RaindropSync { } async syncCollection(collection: SyncCollection) { + new Notice(`Sync Raindrop collection: ${collection.title}`); const highlightsFolder = this.plugin.settings.highlightsFolder; const collectionFolder = `${highlightsFolder}/${collection["title"]}`; const lastSyncDate = this.plugin.settings.syncCollections[collection.id].lastSyncDate; @@ -37,7 +38,7 @@ export default class RaindropSync { console.debug('start sync collection:', collection.title, "last sync at:", lastSyncDate); articles = await this.api.getRaindropsAfter(collection.id, lastSyncDate); } catch (e) { - new Notice(`Raindrop Sync Failed: ${e.message}`); + new Notice(`Sync Raindrop collection ${collection.title} failed: ${e.message}`); } await this.syncArticles(articles, collectionFolder); @@ -108,6 +109,6 @@ export default class RaindropSync { sanitizeTitle(title: string): string { const santizedTitle = title.replace(/[':#|]/g, "").trim(); - return sanitize(santizedTitle); + return sanitize(santizedTitle).substring(0, 192); } } diff --git a/versions.json b/versions.json index 54275cc..df9c349 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,4 @@ { - "0.0.1": "0.12.0" + "0.0.1": "0.12.0", + "0.0.2": "0.14.0" }