Action

Inline Code (`)

Posted by agiletortoise, Last update over 5 years ago

Apply Markdown inline code (`) around selection, or insert ` if no selection.

Steps

  • script

    // Apply Markdown bold 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
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.