Skip to content

Commit

Permalink
v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiiiz committed Jul 14, 2022
2 parents 39df04e + 7e840a7 commit 81c9e84
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
26 changes: 19 additions & 7 deletions src/assets/defaultTemplate.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{%- if is_new_article -%}

{% if is_new_article %}
# Metadata
{% if link %}Source URL:: {{link}}{% endif %}

Expand All @@ -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 -%}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
}
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"0.0.1": "0.12.0"
"0.0.1": "0.12.0",
"0.0.2": "0.14.0"
}

0 comments on commit 81c9e84

Please sign in to comment.