This commit is contained in:
Benjamin San Souci 2015-06-17 08:01:48 -07:00
parent 2863fa6a1d
commit db60389c39

View File

@ -42,13 +42,14 @@ showdown.subParser('images', function (text, options, globals) {
altText = altText.replace(/"/g, '"');
url = showdown.helper.escapeCharacters(url, '*_', false);
var isPDF = url.indexOf('.pdf') === url.length - 4;
var result = '';
if(isPDF){
var isPDF = url.indexOf('.pdf') === url.length - 4,
result = '';
if (isPDF)
result = '<object data="' + url + '" type="application/pdf"';
} else {
else
result = '<img src="' + url + '" alt="' + altText + '"';
}
if (title) {
@ -65,11 +66,10 @@ showdown.subParser('images', function (text, options, globals) {
result += ' height="' + height + '"';
}
if(isPDF) {
if (isPDF)
result += '>' + altText + '</object>';
} else {
else
result += ' />';
}
return result;
}