Export Notes as Markdown in MacOS Tahoe
Export multiple notes as Markdown and keep the history in Git.
Yesterday I completed a nuke-and-pave upgrade to MacOS Tahoe on my main workstation.
My favorite feature so far is the ability to export notes to Markdown. It even exports the attachments. Sweeet! Many thanks to the folks responsible for this improvement!
The best part is being able to select multiple notes and export them in a single operation. I typically export my changed notes a few times per week and keep the history in git, and this makes the workflow really simple.
Exporting notes in multiple times faster in Tahoe. I was able to export hundreds of notes in just a few seconds.
It is a bit strange that the operation requires typing in a target directory name given that you also have to select a target directory. I created a little script that lives in the root directory of my git project and uses the default target directory name (Archive) to move all the files and attachments up into the project root and commit the changes.
#!/usr/bin/env bash
set -o nounset -o errexit -o pipefail -o errtrace
trap 'echo EXITED: "${BASH_SOURCE}" "${LINENO}"' ERR
if [ -r Archive/Attachments ]; then
rsync -av Archive/Attachments/* Attachments/
rm -rf Archive/Attachments
fi
if [ -r Archive ]; then
for file in Archive/*; do
if [ -s "$file" ]; then
mv -v "$file" ./
else
echo "$file IS EMPTY, SKIPPING!!!"
fi
done
rm -rf Archive
fi
git add -A .
git status
git commit -m "updates"
Still some issues...
I am a fan of ubiquitous capture. I rely on Notes heavily, and I keep a lot of information in Notes. Bet's face it, Notes on MacOS is just not a very good editor. It has some wonderful cloud features like sync to all my Apple devices and offline viewing and editing. But when it comes to basic editing tasks, Notes has a pretty basic feature set and is unfortunately pretty buggy. For whatever reason, Apple put all their effort in Notes into the cloud functionality and neglected most of the other stuff.
My number one complaint is version control. If I have a note that isn't shared, the history doesn't get tracked. I was completely shocked the first time I realized notes history is not stored in Time Machine. This is extremely problematic because of the undo situation. When switching between notes, the undo history gets thrown away. So, for example, if you change something in a note (accidentally or on purpose), then click to another note, then the undo history from the first note is lost. If you go back to the first note and hit undo, then you just get an error sound. There are various scenarios where this can make it far too easy to lose content, which is what led me to start checking my notes files into git in the first place.
Beyond that, I have been keeping a list of issues I have personally encountered in Tahoe.
One minor annoyance I've seen in Tahoe is that if I have selected a note to export that is currently locked, then when I run the export, the note will get exported as an empty file. So, I updated the script to skip empty files so it doesn't replace the file in git with an empty one.
Also, if I export all my notes multiple times, I get different results. I've tried this by selecting all notes and exporting to a directory called Archive1, and then leave the same notes selected and immediately export to a directory called Archive2. When I do this, I get different results as show by "diff -r --brief Archive1 Archive2". This mostly seems to be due to attachments that have the same name. In some exports you get one of the attachments, and in some exports, you end up with a different one. I believe most of the name collisions I'm seeing were created when I took multiple pictures using the camera from within Notes to the same note. If you grep for the attachment file name in the exported files, you can see where the duplicates are referenced (note that some characters are percent encoded in the filename, e.g. space is %20).
Occasionally when I cut something from one note and paste it into another note, notes crashes during the paste. When I restart Notes, my text appears to have been pasted properly.
Occasionally when I export files, some of the files end up with a bunch of duplicated lines. I haven't been able to reproduce this consistently.
Also, I'm still dealing with some familiar issues from Sequoia.
Selecting text with the mouse by double clicking or single clicking and dragging is sometimes buggy. It's sometimes hard to select a portion of a line in a checkbox item.
If I double-click on a note and open it in a second window, then far too many things are buggy in that second window. For just one example, if I copy something to the clipboard in the secondary window, it doesn't actually get copied to the clipboard. If I just have a secondary window open, sometimes the clipboard stops working properly in the main window.
There is one bug that can cause the export to fail. When this happens, if you select one or more notes and choose File => Export as => Markdown, then the progress bar will come up as it processes the files, but then it will just play an error sound and stop without any error message. This happens pretty consistently if I've had Notes open for more than a few hours, but I've also seen it happen when Notes has only been open for a few minutes. I've noticed this tends to happen if I have brought up the font (⌘T) or color (⇧⌘C) dialogs, but I haven't been able to identify a specific sequence of actions to reliably recreate it. The same issue happened when trying to export in Sequoia. Once it fails, it seems to reliably fail again and again. Closing and reopening Notes seems to be the only way to resolve the issue.
When using a dark background, and when custom colors are applied to some text (using the color picker, ⇧⌘C, which can only be done on MacOS), then sometimes the brightness of the color is reversed. For example, if I choose a lighter grey in the color picker, then the text will show up with a darker grey in the note, or if I choose a darker blue in the color picker, then the text will be a lighter blue in the note. I've found that if I turn off Math Results (Format => Math Results => Off), and then reload the note (or sometimes I have to restart notes), then the problem goes away. This was a constant problem in Sequoia, but it has only happened to me a few times in Tahoe.
When collapsing headers, the spacing is often wrong, e.g. there will be a big blank space after the collapsed heading. If you try to delete the blank space, it just expands the bullet again.
When I make lists of checkboxes, I often have some blank checkbox lines in-between tasks. I like keeping the checkbox lines that don't have any text because it helps break up items in the list, and when I mark an item in the list done, it automatically move it to the end of the list and out of the way of my active tasks. But Notes doesn't handle these lines well. If I collapse a heading that has blank checkbox lines under it, they don't collapse properly. Also notes has a habit of putting a space at the end of a line, leading to a line with a checkbox followed by a single space. If I highlight a line with text and then move that line around in the list, the highlights can end up getting applied to the checkbox lines next to it that have a blank space. I'm frequently clearing unintentionally highlighted lines.
I notice that if the first image in the note has a transparent background, and I am using a dark theme, the thumbnail of the picture that shows up in the notes column has a white background.
OK, this is not really a bug, but why are there only 5 highlight colors? I realize it's challenging to come up with colors that look good on both light and dark backgrounds, but seriously, why isn't green one of the colors? Green is the ideal color to indicate that something is done or in an OK state.