mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(makemarkdown.image): fix bug width|height = auto
`<img src="a" width="auto" height="auto" />` transforms into `![null](<a> =autoxauto)`. After fix, the output becomes `![null](<a> =*x*)` Closes #622
This commit is contained in:
parent
9e5d0f3f11
commit
440170aadc
|
@ -2,11 +2,13 @@ showdown.subParser('makeMarkdown.image', function (node) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var txt = '';
|
var txt = '';
|
||||||
if (node.hasAttribute('src')) {
|
if (node.hasAttribute('src') && node.getAttribute('src') !== '') {
|
||||||
txt += '![' + node.getAttribute('alt') + '](';
|
txt += '![' + node.getAttribute('alt') + '](';
|
||||||
txt += '<' + node.getAttribute('src') + '>';
|
txt += '<' + node.getAttribute('src') + '>';
|
||||||
if (node.hasAttribute('width') && node.hasAttribute('height')) {
|
if (node.hasAttribute('width') && node.hasAttribute('height')) {
|
||||||
txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height');
|
var width = node.getAttribute('width');
|
||||||
|
var height = node.getAttribute('height');
|
||||||
|
txt += ' =' + (width === 'auto' ? '*' : width) + 'x' + (height === 'auto' ? '*' : height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.hasAttribute('title')) {
|
if (node.hasAttribute('title')) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user