Markdown Header (#)

Posted by CK Labels, Last update 4 months ago - Unlisted

Add “#” at beginning of line to create Markdown header. Use more than once to add heading levels.

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.00000000001]+prefix.length,selRange[1]);
    

Options

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