Skip to content

Commit

Permalink
keep: support "pinned" tag and fall back to HTML content, if there is…
Browse files Browse the repository at this point in the history
… no text content
  • Loading branch information
marph91 committed Sep 20, 2024
1 parent dcaa965 commit 8895903
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/formats/google_keep.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def convert(self, file_or_folder: Path):
for label in note_keep.get("labels", [])
if "name" in label
]
if note_keep.get("isPinned"):
tags_keep.append("google-keep-pinned")

resources_keep = []
for resource_keep in note_keep.get("attachments", []):
Expand All @@ -43,7 +45,7 @@ def convert(self, file_or_folder: Path):

note_imf = imf.Note(
title,
note_keep.get("textContent", ""),
note_keep.get("textContent", note_keep.get("textContentHtml", "")),
source_application=self.format,
# Labels / tags don't have a separate id. Just use the name as id.
tags=[imf.Tag(tag) for tag in tags_keep],
Expand Down
2 changes: 1 addition & 1 deletion src/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def import_note(self, note: imf.Note):
)
if resource.original_text is None:
# append
note.body = f"{note.body}\n{resource_markdown}"
note.body = f"{note.body}\n\n{resource_markdown}"
else:
# replace existing link
note.body = note.body.replace(resource.original_text, resource_markdown)
Expand Down

0 comments on commit 8895903

Please sign in to comment.