nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.21k stars 1.76k forks source link

<br> tag added by WYSIWYG produces markdown that does not render correctly #2586

Open blikblum opened 2 years ago

blikblum commented 2 years ago

Describe the bug

When a br tag is present followed by a text with a link, the link is not rendered as html when parsed by marked and dingus (commonmark spec parser) This occurs when using TUI Editor in WYSIWYG mode

To Reproduce

Steps to reproduce the behavior:

  1. Start editor in WYSIWYG
  2. Add two or more new lines
  3. Add a text followed by a link
  4. Use getMarkdown api
# Hello

Text

<br>
Hello [link](https://marked.js.org/) 

Dingus: https://spec.commonmark.org/dingus/?text=%23%20Hello%0A%0AText%0A%0A%3Cbr%3E%0AHello%20%5Blink%5D(https%3A%2F%2Fmarked.js.org%2F)%20%0A%0A

Marked: https://marked.js.org/demo/?text=%23%20Hello%0A%0AText%0A%0A%3Cbr%3E%0AHello%20%5Blink%5D(https%3A%2F%2Fmarked.js.org%2F)%20%0A&options=%7B%0A%20%0A%7D&version=master

Expected behavior

The produced markdown should be rendered by spec compliant parsers like marked and dingus

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

Adding a new line after br tag, fixes the issue:

https://spec.commonmark.org/dingus/?text=%23%20Hello%0A%0AText%0A%0A%3Cbr%3E%0A%0AHello%20%5Blink%5D(https%3A%2F%2Fmarked.js.org%2F)%20%0A%0A

ethanfann commented 1 year ago

Same thing happens with <br> followed by a header, and the header won't be correctly rendered.

Example:

<br>
# This WILL NOT WORK