mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 03:32:40 +00:00
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.
This commit is contained in:
@@ -102,6 +102,20 @@ renderer.link = function (href, title, text) {
|
|||||||
return out;
|
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 = `<img src="${href}" alt="${text}" style="--HB_src:url(${href});"`;
|
||||||
|
if (title)
|
||||||
|
out += ` title="${title}"`;
|
||||||
|
|
||||||
|
out += '>';
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
// Disable default reflink behavior, as it steps on our variables extension
|
// Disable default reflink behavior, as it steps on our variables extension
|
||||||
tokenizer.def = function () {
|
tokenizer.def = function () {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user