donpark / html2jade

Converts HTML to Jade template. Not perfect but useful enough for non-daily conversions.
MIT License
1.18k stars 157 forks source link

Non-standard self-closing tags aren't properly respected #121

Closed pipe01 closed 5 years ago

pipe01 commented 5 years ago

For example, this:

<div />
<span>First level</span>

Yields:

div
    span First level

It looks like there was a discussion over at #74, but no solution was reached. I understand it's not 100% valid HTML, but it's really useful when using SPA frameworks like Vue where you can have a custom component in HTML like <my-component />, instead of <my-component></my-component>.

donpark commented 5 years ago

As I mentioned before elsewhere, this tool does not parse HTML but walks the DOM tree built by a 3rd-party HTML parser (formerly jsdom, now jsdom-little). So this issue can only be resolved by switching to a different package but, given that html2jade is currently in maintenance mode, I think such change in behavior will impact too many users to be acceptable.

Sorry but I think your best bet is to address the issue in a fork or find another tool that meets your need.