diff --git a/.eleventy.js b/.eleventy.js
index f3e0864..fc2122d 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -342,12 +342,46 @@ module.exports = function (eleventyConfig) {
return str && parsed.innerHTML;
});
+ function fillPictureSourceSets(src, cls, alt, meta, t) {
+ t.tagName = "picture";
+ let html = `
+
+ `
+ if (meta.webp && meta.webp[1] && meta.webp[1].url) {
+ html += ``
+ }
+ if (meta.jpeg && meta.jpeg[1] && meta.jpeg[1].url) {
+ html += ``
+ }
+ html += `
`;
+ t.innerHTML = html;
+ }
+
+
eleventyConfig.addTransform("picture", function (str) {
const parsed = parse(str);
for (const t of parsed.querySelectorAll(".cm-s-obsidian img")) {
const src = t.getAttribute("src");
if (src && src.startsWith("/") && !src.endsWith(".svg")) {
- const cls = t.classList;
+ const cls = t.classList.value;
const alt = t.getAttribute("alt");
try {
@@ -359,30 +393,7 @@ module.exports = function (eleventyConfig) {
);
if (meta) {
- t.tagName = "picture";
- t.innerHTML = `
-
-
-
-
`;
+ fillPictureSourceSets(src, cls, alt, meta, t);
}
} catch {
// Make it fault tolarent.