···11include ../utils
22+include postUtils
2334mixin infoContainer(data, next_id, prev_id)
45 - var hats = (data.is_submitter?['op']:[]).concat(data.distinguished=="moderator"?['mod']:[])
···5152 summary.expand-comments
5253 +infoContainer(data, next_id, prev_id)
5354 div.comment-body
5454- != data.body_html
5555+ != convertInlineImageLinks(data.body_html)
5556 if hasReplyData
5657 div.replies
5758 - var total = data.replies.data.children.length
+3-2
src/mixins/postUtils.pug
···5353 }
5454-
5555 function convertInlineImageLinks(html) {
5656- // Find all anchors that href to https://preview.redd.it
5757- const expression = /<a href="https:\/\/preview\.redd\.it.*?">(.*?)<\/a>/g;
5656+ // Find all anchors that href to preview.redd.it, i.redd.it, i.imgur.com
5757+ // and contain just a link to the same href
5858+ const expression = /<a href="(http[s]?:\/\/(?:preview\.redd\.it|i\.redd\.it|i\.imgur\.com).*?)">\1?<\/a>/g;
5859 const matches = html.matchAll(expression);
5960 var result = html;
6061 matches.forEach((match) => {