From 4d4f858a698b1276a4d5bdbb61f26c0c269f1079 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 10 Mar 2024 12:52:55 -0300 Subject: content: transformContent: let inline images link to things --- src/content/dependencies/transformContent.js | 31 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index 15c87019..654bb258 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -255,18 +255,31 @@ export default { } = node; if (node.inline) { + let content = + html.tag('img', + src && {src}, + width && {width}, + height && {height}, + style && {style}, + + pixelate && + {class: 'pixelate'}); + + if (link) { + // TODO: Would be nice to use an external link component here, + // just for the title text (ex. "YouTube (opens in new tab)") + content = + html.tag('a', + {href: link}, + {target: '_blank'}, + + content); + } + return { type: 'processed-image', inline: true, - data: - html.tag('img', - src && {src}, - width && {width}, - height && {height}, - style && {style}, - - pixelate && - {class: 'pixelate'}), + data: content, }; } -- cgit 1.3.0-6-gf8a5