text
text copied to clipboard
Newlines are not preserved from markdown but are saved to it
I noticed some odd markdown behaviour.
Opening a file that was uploaded manually with this content:
## Test
## test
This results in the newlines being removed and the markdown file being overwritten with:
## Test
## test
However if you add newlines in text they will be written to markdown again.
We keep the newlines in text as long as the editor state is preserved, but the markdown will loose them.
Reproduciton test case for markdown.spec.js that currently fails but I guess should pass:
test('newlines', () => {
expect(markdownThroughEditor('## Test\n\ntest')).toBe('## Test\n\ntest')
expect(markdownThroughEditor('## Test\n\n\n\ntest')).toBe('## Test\n\n\n\ntest')
expect(markdownThroughEditor('\n')).toBe('\n')
expect(markdownThroughEditor('')).toBe('')
})
Possibly relevant upstream context: https://github.com/markdown-it/markdown-it/issues/211