What if... the template could determine where notebook cells were placed? #51
olivergeorge
started this conversation in
General
Replies: 1 comment
-
Hmm, maybe? Your suggestion sounds more like an embed API where you have an existing page and you want to embed cells from one or more notebooks into the page; whereas the current system is designed to build a separate page for each notebook, and where the notebook represents the bulk of the page content (rendered into the Not released yet, but we just added a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think a small change might unlock some interesting use cases.
The vite plugin gets the template, finds the main tag and adds divs for each cell.
https://github.com/observablehq/notebook-kit/blob/c60c10e3bced0091581edf08ae7c6cabeb05a436/src/vite/observable.ts#L93C1-L99C1
The change would be to check if there is an element with a matching ID already and use that if it is.
The result would be that by adding
<div id="cell-101"></div>
in the template you can specify where the cell appears in the page.I can imagine lots of other ways this could be achieved
It's also possible that this approach is only useful for simple use cases and the limitations mean isn't worth supporting (e.g. the CLI encourages one template for all notebooks).
Beta Was this translation helpful? Give feedback.
All reactions