Skip to content

Instantly share code, notes, and snippets.

@RobinL
Created August 4, 2018 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinL/4d085b61ab936b09a0cba9865b3203fc to your computer and use it in GitHub Desktop.
Save RobinL/4d085b61ab936b09a0cba9865b3203fc to your computer and use it in GitHub Desktop.
<head>
<script type="module">
// Load the Observable runtime and inspector.
import { Runtime, Inspector } from "https://unpkg.com/@observablehq/notebook-runtime?module";
// Your notebook, compiled as an ES module.
import notebook from "https://api.observablehq.com/@robinl/my-test-site.js?key=a660656b583fb4c7";
let outputs = ["title", "viewof selectbox", "commentary", "chart", "table"]
var cells = document.getElementById("cells")
let outputs_divs = outputs.map(function(d) {
let new_cell = document.createElement("div")
new_cell.id = d
new_cell.className = "cell"
cells.appendChild(new_cell)
return new_cell
})
Runtime.load(notebook, (cell) => {
if (outputs.includes(cell.name)) {
var this_cell = document.getElementById(cell.name)
return {
fulfilled: (value) => {
this_cell.innerHTML = '';
this_cell.appendChild(value)
}
};
}
});
</script>
</head>
<body>
<div id="cells"></div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment