Adding Heading Tag Support To CityDesk

One of my annoyances with CityDesk is the lack of support for H1/H2/H3/etc tags. It really bugs me that I have to switch to HTML mode whenever I want to format a heading. That stuff should be provided in the WYSIWYG interface.

Since Fog Creek Software never showed any interest in supporting heading tags, I figured out this neat workaround.

I downloaded a free keyboard macro utility called [AutoHotkey](http://www.autohotkey.com/) and set up the following macros in the default ini file:

^!1::
KeyWait Control
KeyWait Alt
Send !vs{HOME}{RIGHT}{DEL}h1{END}{LEFT}{BACKSPACE}h1!vn
return

^!2::
KeyWait Control
KeyWait Alt
Send !vs{HOME}{RIGHT}{DEL}h2{END}{LEFT}{BACKSPACE}h2!vn
return

^!3::
KeyWait Control
KeyWait Alt
Send !vs{HOME}{RIGHT}{DEL}h3{END}{LEFT}{BACKSPACE}h3!vn
return

What this does is maps Ctrl-Alt-1 to send the key sequence to CityDesk to switch to HTML mode, move the cursor to the start of the line, go forward one character, press Del, type “h1”, move to the end of the line, go back one character, press Backspace, type “h1”, then switch back to Normal mode. It does the same to map Ctrl-Alt-2 to “h2” and Ctrl-Alt-3 to “h3”.

To use it, just put your cursor on a line that you want to change into a heading, and then press Ctrl-Alt-1 (or 2, or 3, depending upon which level of heading you want to create). The macro will switch to HTML mode, change the `

` at the start of the line to a `

`, change the `

` at the end of the line to a `

`, and return you to Normal mode.

There are some limitations – your heading-to-be needs to be on a single line (not broken across multiple lines), and it needs to be a normal `

` paragraph with no extra spacing at the start or end of the line. If you’re just typing your article in directly in Normal mode, you should be OK with these restrictions.

Try it out, and let me know what you think!