Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 New Lines Between Markdown Get Parsed Into Separate Markdown Cells #733

Open
jlewi opened this issue Jan 25, 2025 · 1 comment
Open

2 New Lines Between Markdown Get Parsed Into Separate Markdown Cells #733

jlewi opened this issue Jan 25, 2025 · 1 comment
Assignees

Comments

@jlewi
Copy link
Contributor

jlewi commented Jan 25, 2025

Attached is a very simple markdown file which just contains 3 lines so 2 new lines between each line. Here's the contents with newlines escaped

'This is line 1\n\nThis is line 2\n\nThis is line 3\n\nAll of these lines were entered in the same markdown cell\n\n\n* Out list \n  * inner\n  * inner2\n\n* out list 2'

So we can see that \n\n is used to separate the lines. When this is rendered as a notebook the "\n\n" will be interpreted as a "cell break" and each line will end up being rendered as a separate cell.

I would much prefer to have contiguous blocks of markdown rendered as a single markdown cell. Rendering each line as a separate markdown cell really hurts readability as a result of excessive whitespace.

I also means that how my document is rendered changes from when I author it to when I reload it. When I first author the doc I will create a single markdown cell with multiple paragraphs in a single cell. Then I will save and reopen it. Now I will see multiple cells.

test_splitting.md

@sourishkrout
Copy link
Member

Understood. Runme's parser is a bit too stubbornly following the Commonmark standard here, where two line breaks will result in a new AST node. I'm pretty sure we should be able to weave them back together as part of analyzing the AST. I'll look into it.

@sourishkrout sourishkrout self-assigned this Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants