Skip to content

Commit 27dc1a0

Browse files
committed
Version 0.6.1 final updates
1 parent 2460b97 commit 27dc1a0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ Since KIM converts Google Keep notes to markdown, you can use some of the Obsidi
224224
KIM's goal is to be markdown compliant. Obsidian uses Wikilinks by default. Obsidian can use strict markdown by setting the Options / Files & Links / Use [[Wikilinks]] to off. Currently, only strict markdown is enforced in KIM conversion to be as compatible as possible.
225225

226226
## Logseq Use
227-
Notes will import into Logseq similar to the Obsidian Use description, however, you need to set your mdfiles path to the `pages` folder in Logseq. For images to render properly be sure to set your media path to `../assets`. Also, to format notes correctly, an experimental feature has been added. A new switch has been configured (-l) to add paragraph bullets within each exported note so Logseq will render them better. Deep testing was not done on this option.
227+
Notes will import into Logseq similar to the Obsidian Use description, however, you need to set your mdfiles path to the `pages` folder in Logseq. For images to render properly be sure to set your media path to `../assets`. Also, to format notes correctly, an experimental feature has been added. A new switch has been configured (-l) to add paragraph bullets within each exported note so Logseq will render them better.
228228

229229
## Notion Use
230230
KIM markdown note exports seem to import into Notion successfully. However, Notion STILL fails to import linked image attachments (which seems to be a general Notion md import problem at this time). Notion also ties underlying ids to any cross-linked notes so that there is no automated cross-linking when importing (future feature). Also, tags are not supported in Notion so Keep labels will just be text hashtags within the note which are searchable.
231231

232232
## Joplin Use
233-
KIM markdown note exports also import very well into Joplin. Using the -j flag will add Keep labels as Joplin front matter to add them as tags. Most markdown types in Keep notes should convert successfully even if Keep cannot render them. However, wikilinks are not supported in Joplin's manual markdown import and front matter tags are not supported on import.
233+
KIM markdown note exports also import very well into Joplin. Using the -j flag will add Keep labels as **Joplin front matter** to add them automatically as tags. Most markdown types in Keep notes should convert successfully even if Keep cannot render them. For example, you can begin to cross-link notes in Keep by using the Wikilink double-brackets within a note like this [[Title of another Keep note]]. Wikilinking between Keep notes will automatically convert to standard Joplin markdown note links connecting notes together.
234234

235235
## Typora Use
236236
KIM tries to adhere to strict markdown to be as compatible as possible. No issues have been discovered using Typora on KIM markdown exports.
@@ -274,4 +274,5 @@ Old keep-test.py module removed for new Google authentication (get_token.py adde
274274
New simple INSTALL.md steps
275275

276276
## 0.6.1 Recent Changes
277-
New instructions for versions of gkeepapi and gpsoauth to get keep token
277+
New instructions and Dockerfile for updated versions of gkeepapi and gpsoauth to get keep token
278+
Wikilinking now supported for Joplin notes

kim.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from xmlrpc.client import boolean
1515
from PIL import Image
1616

17-
KIM_VERSION = "0.6.0"
17+
KIM_VERSION = "0.6.1"
1818
KEEP_KEYRING_ID = 'google-keep-token'
1919
KEEP_NOTE_URL = "https://keep.google.com/#NOTE/"
2020
CONFIG_FILE = "settings.cfg"
@@ -412,6 +412,21 @@ def set_file_extensions(self, data_file, file_name, file_path):
412412
return (media_name)
413413

414414

415+
def replace_wikilinks(text):
416+
pattern = r"\[\[([^\]]*)\]\]"
417+
def replace(match):
418+
link_text = match.group(1)
419+
# Split the link text by pipe symbol, if present
420+
parts = link_text.split("|")
421+
print (link_text)
422+
file_link = parts[0].replace(' ', '%20')
423+
if len(parts) == 1:
424+
# No pipe symbol, use the same text for link and display text
425+
return f"[{parts[0]}]({file_link}.md)"
426+
else:
427+
return f"[{parts[1]}]({file_link}.md)"
428+
return re.sub(pattern, replace, text, count=0, flags=re.MULTILINE)
429+
415430

416431
def save_md_file(note, note_tags, note_date, overwrite, skip_existing):
417432
try:
@@ -581,6 +596,7 @@ def keep_query_convert(keep, keepquery, opts):
581596
"---\n\n")
582597
note_labels = ""
583598
note.timestamps = {}
599+
note.text = replace_wikilinks(note.text)
584600

585601

586602
if opts.archive_only:

0 commit comments

Comments
 (0)