mixmark-io / turndown

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

fix:use content to replace code, keep the code format #348

Closed robinv8 closed 1 year ago

robinv8 commented 4 years ago

Here content should be used instead of code, but the test fails, which should be related to turndown-attendanty.

martincizek commented 3 years ago

It fails because it should fail. :)

Eventual nodes under pre > code are typically syntax highlighting that should not be converted. With the current Turndown design, the conversion is not aware of being within under a code block, so it actually is converted to content like it was a normal markup. Using textContent is a way around it and it is correct.

The only valid exception for now is <br>, as addressed in #286. So I suggest to close this in favour of #286 (which also won't be merged as is, but is closer to a correct solution).