Skip to content

Instantly share code, notes, and snippets.

@thehandsomezebra
Last active January 9, 2022 17:48
Show Gist options
  • Save thehandsomezebra/65c5d698082a6e9a96fa7c5105801af6 to your computer and use it in GitHub Desktop.
Save thehandsomezebra/65c5d698082a6e9a96fa7c5105801af6 to your computer and use it in GitHub Desktop.
Convert Google Keep exported notes into two markdown files
echo "" >textcontentfile.md
echo "" >listcontentfile.md
for f in *.json; do
echo "processing "$f""
if cat "$f" | grep --silent '.textContent'; then
echo "" >>textcontentfile.md
#title
echo "## "$(cat "$f" | jq '.title') >>textcontentfile.md
echo "" >>textcontentfile.md
#content
cat "$f" | jq '.textContent' >>textcontentfile.md
echo "" >>textcontentfile.md
echo "---" >>textcontentfile.md
echo "" >>textcontentfile.md
fi
if cat "$f" | grep --silent '.listContent'; then
echo "" >>listcontentfile.md
echo "## "$(cat "$f" | jq '.title') >>listcontentfile.md
cat "$f" | jq -c '.listContent[]' | while read i; do
isChecked=$(echo $i | jq -r '.isChecked')
if $isChecked; then
checkeddisplay=$(echo "- [X]")
else
checkeddisplay=$(echo "- [ ]")
fi
item=$(echo $i | jq -r '.text')
echo "$checkeddisplay $item" >>listcontentfile.md
done
echo "" >>listcontentfile.md
echo "---" >>listcontentfile.md
echo "" >>listcontentfile.md
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment