diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-02-25 19:06:14 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-02-25 19:06:38 -0400 |
| commit | 2f5383136c4d8232204546dcd89f8cd0b02347e4 (patch) | |
| tree | 52e0a0122ae64e44623b162fb717eaf1ab62dcce /src/content/dependencies | |
| parent | 4a3b66c4adbb7c8e79114aab76bf2ff29baed04c (diff) | |
content: transformContent: custom/override link colors preview
memes
Diffstat (limited to 'src/content/dependencies')
| -rw-r--r-- | src/content/dependencies/transformContent.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index 8e902647..fa7f2e88 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -168,6 +168,7 @@ export default { // const enteredLabel = node.data.label && transformNode(node.data.label, opts); const enteredLabel = node.data.label?.data; const enteredHash = node.data.hash?.data; + const enteredColor = getArg(node, 'color')?.[0].data; data.label = enteredLabel ?? @@ -183,6 +184,7 @@ export default { : null); data.hash = enteredHash ?? null; + data.color = enteredColor ?? null; return {i: node.i, iEnd: node.iEnd, type: 'internal-link', data}; } @@ -248,6 +250,7 @@ export default { link: relation(name, arg), label: node.data.label, hash: node.data.hash, + color: node.data.color, name: arg?.name, shortName: arg?.shortName ?? arg?.nameShort, } @@ -605,7 +608,7 @@ export default { nodeFromRelations.link, {slots: ['content', 'hash']}); - const {label, hash, shortName, name} = nodeFromRelations; + const {label, hash, color, shortName, name} = nodeFromRelations; if (slots.textOnly) { if (label) { @@ -662,6 +665,10 @@ export default { absorbFollowingPunctuation(link); } + if (color) { + link.setSlot('color', color); + } + return {type: 'processed-internal-link', data: link}; } |