mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(images): fix js error when using image references
In some circumstances, on a reference style image, the last capturing group is ignored, which causes the fucntion argument to return the number of matches instead of a string (or undefined). Checking if the title parameter is a string ensures that the title parameter is actually something that was caught by the regex and not some metadata. Closes #585
This commit is contained in:
parent
63763b136f
commit
b0d475fc08
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -61,7 +61,7 @@ showdown.subParser('makehtml.images', function (text, options, globals) {
|
|||
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||
var result = '<img src="' + url + '" alt="' + altText + '"';
|
||||
|
||||
if (title) {
|
||||
if (title && showdown.helper.isString(title)) {
|
||||
title = title
|
||||
.replace(/"/g, '"')
|
||||
//title = showdown.helper.escapeCharacters(title, '*_', false);
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
[![the-image]]
|
||||
|
||||
[the-image]: http://example.com/foo.png
|
||||
<p>[<img src="http://example.com/foo.png" alt="the-image" />]</p>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[![the-image]]
|
||||
|
||||
[the-image]: http://example.com/foo.png
|
Loading…
Reference in New Issue
Block a user