Skip to content

Commit 7854ba4

Browse files
committed
fix #39, add render img attributes
1 parent 09ca557 commit 7854ba4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/markupParser.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,14 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
116116
html_tag = true;
117117
}
118118
//img
119-
const img_re = /!([^|]*)\|?.*!/;
119+
const img_re = /!([^|]*)\|?(.*)!/;
120120
const img_match = tag.match(img_re);
121121
if (img_match) {
122-
tag = '<img src="' + imageUri(sourceUri, img_match[1]) + '"/>';
122+
let imgAttr = ""
123+
if (img_match[2].length != 0){
124+
imgAttr = img_match[2].replace(/=/gi, '="').replace(/,/gi, '" ') + '"'
125+
}
126+
tag = `<img src="${imageUri(sourceUri, img_match[1])}" ${imgAttr}/>`;
123127
}
124128

125129
//Table

0 commit comments

Comments
 (0)