✪ #
Markdown header

Script key: Markdown header

Install

Details

Label ✪ #
Voice Over Markdown header
Script
// Apply Markdown Header to current line

var lnRange = getSelectedLineRange();
var ln = getTextInRange(lnRange[0],lnRange[1]);
var selRange = getSelectedRange();

var prefix = "#";
if (ln.length == 0 || (ln && ln[0] != " " && ln[0] != "#")) {
  prefix = "# ";
}

setTextInRange(lnRange[0],lnRange[1],prefix+ln);
setSelectedRange(selRange[0]+prefix.length,selRange[1]);

Advanced

Keyboard shortcut h
Hide key Yes

Discussion

comments powered by Disqus