Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open a marimo notebook to a specific cell #3346

Open
jkitchin opened this issue Jan 4, 2025 · 4 comments
Open

Open a marimo notebook to a specific cell #3346

jkitchin opened this issue Jan 4, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@jkitchin
Copy link

jkitchin commented Jan 4, 2025

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

@jkitchin jkitchin added the enhancement New feature or request label Jan 4, 2025
@mscolnick
Copy link
Contributor

mscolnick commented Jan 4, 2025

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.

@jkitchin
Copy link
Author

jkitchin commented Jan 4, 2025

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.

@dmadisetti
Copy link
Collaborator

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

@mscolnick
Copy link
Contributor

mscolnick commented Jan 4, 2025

+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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants