1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

fix image positioning

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2023-02-06 01:35:22 +05:30
parent 50c630733a
commit 7e8dd5cdea
5 changed files with 23 additions and 15 deletions
+15 -1
View File
@@ -42,7 +42,21 @@ customElements.define(
};
renderer.image = (href, title, text) => {
return `<img class="max-w-xs grow-0 shrink-0 basis-auto w-full" src=${href} alt="${text}">`;
let pos = text.search(":");
let direction = text.substr(pos + 1);
text = text.substr(0, pos);
let put = "max-w-xs ";
switch (direction) {
case "right":
put += "float-right ";
break;
case "left":
put += "float-left ";
break;
default:
put = "float-none ";
}
return `<img class="${put} grow-0 shrink-0 basis-auto w-full px-3" src=${href} alt="${text}">`;
};
marked.setOptions({