Trick to assign actions to Bold/Italic/Underline commands



This is a bit of goofiness that is the result of the way iOS handles bold, italics and underline commands and input views.

Bold, italics and underline commands have their own routing, regardless of whether they are triggered by using external keyboard shortcuts (⌘-B, ⌘-I and ⌘-U), triggered from the text selection menu, or from the iPad keyboard shortcuts. Since Drafts intervenes in this process to be able to react to those external keyboard shortcuts, if you trigger bold, italic or underline via any of the other methods, you will get the same thing happen as if you hit the external keyboard shortcut.

The default installation of Drafts comes with Markdown bold and italics actions assigned to the ⌘-B and ⌘-I shortcuts…so they are also triggered if you select “Bold” or “Italic” from the text selection menu. You can change these assignments if there are other actions you would rather run using those buttons…or assign some other action to the ⌘-U shortcut, and you would be able to run that action by tapping the “Underline” commands in the other locations.

Not, perhaps, that exciting, but a handy little tip if you want to have another tool accessible from the text selection menu - like say assigning ⌘-U to an action which toggled title-lower-upper case on the selection.


I still cannot seem to get underline to work in a draft. Italic and bold work fine, but underline doesn’t seem to make any change


There is no such thing as underline in Markdown, so the underline command has nothing attached to it. If you want to attach a function to it, you can by assigning the ⌘-U keyboard shortcut to an action.


Markdown does not support underlining but does support bold and italic; Markdown being most users’ default draft syntax. This is probably why Greg separated that CMD+U out from Bold and Italic in his original posting and why it wouldn’t do anything by default.


Is there a workaround that works on an iPhone ?

There is no such thing as underline in Markdown, so the underline command has nothing attached to it. If you want to attach a function to it, you can by assigning the ⌘-U keyboard shortcut to an action.


This trick works on iPhone. Even if you do not have an external keyboard connected, if an action is assigned to these shortcuts, the bold/ital/underline buttons in the text selection menu will fire that action.


You could use ⌘U to insert <u>words here</u> around the selected word. It’s HTML and not Markdown, but it will work in previews just fine.


But I don’t have a command key on my iPhone, so how do I set that shortcut ?. While I use drafts all day long, and have many built actions that save me endless amounts of time, I do not anything about the coding in the background


I think you two are talking past each other.

Jeremy -

You seem to want to make some text in Drafts underlined. Right?

That just isn’t currently possible. Drafts are plain text, not rich text. And there’s no plain text way (at least in Markdown) to specify underlining. The bold and italic formatting are part of markdown and the fact that Drafts does a bit of WYSIWYG with them is just a convenience. (Note that Drafts adds the plain text asterisks and underscores, not just the formatting in the abstract.)

Given that underlining doesn’t work, Greg’s tip above is a hidden way to access an action using the “Underline” command. It could trigger whatever action you might want. To specify an action to be triggered in this way, you need to modify the action so that its assigned keyboard shortcut is command-u. You do that by editing the action, which can be done on a phone or an ipad.

To trigger such an action on an iPhone, you’d use the normal “underline” button that appears when you select some text (it’s that black pop-up, then the BIU button, then “underline”).

That’s not terribly handy on the iphone, but you can do it.


Thanks. I did try that and the command etc is all there, but it doesn’t seem to actually underline it. This is certainly not important, it would just be helpful



Yep. It wont actually underline it in Drafts because Drafts doesn’t display underlining.

If you are trying to underlining in text that you send to other apps, then Tim’s tip above is probably the best way to do that.