notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Side-by-side contextual split, where markdown cells are linked/anchored to lines of a code in a code-cell on the side.

Open flacle opened this issue 1 year ago • 0 comments
trafficstars

Problem

Notebooks tend to get long. Screens are usually oriented in landscape mode. We often have markdown cells before code cells to explain what the code below it is doing. This makes the notebook longer.

Proposed Solution

If we can link lines in a markdown cell to pin text content to code in a separate cell shown on the side, this would reduce the notebook height. Code and contextual text/comments are now viewed side-by-side. This feature could use special symbols that are picked up in the side-by-side contextual view. These special symbols serve two purposes, (1) to not break existing functionality, and (2) to instruct the renderer which line of code is referred to from the markdown so that as we scroll in the markdown box, the "anchored" line of code also scrolls together into view. This synchronized scrolling happens when we either scroll in the code cell on the left or in the markdown cell on the right. Scrolling in the code cell, scrolls the markdown cell to the anchored/pinned text and vice versa.

Additional context

The UI idea is very similar to this comparison view of Bitbucket for code revisions, see: https://youtu.be/9K7L0QgcrO0?t=53. The split view would be an optional feature, with the anchors being optional as well. The anchoring symbol idea is similar to HTML's href anchors where we have a label anchor and an ahref that points to that label (e.g. in Python # a:somelabel and in Markdown $=somelabel).

flacle avatar Feb 26 '24 08:02 flacle