« get me outta code hell

content: transformContent: absorb punct. for image media links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-03-20 21:27:06 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-03-20 21:27:06 -0300
commit5614d6e2c42fcb350bdef04246d30e68370d1048 (patch)
tree620e28310fb37913a280b40041ba545364827d6a /src/content
parentd35b498ff059643e4686807bda25f7bab5d87ccc (diff)
content: transformContent: absorb punct. for image media links
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/transformContent.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index bdfcbeb5..34f37261 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -460,6 +460,18 @@ export default {
               link.setSlot('tooltipStyle', 'none');
             }
 
+            let doTheAbsorbyThing = false;
+
+            // TODO: This is just silly.
+            try {
+              const tag = html.resolve(link, {normalize: 'tag'});
+              doTheAbsorbyThing ||= tag.attributes.has('class', 'image-media-link');
+            } catch {}
+
+            if (doTheAbsorbyThing) {
+              absorbFollowingPunctuation(link);
+            }
+
             return {type: 'processed-internal-link', data: link};
           }