tui.editor icon indicating copy to clipboard operation
tui.editor copied to clipboard

<br> tag is added to markdown when adding multiple new lines in WYSIWYG mode

Open eloise-mcintyre opened this issue 4 years ago • 4 comments

Describe the bug

If you add more than 1 new line, and then check the markdown using getMarkdown, you can see that a <br> tag has been added to the markdown instead of just a new line \n

To Reproduce

Steps to reproduce the behavior:

  1. In WYSIWYG mode, add a couple new lines in the editor
  2. check the markdown using getMarkdwon
  3. you will see <br> within the markdown - which prevents this value from being used in any other application, since only the markdown will be rendered properly, not the break tags

Expected behaviour

You shouldn't ever get <br> tags, or any html tags for that matter, as the markdown value

Screenshots

In this example, there is 2 new lines, followed by a hello Screen Shot 2022-03-28 at 4 57 57 PM

The resulting markdown, using getMarkdown, is Screen Shot 2022-03-28 at 4 57 52 PM

Desktop (please complete the following information):

  • Mac OS
  • Chrome
  • Version 96.0.4664.55

eloise-mcintyre avatar Mar 28 '22 04:03 eloise-mcintyre

@eloise-mcintyre Thank you for the issue. I'll check it. but we have to check the markdown spec and our history.

jwlee1108 avatar Mar 30 '22 01:03 jwlee1108

@eloise-mcintyre

This is our specific spec. because we have two types of the editor (WYSIWYG and markdown). Markdown doesn't support more than one empty line (newline). But that's possible in WYSIWYG. So we are supplementing this with <br> tags.

jwlee1108 avatar Mar 30 '22 03:03 jwlee1108

@jwlee1108 Could you maybe add a setting for that? We do not want <br> in our output. When the user adds multiple newlines in markdown mode, they will also get stripped, so this would be more consistent.

Malaber avatar Aug 10 '22 12:08 Malaber

@eloise-mcintyre

This is our specific spec. because we have two types of the editor (WYSIWYG and markdown). Markdown doesn't support more than one empty line (newline). But that's possible in WYSIWYG. So we are supplementing this with <br> tags.

why? even github doen't support that. i mean many sites (for example Trello or Jira) replace new line with something specific and not show it in preview rendermode how we should explain to user about first inline is looks right but second same inline now is <br> ? It is not userfriendly at all =( Propably you could do it as settings and we do hiding or replacing with another specific symbol

all inlines in github comments saves as same symbol, not <br>

lmiol avatar Feb 14 '24 15:02 lmiol