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

Preserve trailing white space

Open pabzm opened this issue 5 months ago • 1 comments

Describe the bug

Currently the tui.editor removes trailing whitespace from markdown input when it's converted to HTML.

I'm building a plugin for https://github.com/roundcube/roundcubemail, in which tui.editor shall be used to compose emails. In those, some people use email signatures, which are delimited by \n-- \n from the content part of the message. The trailing blank character is relevant in this case, but tui.editor removes it.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://ui.toast.com/tui-editor
  2. Enter -- (dash dash blank) into the demo editor.
  3. Inspect the rendered HTML in the preview area using your browser's DevTools to notice that the trailing blank is removed.
  4. Notice that after switching to the WYSIWYG-tab, and then back to the Markdown-tab, the trailing blank is also removed in the markdown source.

Expected behavior

The whitespace should be preserved.

Additional context

Add any other context about the problem here.

pabzm avatar Jul 04 '25 14:07 pabzm

Trying to work around this with a custom html renderer also doesn't work, because node.literal already has the blank character stripped.

If you don't consider the current behaviour a bug I'd be interested if you have suggestions how to work around it to achieve my goal.

pabzm avatar Jul 04 '25 15:07 pabzm