From 9d4b74e9423183bf7c4f785d060130d456965834 Mon Sep 17 00:00:00 2001 From: kuuuube Date: Tue, 24 Dec 2024 19:56:21 -0500 Subject: [PATCH] Set style width and height to 100% to render correctly in anki --- ext/js/display/structured-content-generator.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/js/display/structured-content-generator.js b/ext/js/display/structured-content-generator.js index 72344ec45..6cdc981bd 100644 --- a/ext/js/display/structured-content-generator.js +++ b/ext/js/display/structured-content-generator.js @@ -128,6 +128,10 @@ export class StructuredContentGenerator { image.width = width; image.height = image.width * invAspectRatio; + // Anki will not render images correctly without specifying to use 100% width and height + image.style.width = '100%'; + image.style.height = '100%'; + imageContainer.appendChild(image); if (this._contentManager instanceof DisplayContentManager) {