Repository navigation
Description
Description
Saving a notebook that was opened from a Jupyter file in the browser editor (verso serve) writes it to a .verso file of the same name, and replaces that file without asking if it already exists.
verso convert writes its output beside the input by default, so converting a notebook to Jupyter and later opening the copy in the browser editor is enough: pressing Save replaces the original .verso with what came back from Jupyter. Whatever Jupyter cannot keep is gone — a Mermaid cell and an HTML cell come back as raw cells, and the original is overwritten with them.
What I expected: Save writes the file that was opened (report.ipynb), or asks before replacing an existing report.verso, or offers another name.
From reading the code: NotebookPage.SaveToPathAsync changes the extension to .verso when no serializer keeps the format by default (Jupyter does not), and ServerNotebookService.SaveAsync then writes that path with File.WriteAllTextAsync, whether or not a file is there.
A related detail that makes the loss larger than it needs to be: the Jupyter writer records each cell's Verso type in metadata.verso_type, but the Jupyter reader never reads it back, so a Mermaid or HTML cell — or a cell type an extension adds — returns as a raw cell even from a file Verso wrote itself.
Steps to Reproduce
-
Save this notebook as
report.verso(no third-party extensions involved):{ "verso": "1.1", "metadata": { "title": "Report", "defaultKernel": "csharp" }, "cells": [ { "id": "6a1f0c52-0b6e-4c43-9a8a-1b7f6f0b1a01", "type": "markdown", "source": "# Quarterly report" }, { "id": "6a1f0c52-0b6e-4c43-9a8a-1b7f6f0b1a02", "type": "mermaid", "source": "graph TD\n A[Input] --> B[Output]" }, { "id": "6a1f0c52-0b6e-4c43-9a8a-1b7f6f0b1a03", "type": "html", "source": "<p><b>Summary</b> goes here.</p>" }, { "id": "6a1f0c52-0b6e-4c43-9a8a-1b7f6f0b1a04", "type": "code", "language": "csharp", "source": "var answer = 42;" } ] } -
verso convert report.verso --to ipynb— this writesreport.ipynbbeside it. -
verso serve report.ipynband open it in the browser (I opened it through/?recover=<path>; opening it from the editor's Open button goes through the same save path). -
Change nothing and press Save.
-
Look at
report.verso: its cell types weremarkdown, mermaid, html, codeand are nowmarkdown, raw, raw, code.
Error Output
No error is shown. report.verso before Save: markdown, mermaid, html, code
report.verso after Save: markdown, raw, raw, code
Component
Blazor Frontend
Frontend
Blazor (standalone)
Verso Version
1.2.2 (verso CLI 1.2.2+d2247170eeaf0914dd9bca7ad410d45bde8cf47f); the same code is on main at 4927f12
.NET Version
10.0.401 (the browser editor runs on .NET 8)
Operating System
Windows 11 Pro (10.0.26200)
Loaded Extensions
None.
Severity
Critical - data loss, crash, or security issue
Checklist
- I searched existing issues and this hasn't been reported yet
- I can reproduce this with no third-party extensions loaded
Activity
TorreyBetts commentedon Oct 1, 2026
Thanks for the write up. Converting to .verso on save is by design. The CLI parameter
--preserve-format(orverso.preserveOriginalFormatin VS Code) is the way to keep the .ipynb. With that said, after some investigation there was a few issues. Theservecommand was ignoring--preserve-formaton Save, and the Jupyter reader never readverso_typeback, which is what turned your Mermaid and HTML cells into raw cells. Both are fixed in #117, and saving now asks before it replaces an existing .verso.