Linking to specific cheat sheets in Cheaters
A quick note for Cheaters hackers: as of a recent update, Cheaters can now handle linking directly to a specific cheat sheet using url hashes. You can use a zero-index number to link to a page if you know the order (index.html#3 to link to the fourth item), but because the order is configurable and subject to change, it also supports string matching. For example, if you wanted to link directly to the Siri cheat sheet, you could use [url_or_path_to_cheaters]#siri
.
The matching is case-insensitive and will go to the first menu item whose text starts with the hash string (in whole or in part, whitespace is ignored). This means that if you have a menu item for “CSS 3 Selectors” followed by “CSS Animation,” #css
will go to “CSS 3 Selectors.” To target “CSS Animation,” you’d want a url like #cssanim
or the full #cssanimation
.
Putting it to use
This is primarily geared toward building more complex workflows using tools like Alfred and Launchbar. You can see it in action on the demo page, using links like http://ttscoff.github.io/cheaters/cheat.html#siri (Siri cheat sheet) and http://ttscoff.github.io/cheaters/cheat.html#mmd (MultiMarkdown cheat sheet).
If you create a quick Service as shown above, you can pass text to it with Launchbar, as an example. You’ll need to edit the Shell action to point to wherever you keep your Cheaters index. The important part is #$1
, which will stick the text you passed to the Service in as the hash. It works just fine with file:///
urls, too. Save the Service as “Cheat” and then bring up Launchbar and type “cheat”. Once you have the Service selected, press Space and type “jq” or “siri”. Assuming you have the matching cheat sheet active (jQuery or Siri), pressing Enter will open Cheaters directly to your desired page.