Action

Markdown Header (#)

Posted by agiletortoise, Last update over 6 years ago

Test description.

Steps

  • script

    // Apply Markdown Header to current line
    
    var lnRange = editor.getSelectedLineRange();
    var ln = editor.getTextInRange(lnRange[0],lnRange[1]);
    var selRange = editor.getSelectedRange();
    
    var prefix = "#";
    if (ln.length == 0 || (ln && ln[0] != " " && ln[0] != "#")) {
      prefix = "# ";
    }
    
    editor.setTextInRange(lnRange[0],lnRange[1],prefix+ln);
    editor.setSelectedRange(selRange[0]+prefix.length,selRange[1]);
    

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.