Limit small image rendering to just the avatar images

This commit is contained in:
sabaimran 2023-06-29 11:27:18 -07:00
parent 70e550250a
commit fecf6700d2
2 changed files with 10 additions and 3 deletions

View file

@ -3228,8 +3228,15 @@
// Encode attributes, e.g. `<img src="foo"` // Encode attributes, e.g. `<img src="foo"`
result += this.renderAttrs(token); result += this.renderAttrs(token);
// Add a class name for all tokens, e.g. `<img class="foo"` if (token.tag === "img" && token.attrs) {
result += ' class="md-level"'; for (var i = 0; i < token.attrs.length; i++) {
if (token.attrs[i][0] === "src") {
if (token.attrs[i][1].includes("avatar")) {
result += ' class="md-avatar"';
}
}
}
}
// Add a slash for self-closing tags, e.g. `<img src="foo" /` // Add a slash for self-closing tags, e.g. `<img src="foo" /`
if (token.nesting === 0 && options.xhtmlOut) { if (token.nesting === 0 && options.xhtmlOut) {
result += " /"; result += " /";

View file

@ -380,7 +380,7 @@
text-decoration: none; text-decoration: none;
} }
img.md-level { img.md-avatar {
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 50%; border-radius: 50%;