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
Marked can handle HTML attributes without quote like <a href=https://example.com></a> in markdown doc. It should be converted into <p><a href="https://example.com"></a></p>, the same as <a href="https://example.com"></a>.
Result
Converted into broken HTML <p><a href=<a href="https://example.com>">https://example.com></a></a></p>
There is no example in which the HTML attributes exist without quotation. Therefore, this may be one of those moments of should we do this. Do we really want to begin creating the habit of not encasing attribute values in quotes? What value is there to the developer?
Allowing for non quoted attributes also could make it harder on Marked because we have to cover both use cases - quoted and non-quoted. What happens with the following case:
@UziTech: Thanks for the spec reference. I don't see any examples that actually use unquoted attributes. Having said that, I ran tests against a couple of the examples from the spec and none of them pass.
Activity
Support HTML attributes without quotes (Fix markedjs#1141)
add test to ensure markedjs#1141 was fixed
Add test to ensure markedjs#1141 was fixed
joshbruce commentedon Mar 23, 2018
Not sure I agree with this desired behavior actually; see HTML spec: https://www.w3.org/TR/html52/dom.html#elements
There is no example in which the HTML attributes exist without quotation. Therefore, this may be one of those moments of should we do this. Do we really want to begin creating the habit of not encasing attribute values in quotes? What value is there to the developer?
Allowing for non quoted attributes also could make it harder on Marked because we have to cover both use cases - quoted and non-quoted. What happens with the following case:
How do we determine what to encapsulate in quotes?
joshbruce commentedon Mar 23, 2018
Ps. Also not sure this is referenced in the CommonMark and GFM specs. If it is, please point us to the proper example.
UziTech commentedon Mar 23, 2018
From CommonMark spec:
https://spec.commonmark.org/0.28/#attribute-value
An unquoted attribute value would only be up to whitespace so your example would be encapsulated as follows:
joshbruce commentedon Mar 23, 2018
@UziTech: Thanks for the spec reference. I don't see any examples that actually use unquoted attributes. Having said that, I ran tests against a couple of the examples from the spec and none of them pass.
UziTech commentedon Mar 23, 2018
Some of them might be fixed by #1135