Integrating help with Sublime

Today’s time was spent doing some integration of what has been done with Sublime so far so that it actually starts becoming if not more useful than at least more accessible. Along the way I fixed a code bug regarding index loading and implemented some new syntax changes. After including some new help for the syntax changes to explain what’s now possible, I also added some new key bindings.

On the whole, things are progressing well and the basics of having internal help is now complete, although there is still much to do.

The first thing done was to include some commands in the Command Palette so that help is more accessible. Currently there are three commands available for getting at help:

  1. Help on Help
  2. Packages with Help
  3. View Table of Contents

The first of these opens help directly on the main help topic that ships with hyperhelp which will (eventually) contain some actual help on how to work with help. The second shows you a quick panel of all packages currently known to have help (and that you have installed), and selecting one opens the table of contents of that package help so you can select a topic.

The last item is context sensitive in that it will open the table of contents, but only if the current window has a help view. In order for this to work the underlying command has to disable itself if there is no package given, none can be taken from a help view in the current window, and it was not explicitly told to prompt you for a package first.

One downside to this is that Sublime will show the key binding in the command palette even if it doesn’t currently apply (i.e. it shows ? as the key even if the current view is not a help view). Although annoying as far as I know there’s no way around this because the mechanism that includes the key bindings is just recognizing that the command exists with that binding and displays it without checking the contexts to see if the key would actually do anything.

I also added the same commands to the main menu. Currently this is a new top level menu item as an experiment so I can see how it grows on me over the rest of the month. It seems somehow wrong to do this and a better idea to instead put the items directly into the help menu, but (at least in my Sublime) that menu is already a little busy with other items I’ve added.

In getting into doing some actual help authoring, I decided now was the time to enhance the syntax for some extra separator characters. Horizontal separators can now optionally start and end with a ‘+’ character or have an internal ‘|’ character, which helps with box drawing. It is now also possible to generate a vertical separator line by using ‘|’ characters that have a leading or trailing tab, to disambiguate them from links.

I also discovered a bug in the index handling with regards to reloading a help index if it was not previously loaded. Although the code was triggering code that would do the reload, the result was never captured so things were not included as much as they could have been.

The last thing before I go to fall into bed (besides this blog post) is a mention that there are now some key bindings that make it easier to add paired versions of some markup characters in the help format, which should make the upcoming help authoring a little easier.

Tomorrow help authoring enhancements will continue as I expand the help to include more under the hood information in some new topics and work on the support code that will make this less of a chore.