Open a marimo notebook to a specific cell
Description
You should be able to open a notebook to a specific cell with a url.
Suggested solution
I guess this would have to work by adding some kind of id to the @app.cell decorator that should be unique. That could get incorporated into a div or something in the browser for that cell. I also guess there would have to be some javascript to move the browser to the desired id from a url.
Then a url like http://localhost:2718/?id=some-uuid would open to that cell.
Alternative
No response
Additional context
No response
EDIT: sorry, had the original request backwards.
You could create your own div with the <div id="target"/> and go to http://localhost:2718/#target. markdown titles/subtitles will automatically create id's that are the kebab-case name.
like this: http://localhost:2718/#target?
where would you but that in a code cell?
The feature I want is what Google Colab has, where each cell has an automatic, unique uuid, and you can get it by clicking on a little link icon. They end up looking like this:
https://colab.research.google.com/drive/some-colab-id#scrollTo=MESyCt0V7jDY
and you click on it and it goes right there.
The id information is technically already on page if you view source (e.g. id=cell-Hbol should be on the first div)
Alternatively, you can use markdown mode
# my heading
Will produce an id=my-heading that you can use
+1 to @dmadisetti
But also realizing now that since its all client-rendered and the ids may not exist on load, the browser likely won't scroll to it. We can do something similar to Colab and wait until the page loads to then scroll to the element
We can support:
- markdown headers
- custom
- cell names (if you name a cell, we can automatically add an id target for it). cell ids are based on order so won't be good for the url
We would also like to have this feature.
An additional thing which would be useful is being able to follow a link to get both to a specific cell, and also have the selectors pre-filled with the same values. Then sharing charts that a user has generated will be seamless
@jp-gr, for your second comment. You can bind your state to the query params using mo.query_params(). Is that enough or is there more deep linking you were looking for?
That looks like it would be mostly sufficient for our use case, at the moment we don't have particularly complex front ends on our reports, mostly just a few selectors and then we output a tonne of charts and just scroll through them.
The main use case I had in mind was for pre-selecting a specific tab in marimo.ui.tabs but I imagine we can just bind query_params to that and get the same effect.