Markdown Code

Posted by toniwonkanobi, Last update over 1 year ago

This is a modified version of someone else’s code syntax. This Action creates the Markdown code ticks around selected text, or, if there is no selected text, it creates two tick marks with the cursor in between them.


  • script

    // Apply Markdown code to selection, or insert ` if no selection
    var sel = editor.getSelectedText();
    var selRange = editor.getSelectedRange();
    if (!sel || sel.length == 0) {
      // editor.setSelectedText("`");
      // Let's try putting two ticks
      // editor.setSelectedRange(selRange[0]+1,0);
      // Let's try making the cursor be in the middle of the two tick marks
    else {


  • After Success Default
    Notification Error
    Log Level Error
Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.