Drafts Action Directory

Markdown Emphasis (_)

Posted by agiletortoise, Last updated: 2018-07-03 17:10:48 UTC

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

Install

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

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.