Catching Markdown mistakes
I had an interesting idea this morning. At least I find it interesting, but I haven’t slept much lately. Either way, here it is: in Markdown, if you misname a reference link, forget to fill one in or have a malformed URL, your broken Markdown shows up in your output. Wouldn’t it be nice if your preview highlighted those for you before you went to publish?
// Scan for and highlight malformed/incomplete Markdown links $('#wrapper').html($('#wrapper').html().replace(/(\[.*?\][\[\(].*?[\]\)])/g, "<span style=\"color:rgba(152, 50, 63, 1)\">$1</span>"));
It just scans for Markdown-style links (
[text](link)) that are still in your text after converting to HTML. If it finds them, it highlights them in red. Just thought I’d share.