showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript

Home Page:http://www.showdownjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: image dimensions must be specified in CSS style attribute (option parseImgDimensions)

wintifrosch opened this issue · comments

The current implementation is broken.
To retain backwards compatibility, the showdown option should add a style attribute (CSS) instead of the height and width attributes in HTML.

Background information

  • The <img with="..." height="..."> attributes in HTML5 are not used like in the old days anymore (before css). Nowadays, the rendered dimensions should be specified in CSS. According to HTML5 spec, the attributes must contain integer values only.¹
  • Current browsers don't interpret image sizes specified in em (and other units) any more. The unit is ignored, the value is interpreted as a pixel dimension, which is really not what was intended.

image

¹ Read more in a discussion from 2016 in Stackoverflow
image