Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
achimwagenknecht opened this issue Sep 7, 2022 · 2 comments
Open

Comments

@achimwagenknecht
Copy link

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
Copy link

Moonbase59 commented Feb 4, 2023

{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
Copy link
Owner

mb21 commented Feb 4, 2023

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 mb21 changed the title Image width displayed wrong Preview: image width in units other than px are not converted Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants