mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-21 13:44:42 +00:00
updated docs
This commit is contained in:
parent
ac32942ad9
commit
46674de032
1 changed files with 15 additions and 1 deletions
|
|
@ -35,7 +35,21 @@ async function imageShortcode(src, alt, sizes, type='asdf', loading="lazy", deco
|
|||
if(type=="boxed"){
|
||||
return `<div class="block"><div class="box is-inlineblock">` + Image.generateHTML(metadata, imageAttributes) + `</div></div>`;
|
||||
}
|
||||
return Image.generateHTML(metadata, imageAttributes);
|
||||
// using custom code so that we can return the highest src in img as old browsers don't auto upscale.
|
||||
let lowsrc = metadata.png[0];
|
||||
let highsrc = metadata.png[metadata.png.length - 1];
|
||||
return `<picture>
|
||||
${Object.values(metadata).map(imageFormat => {
|
||||
return ` <source type="${imageFormat[0].sourceType}" srcset="${imageFormat.map(entry => entry.srcset).join(", ")}" sizes="${sizes}">`;
|
||||
}).join("\n")}
|
||||
<img
|
||||
src="${highsrc.url}"
|
||||
width="${highsrc.width}"
|
||||
height="${highsrc.height}"
|
||||
alt="${alt}"
|
||||
loading="lazy"
|
||||
decoding="async">
|
||||
</picture>`;
|
||||
}
|
||||
|
||||
// from https://github.com/pusher/docs/blob/main/.eleventy.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue