Can we change markdown for bold to one asterisk (instead of two)?

I draft messages for whatsapp on drafts on my iPhone.

The problem is that WhatsApp uses one * instead of two.

is it possible for me to change this on my Drafts please?

I frequently select text and long press to apply bold. I can go it and manually delete the extra * but it’s time consuming and I can make mistakes. Also it doesn’t format correctly in Drafts (which sees it as italics)

See this previous thread on WhatsApp - includes example syntax and information on action changes to support their syntax:

That was a quick tap to install.

when I select text on iOS or iPadOS and ask for bold it wraps with two * and not one.

It does however now accept a single underscore on either side of the selected text for italics.

I only use markdown for WhatsApp so don’t mind changing how it works for all of Drafts.

If you are using the iOS format menu, when selecting “Bold” it runs whatever action you have installed in your Drafts’ action list which is assigned to the ⌘-B keyboard shortcut.

By default, this is the “Markdown Bold” action in the “Markdown” action group. That thread I pointed you to details how you could modify that action to support this…see this reply

When I’m viewing an individual draft on iPad, how can I change (or view) what current syntax is being supported? From your replies I infer that the syntax is done per draft/post rather than globally?

Thanks. I’m racking my brain to see if I can edit “Markdown Bold” on my iPad. Must I use a Mac to do this?

Edit: I found it on ipad. It’s under the keyboard tools for markdown

Oh shoot I broke it by changing this bit


// Apply Markdown bold to selection, or insert * if no selection

var sel = editor.getSelectedText();
var selRange = editor.getSelectedRange();

if (!sel || sel.length == 0) {
  editor.setSelectedText("*"); // this is correct 
  editor.setSelectedRange(selRange[0]+2,0);
}
else {
  editor.setSelectedText("*"+sel+"*"); // this broke it 😔 edit: now fixed ✅
  editor.setSelectedRange(selRange[0]+selRange[1]+4,0);

I don’t really understand code so I changed all double * to single * which was probably stupid!
It’s really finicky to read and edit symbols on iPad.
Please could you tell me the correct code to put underneath “else”

In the line that „broke it“ you’re missing a ‚+‘ just before the“sel“

However I‘d recommend adapting the action so it adds two Asterix for non WhatsApp syntax and only one if the draftbuses WhatsApp syntax.

1 Like

Thank you very much. I added the +.

I get your point about “whatsapp syntax” - thus is easily done on Mac where I can pick it from a list in the bottom right, but on iPad I can’t even see what the current markup style is (let alone change it)

This is an aside for this help forum: :when using on iPad it would be really helpful to have an icon to insert code. (I eventually got there by creating a text shortcut for 3 back ticks)

This may not sound like big deal to those who live on Macs, but it’s really hard to do on the iPads software keyboard :tired_face:

There’s a quick access “Change Syntax” option in the Settings menu (gear at bottom right)…and in Editor Settings. In Editor Settings, you can also change the default syntax assigned to new drafts.

I recently changed my default syntax too, and it took me a bit to figure out how to quickly switch over all my existing drafts, not just newly created ones. This is on the Mac; not sure if it’s possible on iPad, but on iOS I can’t quite find it.

Click in the left sidebar to select a draft. Cmd + A to select all drafts (You can either do this in your Inbox or in All if you want to include your archived drafts). Right click, “Change Syntax…”, and there you can change them all at once.

As for an icon to insert code, if I’m reading you correctly, you can make a new action for the action bar. Very similar to how you edited the bold action.

You can do this all on the iPad. Open the right sidebar, in the bottom left of that sidebar you can select the Keyboard-Markdown action group. Now in the list, press and hold on Markdown Emphasis, then Duplicate. You can also make a new action from scratch, but since you want this to behave almost the same, it’s easier to copy. Now you can edit this new one; you’ll want to change the name to, say, “Code Block”, and the icon to what you want to appear in the UI. In the script, replace the underscores with the backticks.

So now it’ll insert three when you don’t have anything selected, and surround your selection when you do.

(To go the extra mile, you’ll also need to edit the action to put the cursor in the right place after. An exercise for the reader. :wink: )

In addition to Greg’s post— if it helps, there are a couple of actions for changing syntaxes: