panwriter icon indicating copy to clipboard operation
panwriter copied to clipboard

Preview: image width in units other than px are not converted

Open achimwagenknecht opened this issue 3 years ago • 2 comments

The image widths don't make sense to me. They are displayed much to small. In addition, sometimes the tag is not compiled but displayed. See screenshot. test_001

achimwagenknecht avatar Sep 07 '22 14:09 achimwagenknecht

{width=…} is probably handled as an HTML attribute—as such it would always be in pixels. The generated preview is always in px width, regardless of what length unit one specifies.

One exception is using %, which seems to work rather well. Using mm as an example would only work with CSS property values (and if the output media is known). Using absolute length values isn’t recommended, although I’d like that too.

I’m unsure if this is a Panwriter preview or a Pandoc problem, though.

EDIT: Just checked. The preview generates an <img … width="100mm"> when it instead should generate <img … style="width:100mm">. A HTML parser will typically regard the former as a width of 100 px.

Moonbase59 avatar Feb 04 '23 08:02 Moonbase59

Yes, pretty sure the attribute is currently just passed through as is in the preview, unlike pandoc. This would have to be implemented in https://github.com/mb21/markdown-it-pandoc/

mb21 avatar Feb 04 '23 16:02 mb21