mixmark-io / turndown

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

support code blocks in lists #472

Open za3k opened 1 month ago

za3k commented 1 month ago
<ul>
  <li>strikethrough (~) <pre>hello</pre></li>
  <li>tables (|, |---|)</li>
  <li>task list (- [ ] or - [x])</li>
</ul>

Should convert to:

*   strikethrough (~)
hello
```
*   strikethrough (~)

    ```hello```

*   tables (|, |---|)
*   task list (- \[ \] or - \[x\])

or

*   strikethrough (~)

        hello

*   tables (|, |---|)
*   task list (- \[ \] or - \[x\])

Depending on codeBlockStyle.

Currently, it converts instead to:

*   strikethrough (~)

    hello

*   tables (|, |---|)
*   task list (- \[ \] or - \[x\])
za3k commented 1 month ago

OK, turns out the issue here is that it's a <pre></pre> block rather than a <pre><code></code></pre> block. I'd still like it to work but unsure if it should be moved into a plugin.