← All tools Observable Notebooks 2.0 export Open tool

Observable Notebooks 2.0 export

A bookmarklet that downloads the source of any Observable Notebooks 2.0 notebook as a self-contained Observable 2.0 .html file. Useful for editing with Observable Desktop.

Overview

Observable ships each notebook's source inside the page as a Next.js data payload. This bookmarklet reads that payload, reconstructs the notebook, and serializes it back into the Observable 2.0 file format — a single <notebook> document with one <script> element per cell. The result is a portable file you can version-control, edit locally, or re-import.

The output is byte-for-byte identical to what Notebook Kit's own serialize() produces, so Observable Desktop and notebooks build read it without complaint.

Everything runs client-side against the notebook you're viewing. Nothing is sent anywhere.

Install

  1. Open the tool page.
  2. Drag the Observable Notebooks 2.0 export button onto your browser's bookmarks bar (or right-click it and choose Add to bookmarks).

If dragging doesn't work in your browser, create a new bookmark by hand and paste the bookmarklet source (shown on the tool page) as its URL.

Usage

  1. Open a Notebooks 2.0 notebook on observablehq.com.
  2. Click the Observable Notebooks 2.0 export bookmarklet.
  3. A small panel appears in the top-right of the page showing the notebook title, cell count, and file size. Click:
    • Download to save the .html file (named after the notebook title), or
    • Copy to put the source on your clipboard.

Output format

The exported file is a standard Observable 2.0 notebook:

<!doctype html>
<notebook theme="air">
  <title>My notebook</title>
  <script id="1" type="module" pinned>
    display(1 + 2);
  </script>
  <script id="2" type="text/markdown">
    # Hello
  </script>
</notebook>

Cell modes are mapped to their Observable 2.0 script type (jsmodule, tstext/x-typescript, mdtext/markdown, sqlapplication/sql, and so on), and cell attributes id, pinned, hidden, database, output, and format are preserved.

Notes & limitations