Today as I worked on finishing up a major revision to my Blog Post Publish shortcut, it occurred to me that, in a relatively short period of time, I went from struggling to understand regular expressions in general, and how regular expressions worked in Shortcuts in particular, to using them all the time in my shortcuts.
I decided I’d start a series about regular expressions and how to use them productively with the Shortcuts app, not because I’m a genius with regular expressions, but to show that anyone can learn them and that they are indeed useful and powerful when used for creating shortcuts.
The term “regular expressions” sounds a little odd, but basically regular expressions are just patterns used for searching text. They are extremely useful for things like extracting specific bits of information from text, for replacing specific things in text, or for validating text input for an app or web …
Not too long ago, I wrote about JSON file editing using Shortcuts and Data Jar, but now it’s even better. Never one to rest on his laurels, Simon Støvring added drag and drop data insertion as well as keyboard shortcuts with the past couple TestFlight betas.
I made a super short video showing how easy it is to add a new link to a dictionary of links, for example.
If you visit my links page, you’ll see a bunch of categories with a unique-per-category icon, a category name, and a bunch of links in that category. Each of those categories is generated from its own JSON file. Simple enough.
However, I don’t really want to have to log onto the server, manually edit JSON files, and recompile the site. First of all, directly editing any kind of file like JSON or XML that has tags or characters that are required for it to make sense which can be accidentally deleted is a bad idea. Mistakes get made. Secondly, it’s just easier mentally to view them a different way.
Since I also want to update my git repository after changing something on my site, I like to use shortcuts that will let me download files to edit, or upload new or edited files, and then update my git repositories and compile my site without me having to do anything other than run the shortcut.
I’ve mentioned here before that I don’t want to have to remember the mechanics behind things like how post summaries work when writing posts. The same applies to images in my posts – I wrote an image handler shortcode but if I have to remember parameters or manually paste shortcodes in iA Writer as I crank out an article, I’ve failed.
Tech is supposed to seamlessly enable me to write and publish, not stand between me and my site like a high priest demanding complex incantations that require years of practice to master. Like I’ve said before, the whole point of me using an app like iA Writer is because it has the writing experience I want, and I don’t want to have to write text in Hugo templates. The site shouldn’t dictate how I write, it should just put whatever words I dictate on display when I’m done.
So… not …
I use iA Writer on iOS and Mac as my primary text editor for writing blog posts. I like its Files app integration and ability to work with Working Copy and other Files app providers. It’s also really easy to get at anything written in iA Writer because they’re all stored as iCloud Documents in an iA Writer iCloud folder.
One thing I have had an issue with though is that iA Writer does markdown footnotes in a way that doesn’t work when I post it to my sites as an .md file and compile it with Hugo. For that matter, it didn’t work when I used to put it into Wordpress with markdown enabled either.
iA Writer’s footnote format looks like this:
There is a footnote at the end of this sentence[^this is the footnote].
That doesn’t convert to a proper markdown footnote in most (all?) markdown …