mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.93k stars 880 forks source link

Nested blank elements rendering #408

Open tuanalumi opened 2 years ago

tuanalumi commented 2 years ago

I have nested elements, say X inside Y, and both are blank:

<X>
  <Y data-name="abc"></Y>
</X>

Turndown processes both of them, and I can successfully convert Y to something meaningful (using blankReplacement). But for X, which is just a container, I am unable to use the rendered version of Y. Of course I can recursively render its children again, but it's not optimized.

Here is the link to the sandbox: https://codesandbox.io/s/optimistic-roentgen-8uq4rp?file=/src/index.js

Is there any workaround for this?