jupyter / jupyter/notebook

Consider adding option to remove extra newlines created during cell merge

Open
#884 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

Merging cells in recent versions of Jupyter causes extra newlines to be inserted between the code in each cell. I don't think this was always the behavior, and find myself having to manually remove the extra spacing after every merge.

I cannot find the part of the code that is causing this behavior. I thought that it was lines 1612 and 1616 in the `Notebook.prototype.merge_cells` function of [notebook/notebook/static/notebook/js/notebook.js](https://github.com/jupyter/notebook/blob/71c5057ae525f8a21b099c31bc6178046bbc5d5d/notebook/static/notebook/js/notebook.js#L1612-L1616), but when I modified this in my local copy to remove the two newline characters from the join, it didn't seem to have any effect.

I'm not asking that it be hard-coded one way or the other, but instead that it could be configurable in a ~/.jupyter configuration file so that people could set whichever behavior they prefer.

Thanks.

Contributor guide

Open the contributing guide

Research direction

Read notebook/notebook/static/notebook/js/notebook.js and trace the Notebook.prototype.merge_cells entry point to determine where the extra newlines are introduced. Check how the proposed ~/.jupyter configuration could control that behavior; done means users can choose whether merged cells include the extra spacing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jupyter-notebook
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.