Skip to content

Opening a previously exported notebook with markdown cells errors; renders empty markdown cells #149

@ccjoel

Description

@ccjoel

The cell source is an array of strings instead of a single string:

 {
   "cell_type": "markdown",
   "id": "23fea465-74a4-4bbd-a41c-6cf720f1b3d8",
   "metadata": {},
   "source": [
    "# Dice Rolling and Visualization with Matplotlib\n",
    "\n",
    "In this Jupyter Notebook session, a human and an AI agent collaborated on two tasks. First, the human requested the agent to roll an 18-sided dice 10 times and create a scatter plot of the results. The agent responded by writing Python code using NumPy and Matplotlib to simulate the dice rolls, generate a scatter plot, and calculate basic statistics. The code produced a visualization showing each of the 10 rolls (values 7, 15, 11, 8, 7, 11, 11, 4, 8, 3) as points on a scatter plot with a red dashed line indicating the mean value (8.50). The agent also provided additional statistics including the minimum (3) and maximum (15) values from the rolls.\n",
    "\n",
    "Following this data visualization task, the human asked the agent to tell a joke. The agent responded with a programming-related joke about a functional programmer getting thrown out of school because \"he refused to take classes\" - a play on words referencing programming paradigms. The conversation demonstrates both the agent's ability to perform data analysis tasks and engage in light conversation."
   ]
  }

We need to update beaker-ts notebook.ts file, I think, to join the array of strings when creating the markdown cell, or some similar solution.

Recording, recreated both on biome hosted instance as well as locally on both notebook interfaces:

Screen.Recording.2025-09-04.at.4.43.49.PM.mov

Reloading the page seems to reload the markdown source as a single string somehow, and then renders loaded markdown cells correctly.

Looks like uncommenting these lines would fix that, although unsure what other side-effects it would cause:

modified   beaker-ts/src/notebook.ts
@@ -299,9 +299,9 @@ export class BeakerMarkdownCell extends BeakerBaseCell implements nbformat.IMark
     constructor(content: Partial<nbformat.ICell>) {
         super({ ...content});
         Object.assign(this, content)
-        // if (Array.isArray(this.source)) {
-        //     this.source = this.source.join("");
-        // }
+        if (Array.isArray(this.source)) {
+            this.source = this.source.join("");
+        }
     }

We thought it was necessary, and possibly commented it out at some point.


Reproducing

Sample minimal notebook with 2 cells (one code, one markdown; both a list of strings):

minimal-export-issue-notebook.ipynb

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions