mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.04k stars 51 forks source link

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

Open achimwagenknecht opened 2 years ago

achimwagenknecht commented 2 years ago

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

Moonbase59 commented 1 year ago

{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.

mb21 commented 1 year ago

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/