« get me outta code hell

content: transformContent: new image attributes inline, pixelate - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-06 12:36:30 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-06 12:36:30 -0400
commitd48874a4be60d7455dd6321742102c9cfb77a9f1 (patch)
tree9a8452e6545d1e89e19c5ebf731c5a650b2be13e /src/util
parent7c70e24aa8680bb6b14d7e1fd224a091ea21b363 (diff)
content: transformContent: new image attributes inline, pixelate
Diffstat (limited to 'src/util')
-rw-r--r--src/util/replacer.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/replacer.js b/src/util/replacer.js
index 095ee060..a2df2c3f 100644
--- a/src/util/replacer.js
+++ b/src/util/replacer.js
@@ -313,6 +313,11 @@ export function postprocessImages(inputNodes) {
         }
 
         imageNode.inline = (() => {
+          // Images can force themselves to be rendered inline using a custom
+          // attribute - this style just works better for certain embeds,
+          // usually jokes or small images.
+          if (attributes.get('inline')) return true;
+
           // If we've already determined we're in the middle of a line,
           // we're inline. (Of course!)
           if (!atStartOfLine) {
@@ -344,6 +349,7 @@ export function postprocessImages(inputNodes) {
         if (attributes.get('link')) imageNode.link = attributes.get('link');
         if (attributes.get('width')) imageNode.width = parseInt(attributes.get('width'));
         if (attributes.get('height')) imageNode.height = parseInt(attributes.get('height'));
+        if (attributes.get('pixelate')) imageNode.pixelate = true;
 
         outputNodes.push(imageNode);