Action

Markdown Emphasis (*)

Posted by David Blue, Last update over 2 years ago

UPDATES

over 2 years ago

Description formatting update.

An extremely simple modification to the default Markdown Emphasis (_) option replacing _ with * and set to the default keyboard shortcut ⌘ + i.

The original description, modified accordingly:

Apply Markdown emphasis (*) to selection or insert * if no selection.

Steps

  • script

    // Apply Markdown emphasis to selection, or insert _ if no selection
    
    var sel = editor.getSelectedText();
    var selRange = editor.getSelectedRange();
    
    if (!sel || sel.length == 0) {
      editor.setSelectedText("*");
      editor.setSelectedRange(selRange[0]+1,0);
    }
    else {
      editor.setSelectedText("*"+sel+"*");
      editor.setSelectedRange(selRange[0]+selRange[1]+2,0);
    }
    

Options

  • After Success Nothing
    Notification Error
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.