reelsense / markdeep

📝 Markdeep
http://casual-effects.com/markdeep/
BSD 2-Clause "Simplified" License
257 stars 21 forks source link

reference images - regex bugs #4

Closed pszynk closed 5 years ago

pszynk commented 5 years ago

Hi,

first of all thank for your work, really cool project. Hope you'll keep on developing it.

I've found 2 bugs in the regex concerning reference images. In function markdeepToHtml at the section:

// REFERENCE IMAGE: ![...][ref attribs]
 // Rewrite as a regular image for further processing
str = str.rp(/(!\[[^\[\]]*?\])\[("?)([^"<>\s]+?)\2(\s[^\]]*?)?\]/, function (match, ...
  1. You missed the global flag /g, so only the first one gets substituted
  2. Section [^\[\]]*? doesn't allow for optional Figure labels, ![Figure [img] bla bla...][robot.png]. Couldn't it be replaced by a simple .*? ?

So all together

str = str.rp(/(!\[.*?\])\[("?)([^"<>\s]+?)\2(\s[^\]]*?)?\]/g, function (match, ...

cheers!

pszynk commented 5 years ago

Right, I see that this is not the place to report the issues. I've sent an email to Morgan and I'm closing it.