Skip to content

Option parseImgDimensions is actually true by default despite doc, and also, when false still behaves as if true #984

Open
@paviad

Description

Problem Description

The default behavior of markdown to html is to parse image dimensions despite options.parseImgDimensions being false, i.e. with the default options, the following markdown is valid, and converts to the following html:

![my image](./pic/pic1_50.png =100pxx20px)

![my image2][1]

[1]: ./pic/pic1_50.png =100pxx20px
<p><img src="./pic/pic1_50.png" alt="my image" width="100px" height="20px" /></p>
<p><img src="./pic/pic1_50.png" alt="my image2" width="100px" height="20px" /></p>

The Fix

Fixing this issue requires two things in my opinion:

  1. In order to not break existing usage, the default should be changed to true both in code and in the documentation.
  2. When the option is false image dimensions should be rejected

Desired behavior with parseImgDimensions set to false

The above markdown should be rejected as valid image markdown and converted to 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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions