You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to narrow the scope of allowable HTML tags beyond just the tag name.
Impacted Rules:
MD033
Describe the Need:
I want to use rule MD033/no-inline-html, but there are genuine reasons to use some HTML Tags over plain markdown in certain cases. E.g. I only want to allow the usage of the <img> tag if that tag has a style, width or height attribute. Or, to put it another way: I do not want to allow the usage of the <img> tag if it only has attributes src and/or alt.
The reason behind this is that an <img> tag that has just a src or alt attribute can be perfectly described in plain Markdown:
<imgsrc="./picture.png" alt="a picture" />
becomes
![a picture](./picture.png)
If it has any other attribute, it cannot be converted to a Markdown tag without affecting the way it gets rendered:
And therefor I would consider this acceptable usage of the <img> tag.
The problem is that the rule only allows exceptions at the "tag" level, e.g. "allowed_elements": ["img"]. I want to be able to narrow the scope by adding exceptions to this.
Current Alternative
Set "allowed_elements": ["img"], but this will allow all<img> tags whereas I only want to allow some.
Can We Help You Implement This?:
Yes, but I'd first like to get some input if this is deemed useful.
If it is, we need to discuss how this would be configured. Some examples:
This would allow the <img> tag, but only if it contains any of "style", "width" or "height" (or any combination).
To be honest I am not sure how useful the later suggestion is since there are many other attributes that could be used on <img> tags that are not convertible to plain markdown, e.g. title, and I would want to exclude those to but then the list in allowed_attributes would have to contain all attributes except src and alt.
The text was updated successfully, but these errors were encountered:
Describe the Enhancement:
I want to be able to narrow the scope of allowable HTML tags beyond just the tag name.
Impacted Rules:
MD033
Describe the Need:
I want to use rule
MD033/no-inline-html
, but there are genuine reasons to use some HTML Tags over plain markdown in certain cases. E.g. I only want to allow the usage of the<img>
tag if that tag has astyle
,width
orheight
attribute. Or, to put it another way: I do not want to allow the usage of the<img>
tag if it only has attributessrc
and/oralt
.The reason behind this is that an
<img>
tag that has just asrc
oralt
attribute can be perfectly described in plain Markdown:becomes
If it has any other attribute, it cannot be converted to a Markdown tag without affecting the way it gets rendered:
And therefor I would consider this acceptable usage of the
<img>
tag.The problem is that the rule only allows exceptions at the "tag" level, e.g.
"allowed_elements": ["img"]
. I want to be able to narrow the scope by adding exceptions to this.Current Alternative
Set
"allowed_elements": ["img"]
, but this will allow all<img>
tags whereas I only want to allow some.Can We Help You Implement This?:
Yes, but I'd first like to get some input if this is deemed useful.
If it is, we need to discuss how this would be configured. Some examples:
Original:
Enhancement:
(sorry about the name, suggestions are welcome :-))
This would allow the
<img>
tag, except if it contains onlysrc
or onlyalt
or only bothAlternative Enhancement:
This would allow the
<img>
tag, but only if it contains any of "style", "width" or "height" (or any combination).To be honest I am not sure how useful the later suggestion is since there are many other attributes that could be used on
<img>
tags that are not convertible to plain markdown, e.g.title
, and I would want to exclude those to but then the list inallowed_attributes
would have to contain all attributes exceptsrc
andalt
.The text was updated successfully, but these errors were encountered: