Open paviad opened 1 year ago
@paviad In my opinion the desired behaviour with parseImgDimensions
set to false
shouldn't result in the following html:
<p>![my image](./pic/pic1_50.png =100pxx20px)</p>
<p>![my image2][1]</p>
<p>[1]: ./pic/pic1_50.png =100pxx20px</p>
It should rather just omit the dimensions and fill in the html with proper values while leaving the dimension attributes, like the following:
<p><img src="./pic/pic1_50.png" alt="my image" /></p>
<p><img src="./pic/pic1_50.png" alt="my image2" /></p>
Because the important point to note here is that if we're setting parseImgDimensions
to false
that means we want the image to be displayed in its original dimensions regarding of the dimensions provided in the markdown syntax.
Note, we still want the image to be displayed but, not with the dimension attributes.
And the fix you've provided here #985 (which is highly appreciated) does not let the image render rather it just puts the markdown syntax in its place which is not the desired behaviour of a markdown to html converter.
I hope you'll look into it and you'll try to come up with a different approach.
It is definitely a viable alternative to my design - I can make it so.
Problem Description
The default behavior of markdown to html is to parse image dimensions despite
options.parseImgDimensions
beingfalse
, i.e. with the default options, the following markdown is valid, and converts to the following html:The Fix
Fixing this issue requires two things in my opinion:
true
both in code and in the documentation.false
image dimensions should be rejectedDesired behavior with
parseImgDimensions
set tofalse
The above markdown should be rejected as valid image markdown and converted to the following html: