First, I’ve created a repo for SearchLink plugins. This is mostly going to be example code, but you might find some useful ones in there. If you’ve never checked out SearchLink and do any kind of writing that requires linking to web sites/pages, app landing pages, Gist embeds, or basically any kind of blogging, web writing, or show notes, you should check it out.
See the plugin repository for details on installing and contributing. All of the available searches in SearchLink are defined as plugins, so you can also use those as examples.
Text Filters
One thing I wanted to explore was using SearchLink for more than just searches. I created a couple proofs of concept as plugins. Some of these make more sense as TextExpander snippets, but I wanted to experiment, so here’s what I came up with.
MixCase
This plugin is a text filter that will turn !mix A string of text
into A STRInG of TExT
, randomly capitalizing characters. It’s just to demonstrate how easily a text filter can be implemented (if you know a little Ruby, anyway).
Calendar
Another example of a text filter. This one can insert a Markdown calendar for any month and year. You can define the month and year like !cal 5 2024
to get a calendar for May, 2024. If you use !cal now
it will insert a calendar for the current month and year. It can also print how many days are in a month with !days 2 2024
to show how many days are in February in 2024. Silly, and again would probably be better as a TextExpander snippet, but I’m just experimenting with extending SearchLink.
MakeADate
This is a port of a TextExpander snippet I use. It takes a natural language date and inserts a formatted date. It provides the following formats:
Abbr | Result |
---|---|
!ddate tomorrow 8am |
2023-11-02 8:00am |
!dshort 2/2/24 6:30am |
2024-2-2 6:30am |
!diso tomorrow 1pm |
2023-11-02 13:00 |
!dlong tomorrow 8am |
Thursday, November 2nd, 2023 at 8:00am |
All of the searches can be abbreviated to two letters, with !diso
becoming !di
, !dlong
becoming !dl
, etc.
This plugin requires that PHP be installed on the system, either with the Apple Command Line Utilties (I think), or with Homebrew (brew install php
).
Contributing
Use the fully-commented code in lyrics.rb
(documented in the SearchLink wiki) to generate your own plugins, and reference the existing searches for inspiration. Feel free to fork and submit a PR to the plugin repository if you create something you’d like to share!