From eb08810727e3a3cba6e9947869d45d92173d196d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 4 Mar 2024 09:47:02 -0400 Subject: content, css: always allow wrapping on external links from content --- src/content/dependencies/linkExternal.js | 9 +++++++++ src/content/dependencies/transformContent.js | 5 ++++- src/static/site6.css | 6 +----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/content/dependencies/linkExternal.js b/src/content/dependencies/linkExternal.js index 39a593b2..f6b47db7 100644 --- a/src/content/dependencies/linkExternal.js +++ b/src/content/dependencies/linkExternal.js @@ -24,6 +24,11 @@ export default { default: 'generic', }, + fromContent: { + type: 'boolean', + default: false, + }, + indicateExternal: { type: 'boolean', default: false, @@ -93,6 +98,10 @@ export default { } } + if (slots.fromContent) { + linkAttributes.add('class', 'from-content'); + } + if (urlIsValid && slots.indicateExternal) { linkAttributes.add('class', 'indicate-external'); diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index d409df8f..15c87019 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -347,7 +347,10 @@ export default { const {label} = node.data; const externalLink = relations.externalLinks[externalLinkIndex++]; - externalLink.setSlot('content', label); + externalLink.setSlots({ + content: label, + fromContent: true, + }); if (slots.indicateExternalLinks) { externalLink.setSlots({ diff --git a/src/static/site6.css b/src/static/site6.css index 83a066cd..e47bb1fa 100644 --- a/src/static/site6.css +++ b/src/static/site6.css @@ -468,7 +468,7 @@ a:not([href]):hover { text-decoration: none; } -.external-link { +.external-link:not(.from-content) { white-space: nowrap; } @@ -813,10 +813,6 @@ ul.image-details li { font-style: oblique; } -.commentary-entry-body .external-link { - white-space: normal; -} - .commentary-art { float: right; width: 30%; -- cgit 1.3.0-6-gf8a5