FIX: Missing `title` attribute when quoting an image.
This commit is contained in:
parent
2265c5102f
commit
782da448a2
|
@ -241,6 +241,7 @@ export class Tag {
|
|||
let alt = attr.alt || pAttr.alt || "";
|
||||
const width = attr.width || pAttr.width;
|
||||
const height = attr.height || pAttr.height;
|
||||
const title = attr.title;
|
||||
|
||||
if (width && height) {
|
||||
const pipe = this.element.parentNames.includes("table")
|
||||
|
@ -249,7 +250,7 @@ export class Tag {
|
|||
alt = `${alt}${pipe}${width}x${height}`;
|
||||
}
|
||||
|
||||
return "![" + alt + "](" + src + ")";
|
||||
return `![${alt}](${src}${title ? ` "${title}"` : ""})`;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
|
|
@ -166,6 +166,9 @@ QUnit.test("converts img tag", assert => {
|
|||
let html = `<img src="${url}" width="100" height="50">`;
|
||||
assert.equal(toMarkdown(html), `![|100x50](${url})`);
|
||||
|
||||
html = `<img src="${url}" width="100" height="50" title="some title">`;
|
||||
assert.equal(toMarkdown(html), `![|100x50](${url} "some title")`);
|
||||
|
||||
html = `<div><span><img src="${url}" alt="description" width="50" height="100" /></span></div>`;
|
||||
assert.equal(toMarkdown(html), `![description|50x100](${url})`);
|
||||
|
||||
|
|
Loading…
Reference in New Issue