Image title incorrect
Opened this issue · 1 comments
At present the alt text for an image is also put into the title, where the spec[1] puts the title as an optional string after the URL.
I think you can fix it as follows:
(a) change the links pattern at line 24 to
links: /!?\[([^\]<>]+)\]\(([^ \)<>]+)( "([^\(\)\"]+)")?\)/g,
(that is, to be enable extraction of the title text between the quotes), and
(b) replace the img element construction at line 190 with
str = str.replace(stra[0], '<img src="' + stra[2] + '" alt="' + stra[1] + '"' + (stra[4] ? '" title="' + stra[4] + '" ' : '') + '/>');
recognising that title is optional.
Thanks for this useful library.
Sorry, I had an extra quote, I meant:
str = str.replace(stra[0], '<img src="' + stra[2] + '" alt="' + stra[1] + '"' + (stra[4] ? ' title="' + stra[4] + '" ' : '') + '/>');