Drafts Action Directory

Strikethrough

Posted by jrollans, Last update 13 days ago

Markdown for striking text out. Adds “~~” to the beginning of a line or the beginning and end of a selected block of text.

Install

Steps

  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    
    // Apply Markdown strike to selection, or insert ~~ if no selection
    let markup = "~~";
    
    var sel = editor.getSelectedText();
    var selRange = editor.getSelectedRange();
    
    if (!sel || sel.length == 0) {
      editor.setSelectedText(markup);
      editor.setSelectedRange(selRange[0]+markup.length,0);
    }
    else {
      editor.setSelectedText(markup+sel+markup);
      editor.setSelectedRange(selRange[0]+selRange[1]+(markup.length*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.