From 696bcd43671089f9fb38e1434e5771e24bffda44 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 22 Aug 2024 12:46:56 -0400 Subject: [PATCH] Expose src url in --HB_src Decided to do this for *all* images, not just those being injected. In case someone wants to automatically apply wrapping to images inside a stat block, etc. --- shared/naturalcrit/markdown.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index be2f56af9..3be8108e4 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -102,6 +102,20 @@ renderer.link = function (href, title, text) { return out; }; +// Expose `src` attribute as `--HB_src` to make the URL accessible via CSS +renderer.image = function (href, title, text) { + href = cleanUrl(href); + if (href === null) + return text; + + let out = `