✪FN
Markdown footnote

Script key: Markdown footnote

Posted by @rosscatrow

Install

Details

Label ✪FN
Voice Over Markdown footnote
Script
// Length of select range +1

var selRange = getSelectedRange();
var selLen = getSelectedText().length;

setSelectedRange(selRange[0],selLen+1);

// Move select range to left

selRange = getSelectedRange();
selLen = getSelectedText().length;

setSelectedRange(selRange[0]-1,selLen);


// add footnote markdown inline and append footnote reference at the end of the draft

fn = getSelectedText();
s = "[^" + fn + "]";
setSelectedText(s);
s = getText();
s = s + "\n\n[^" + fn + "]: ";
setText(s);

// move cursor to the end of the draft 

setSelectedRange(s.length, 0)

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus