boltex / leojs

Leo Literate Editor with Outline in Typescript
https://boltex.github.io/leojs/
MIT License
28 stars 1 forks source link

Markdown writer adds an extra newline after each body written to file #64

Closed boltex closed 9 months ago

boltex commented 9 months ago

The markdown writer (for @auto nodes) adds an extra newline after each body content when writing files.

@edreamleo Note: Leo does it but only on nodes with are non-terminal nodes. (is it a bug also?)

Easily reproduce with this command to clone a minimal reproducible example repo:

git clone https://github.com/boltex/test-markdown.git

And then reproduce with ctrl+shift+w to re-write the markdown file and see the diff it creates.

edreamleo commented 9 months ago

On Mon, Dec 11, 2023 at 11:13 PM Felix @.***> wrote:

The markdown writer (for @auto https://github.com/auto nodes) adds an extra newline after each body content when writing files.

@edreamleo https://github.com/edreamleo Note: Leo does it but only on nodes with are non-terminal nodes. (is it a bug also?)

Easily reproduce with this command to clone a minimal reproducible example repo:

git clone https://github.com/boltex/test-markdown.git

And then reproduce with ctrl+shift+w to re-write the markdown file and see the diff it creates.

Iirc, this behavior is on purpose. Markdown requires a blank line after section names.

Perhaps the writer should only write extra blank lines if necessary, but I wouldn't assume that doing so would be an improvement.

Edward