« get me outta code hell

content, replacer: match inline links, auto-provide custom label - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-09-03 16:55:19 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-09-03 16:56:06 -0300
commitc7f6383e34c30b63e0e0b86f320f42f2c9a0bdb7 (patch)
tree9fe61e6ccb8afd6c474cf667634d2c7f504247a0 /src/content/dependencies
parent0c70a112914f7eb4bea0d839d44060cb30f4f30e (diff)
content, replacer: match inline links, auto-provide custom label
Changes in matchMarkdownLinks here are refactoring only, not new
behavior.
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/transformContent.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index e9a75744..a6639acd 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -601,9 +601,12 @@ export default {
           }
 
           case 'external-link': {
-            const {label} = node.data;
             const externalLink = relations.externalLinks[externalLinkIndex++];
 
+            const label =
+              node.data.label ??
+              node.data.href.replace(/^https?:\/\//, '');
+
             if (slots.textOnly) {
               return {type: 'text', data: label};
             }