zefyr icon indicating copy to clipboard operation
zefyr copied to clipboard

1.0-dev NotusMarkdownCodec seems to add newline chars incorrectly

Open hyouuu opened this issue 5 years ago • 0 comments

Steps to Reproduce

Type this text in the ZefyrEditor:

# TestTitle
TestBody

Then call:

  String getText() {
    final converter = NotusMarkdownCodec();
    final text = converter.encode(zefyrCo.document.toDelta());
    return text;
  }

The output text is "# TestTitle\n\nTestBody\n\n", where the expected output is "# TestTitle\nTestBody" - note that:

  1. There wasn't a newline after TestBody, but the encode added it and would keep adding more newlines each time I call it, so I have to trimRight() all the time.
  2. Every existing newline is doubled, so I have to manually do text = text.replaceAll("\n\n", "\n"); all the time.

Probably an easy fix - thanks for providing this library!

hyouuu avatar Jan 15 '21 21:01 hyouuu