Skip to content

Commit 013048f

Browse files
committed
some joplin tag fixes
1 parent 912c0d4 commit 013048f

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ If you want to skip or ignore notes that have already been exported then
124124
```
125125
will skip exporting Keep notes to markdown that already exist in the destination directory. If 2 or more Keep notes have the same title and a markdown file already exists with that name, a new export will be created for any exports that do not exist. (Note that overwrite and skip cannot be used at the same time)
126126

127+
#### Preserve Labels
128+
Many markdown applications cannot work with special characters in labels/tags (such as brackets, parentheses, asterisks, etc). By default, KIM will strip out all special characters and replace them with dashes(-). If you need to preserve labels in their original form, use the -p option:
129+
```bash
130+
> python kim.py -p
131+
```
132+
127133
#### Logseq Style
128134
Some markdown systems prefer to have bullets prepended on each paragraph within a note. KIM will attempt to prepend a dash to any Keep note that has 2 linefeeds as well as the first line. You can enable this feature with
129135
```bash
@@ -154,14 +160,6 @@ If you have a large number of notes it can be confusing which ones have already
154160
> python kim.py -m
155161
```
156162

157-
#### Authentication Token Storage
158-
When you run KIM for the first time and log in via your password, it will store your authenticated Google Keep token in your computer's safe storage (macOS - Keychain, Windows Credential Locker and Linux Secret Service or KWallet). You will not need to re-enter your password next time you run KIM.
159-
160-
If you need to change or reset your access token or don't feel comfortable saving the token in safe storage, just run KIM with the -r flag (NOTE: this has changed from version 0.2.0):
161-
```bash
162-
> python kim.py -r
163-
```
164-
165163
#### Batch Mode
166164
KIM can run through your own script by using the -b flag. For example, running:
167165
```bash
@@ -218,9 +216,16 @@ You can override the settings `input_labels` in the command line with the (-lb)
218216

219217
NOTE: the import switches -i and -lb are incompatible with all other switches for export. Be sure to test simple import examples before using this feature!!!
220218

219+
#### Authentication Token Storage
220+
When you run KIM for the first time and log in via your password, it will store your authenticated Google Keep token in your computer's safe storage (macOS - Keychain, Windows Credential Locker and Linux Secret Service or KWallet). You will not need to re-enter your password next time you run KIM.
221+
222+
If you need to change or reset your access token or don't feel comfortable saving the token in safe storage, just run KIM with the -r flag (NOTE: this has changed from version 0.2.0):
223+
```bash
224+
> python kim.py -r
225+
```
221226

222227
#### Combinations
223-
Example: to export all non-archived notes, using content for blank note titles, with overwriting, preserving Keep label format, Logseq style paragraphs, removing trailing hashtags if embedded in note, with create dates > Oct 3, 2023 in batch:
228+
Example: to export all non-archived notes, using content for blank note titles, with overwriting, preserving Keep label format, Logseq style paragraphs, removing trailing labels if hashtags are embedded in note, with create dates > Oct 3, 2023 in batch:
224229
```bash
225230
> python kim.py -c -o -p -l -d -cd "> 2023-10-03" -b --all
226231
```

kim.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,13 @@ def keep_query_convert(keep, keepquery, opts):
696696

697697
if opts.joplin_frontmatter:
698698
joplin_labels = ""
699-
for label in note_labels.replace("#", "").split():
700-
joplin_labels += " - " + label + "\n"
699+
jls = [item.strip() for item in note_labels.split("#")]
700+
jls = list(filter(None, jls))
701+
#for label in note_labels.replace("#", "").split():
702+
for label in jls:
703+
jlabel = " - " + label + "\n"
704+
if jlabel not in joplin_labels:
705+
joplin_labels += jlabel
701706
note.header = ("---\ntitle: " + note.title +
702707
"\nupdated: " + note.timestamps["edited"] +
703708
"Z\ncreated: " + note.timestamps["created"] +

0 commit comments

Comments
 (0)