How to expose cell as text similar to raw.githubusercontent ?

Hi all,

I have a config file that I would like to edit in observablehq and make available (say as json) to a regular web page (not another notebook) similar to what raw.githubusercontent does.

The config notebook would have 2 cells: the first containing an object, the second JSON.stringify(first cell).

  • Is it possible ?
  • Alternatively, is there a way to commit the second cell to github directly (and simply) from observablehq (I login with my github ID) ?

Any thought on this use case, or better ideas ?

Hi @oscar6echo.

One option would be to click Download JSON next to your object cell, and then upload the resulting file to GitHub (or GitHub Gist) for hosting.

Another option would be to use our embed API to compute the live value from your notebook directly in your application. That would look something like this:

import {Runtime, Inspector} from "";
import define from "";

const main = new Runtime().module(define);

  ({message}) => console.log(message),
  error => console.error(error)

Here’s a live example:


Ok ! This embed API is powerful !!
Thx a lot @mbostock and team , not just for the tip, but for builing observablehq in such a flexible, composable way :clap:

For reference, some remarks I made myself:

  • For the embed API to work a notebook has to be ‘shared’ not necessarily ‘published’. A published notebook’s url contains its title (first cell markdown #mytitle). A shared notebook’s url contains a sequence after d/. Presumably ‘shared’ notebooks are not searchable, as opposed to ‘published’ notebooks.
  • No cors issue as returns header access-control-allow-origin: *
  • A cell is evaluated at each request to so that dynamic values e.g. new Date() are updated

And a suggestion:

  • Apparently the embed API will not pass urlParams - for example I tried Such arguably small feature would add EVEN MORE flexibility. What do you think ?

@oscar6echo, even better than url params, you can actually redefine cell values live, even do so multiple times for the same embed! Try module.redefine("cellName", newValue), you can find more info in

@thomasballinger Yes. And even simpler, instead of urlParams, I can just import a function config(params) which returns the appropriate config. In the notebook params are urlParams. Via the embed API I pass the params directy to function config.

So on second thought, I drop my suggestion.