diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-08 20:55:21 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-08-08 20:55:21 -0300 |
commit | 6645e6e8e0e58c59d1660767181bb32efbf7930a (patch) | |
tree | 0d121deede339446b32784c15ead7defe6e0ebe1 | |
parent | 08da14a19bd52b759d7844fa45fed12df79ddf75 (diff) |
content: transformContent: don't override previously set link slots
-rw-r--r-- | src/content/dependencies/transformContent.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index eed00882..9a135eef 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -370,16 +370,18 @@ export default { const {link, label, hash, toIndex} = linkNode; - return { - type: 'link', - data: - (toIndex - ? link.slots({content: label, hash}) - : link.slots({ - content: label, hash, - preferShortName: slots.preferShortLinkNames, - })), - }; + // These are removed from the typical combined slots({})-style + // because we don't want to override slots that were already set + // by something that's wrapping the linkTemplate or linkThing + // template. + if (label) link.setSlot('content', label); + if (hash) link.setSlot('hash', hash); + + if (toIndex) { + link.setSlot('preferShortName', slots.preferShortLinkNames); + } + + return {type: 'link', data: link}; } case 'tag': { |