async function cacheWrite(notebookId) {
const allCells = $(".observablehq")
const boundaryCell = allCells.filter(function() {return $(this).text() === "Implementation"}).first()
const boundary = allCells.index(boundaryCell)
const titleCell = allCells.eq(0)
const cells = allCells.slice(1, boundary)
const heights = cells.map(function() { return $(this).height() }).get()
const contentHeight = heights.reduce((a,c)=>a+c)
const elts = cells.map(function() { return this.innerHTML }).get()
const rendered = {
title: titleCell.text(),
contentHeight: contentHeight,
elements: elts,
heights: heights
}
db.collection("html-cache").doc(notebookId).set({
title: rendered.title,
contentHeight: rendered.contentHeight,
elements: rendered.elements,
heights: rendered.heights
})
}