New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect duplicate HTML attributes #201

Closed
winniehell opened this Issue Dec 28, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@winniehell
Contributor

winniehell commented Dec 28, 2014

Current behavior is that duplicate attributes in HTML tags overwrite previous values:

$ kramdown -ihtml -okramdown <<<'<a href="a" href="b">c</a>'
[c](b)
$ kramdown -ihtml -okramdown <<<'<img src="a" src="b" alt="c" alt="d"/>'
![d](b)

I would at least expect a warning in such a case.

@gettalong gettalong self-assigned this Dec 28, 2014

@gettalong

This comment has been minimized.

Owner

gettalong commented Dec 28, 2014

Duplicate HTML tags have to be dealt somehow and using the last found one seems to be good comprise for bad input. However, a warning really might be useful.

@winniehell

This comment has been minimized.

Contributor

winniehell commented Dec 29, 2014

I would state that a tool like kramdown may assume valid HTML when the input type is set to HTML—and duplicate attributes are not valid HTML.

Nevertheless, when processing large HTML files or a large amount of HTML files (as in my case 😉 🐠) it is very helpful to know every discomfort of the parser.

So maybe, I would label this issue rather a feature request than a bug report.

@gettalong

This comment has been minimized.

Owner

gettalong commented Feb 4, 2015

When an HTML attribute is overwritten, a warning will now be generated.

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