retext icon indicating copy to clipboard operation
retext copied to clipboard

Autoscale images in preview

Open tpikonen opened this issue 7 years ago • 4 comments

I sometimes use photos in my markdown notes, and since the resolutions of modern cameras are way larger than the size of my retext window, only a tiny corner of the photograph is visible in preview.

It would be nice to have the photos automatically scaled to fit the window, at least if the image is larger than the window.

This can probably be achieved with a custom style-sheet, but this would also make a good default in retext.

tpikonen avatar Oct 25 '18 14:10 tpikonen

This CSS (obviously) does the scaling, but works only in the WebKit renderer:

img{
    max-width:100%
}

tpikonen avatar Oct 25 '18 19:10 tpikonen

It would be nice if retext supported normal markdown for image sizing. However, I've noticed you can simply use the HTML img tag and specify the size that way - and it will show in the normal renderer. e.g: <img src="myimage.jpg" width=250>

BRFud avatar Apr 13 '19 12:04 BRFud

@tpikonen Since commit e29b34ae623db852 we already have img { max-width: 100%; } by default. Can you please try the latest version from master and see if it works fine for you?

@BRFud You can add custom attributes to the generated HTML tags using the attr_list extension which is enabled by default. E.g.:

![Caption](myimage.jpg){: width="200px" }

mitya57 avatar Apr 15 '19 18:04 mitya57

ReText master fixes this for the webkit renderer. The default renderer still shows huge images.

tpikonen avatar Apr 17 '19 08:04 tpikonen