🏠 back to Observable


Questions about Github and your developer practices.

  1. I saw that it was possible to download the code of the notebooks easily. Is it useful, in your opinion, to put this code on Github? For reasons of visibility, archiving, etc…

  2. Once on github, I saw that it was quite simple to visualize the notebook (e.g. Covid in France (monthly evolution)). But is it possible to visualize only some cells ? If yes, how?

Thanks for your answers and thoughts.
Nice summer to all

No opinion on the first question.

For your second question, the page you show is in fact using the same code as what is given by the “Export > Embed cells…” menu and then select all the cells and the option “Runtime with JavaScript”. If you want to limit the display to a few cells, just check them in the list, and copy the resulting code:

<div id="observablehq-url-e40664e9"></div>
<div id="observablehq-viewof-c-e40664e9"></div>
<div id="observablehq-viewof-a-e40664e9"></div>
<div id="observablehq-viewof-b-e40664e9"></div>
<p>Credit: <a href="https://observablehq.com/@neocartocnrs/covid-in-france-monthly-evolution">Covid in France (monthly evolution) by neocarto</a></p>

<script type="module">
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import define from "https://api.observablehq.com/@neocartocnrs/covid-in-france-monthly-evolution.js?v=3";
new Runtime().module(define, name => {
  if (name === "url") return new Inspector(document.querySelector("#observablehq-url-e40664e9"));
  if (name === "viewof c") return new Inspector(document.querySelector("#observablehq-viewof-c-e40664e9"));
  if (name === "viewof a") return new Inspector(document.querySelector("#observablehq-viewof-a-e40664e9"));
  if (name === "viewof b") return new Inspector(document.querySelector("#observablehq-viewof-b-e40664e9"));
  return ["urls","maps"].includes(name);

as you can see the only difference is that in “embed” the module’s url is https://api.observablehq.com/@neocartocnrs/covid-in-france-monthly-evolution.js?v=3, whereas in the downloaded code it is a local (relative) link.

Thanks Fil, your answer is perfect. It works perfectly.
Same opinion as you concerning question 1: i.e. No opinion.