Skip to content

SQL notebook: import/export, variables, autosave, a usable cell UI - #258

Merged
broisnees merged 1 commit into
nightlyfrom
feat/notebook-v2
Nov 15, 2026
Merged

broisnees merged 1 commit into
nightlyfrom
feat/notebook-v2

Conversation

@broisnees

Copy link
Copy Markdown
Collaborator

Makes the SQL notebook properly usable.

Files, on your computer

  • Open .sqlnb, Jupyter .ipynb (%%sql and %sql magics), Markdown (``````sql```` fences become SQL cells and the prose becomes text cells), and .sql scripts (split on `-- %%` markers, or on blank-line groups).
  • Import adds another file's cells to the current notebook.
  • Export: an HTML report (with results, light and dark, printable to PDF), Markdown with result tables, Jupyter (%%sql cells), or a SQL script (-- %% cells).
  • Autosave once the notebook has a file (a toggle in the Save menu), Save as with Mod+Shift+S, and a Recent list under Open.

Variables: write {{name}} in a query and fill it from the variables bar. Placeholders without a value show as dashed + name chips, and a cell that runs with one missing explains why instead of sending broken SQL.

Cells

  • A Jupyter-style run counter, plus rows · ms · when it ran, and the variables the query uses.
  • The editor sizes itself to the query (drag to override, double-click to fit again).
  • Shift+Enter runs and moves to the next cell (or creates one).
  • Duplicate, clear outputs, copy results as TSV. Run all (Mod+Shift+Enter) stops at the first failing cell.
  • Text cells render through a new sanitising renderer, renderSafeMarkdown in markdown-safe.js: raw HTML shows as text, only web and mail links are allowed, and images become links. Notebooks can be downloaded files, and marked.parse was rendering them unsanitised. Text cells also get list continuation and Tab indent while typing.

Tests: notebook.test.js covers variables, every import format, every export, and round-trips (10 tests). markdown-safe.test.js covers the sanitiser.

Checks: npm test 1795 passed (exit 0), design lint clean, npm run check 0 errors, npm run build passed.

🤖 Generated with Claude Code

…an work in

- Open .sqlnb, Jupyter .ipynb (%%sql magics), Markdown (```sql fences become
  cells) and .sql scripts (-- %% markers or blank-line groups); Import adds
  another file's cells to the notebook you are in.
- Export: HTML report (results included, light and dark, printable),
  Markdown with result tables, Jupyter (%%sql), SQL script (-- %% cells).
- {{name}} variables, filled from a bar under the toolbar; a placeholder
  without a value says so instead of reaching the database.
- Autosave once the notebook has a file (toggle in the Save menu), Save as
  (Mod+Shift+S), and a Recent list in Open.
- Cells: Jupyter-style run counter, rows / ms / when it ran, the variables
  a query uses, editor sized to the query (drag to override, double-click to
  fit), Shift+Enter runs and moves on, duplicate, clear outputs, Run all
  stops at the first failing cell (Mod+Shift+Enter), copy results as TSV.
- Markdown cells: rendered through the sanitising renderer (a notebook can
  be a downloaded file), list continuation and Tab indent while typing.

Converters and variables are pure functions in notebook.js with tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broisnees
broisnees merged commit b740a0f into nightly Nov 15, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant