RobertDober / earmark_parser

The Markdown to AST part of Earmark.
Apache License 2.0
68 stars 26 forks source link

Allow valueless attributes in html tags #106

Closed tomconroy closed 2 years ago

tomconroy commented 2 years ago

HTML allows attributes without values, in which case they're treated like so:

<input checked>

is interpreted as

<input checked="checked">

My change unfortunately breaks another test case, which wants to swallow attributes missing quotes. This will now interpret the example

<div class=my-div></div>

as

<div class="class"></div>

I couldn't find a good solution using regex, maybe you have an idea? Browsers will permissively treat this as

<div class="my-div"></div>

but HTML parsing is hard :)

(as an aside, Earmark should treat input tags as void elements)

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build ebd74b3b769340c49533879279769b323ad58a3e-PR-106


Totals Coverage Status
Change from base Build 8ec13efa55c42e43e611a029db03d2f560952198: 0.0%
Covered Lines: 792
Relevant Lines: 792

💛 - Coveralls
RobertDober commented 2 years ago

@tomconroy thx looks promising will have a look when I have time. This feature is definitely a plus, however my time is sooo limited right now, I am not sure when I can merge and release...

do you have an urgent need?

tomconroy commented 2 years ago

Not urgent. I have rolled back earmark to 1.2 because there are other regressions with the new parser (https://github.com/pragdave/earmark/issues/449)

RobertDober commented 2 years ago

#449 should go here though I guess

RobertDober commented 2 years ago

@tomconroy just looked at the code, great job, but we need to support Elixir 1.11 for ex_doc so you would need to fix the CI, if you want me to fix the CI I will provide a different branch to PR against which I will than merge and fix when I find the time.

that is because I do not have time to repair master now, sorry

Thank you for the PR again

tomconroy commented 2 years ago

Cool, my change actually breaks some tests. Please feel free to take over as I'm not sure how to best fix this with the regex parser..

RobertDober commented 2 years ago

@tomconroy ok then please PR against rel-1.4.26

RobertDober commented 2 years ago

Oh I could do that myself (why not BTW) 😄 https://github.com/RobertDober/earmark_parser/pull/107 So I close this one, thanx

RobertDober commented 2 years ago

Cool, my change actually breaks some tests. Please feel free to take over as I'm not sure how to best fix this with the regex parser..

which were incorrect by the way so I need to fix them anyway...

RobertDober commented 2 years ago

fyi https://elixirforum.com/t/earmark-elixirs-markdown-converter/25208/101