How can I display images on a HiDPI display using HTML produced from Markdown such that the images are shown in high resolution. Normally, I'd create <img> tags with srcset attributes or set the width and height on each image appropriately or use media queries. However, the result of Markdown images only allow for an alt attribute. Specifically, I'm using the marked library (I have no control over this).
I do have complete control over the CSS. Is there a way, in CSS, to at least make all images 1/3rd the logical pixels wide than they have physical pixels in width? That way I could require all images referenced in Markdown to be 3x. Is it as simple as this?
img {
width: 33.33%;
}
Much better would be some way to have the browser download a different image depending on the devicePixelRatio of the device.
Using HTML is not an option. marked is used with the sanitize flag to escape any HTML. I'm hoping there's a CSS solution or some other clever mechanism.
You can consider the device width and the device pixel ratio. So we can address this problem.