Exported Code Questions

I built up a nice private notebook that has a handful of inputs and output 2 choropleth charts. I want to publish a local hard copy for colleagues so I exported the notebook. The notebook relies on 2 input files that ideally could be swapped out as needed.

So I exported the code opened a http.server from python. The first thing that is apparent is every cell is displayed (matches documentation I’ve seen somewhere). I’ve embedded public notebook before and stumbled through the examples to only display certain cells. When using exported code, it’s not as clear to me.

Here is the last bits of the exported JS file. I only basically want to display the output and output_diffs along with the inputs. I understand Observable doesn’t do much on this front, but looking for generic advice. Is this solved via another JS or HTML? Import output and output_diffs from the original JS file into a new file?

1 Like

Yes, when you look at the index.html file that comes with the download, it displays the full notebook. You can certainly embed a subset of the notebook, though. The easiest way to do so is to use the built in embed facility and then edit that code, to refer to the downloaded notebook. Here’s an example:


If you examine the code of that webpage, you’ll notice the following line:

import define from "./783e4692bacf30df@346.js?v=3";

That’s the one line that I changed from the downloaded code.

1 Like

Wow, that was really simple and helpful. I don’t know why that made it click for me. Appreciate the example very much.

1 Like