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

Linking to a cell by cell ID #518

Open
krassowski opened this issue Aug 2, 2023 · 4 comments
Open

Linking to a cell by cell ID #518

krassowski opened this issue Aug 2, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@krassowski
Copy link

JupyterLab and nbconvert allow users to link to a specific cell by it's ID by using hash fragment like #cell-id=my-cell-id where my-cell-id is an example cell ID. JupyterBook nor MyST-NB does not support it yet (executablebooks/MyST-NB#310) although a pull request is open (executablebooks/MyST-NB#519).

Given that there is a new notebook parser in this repository, I wonder if it could facilitate implementation of such a feature.

Proposal

Adopt the same hash fragment scheme for HTML output as other projects.

Additional notes

It appears that support for a kind of cell IDs was implemented in #361 but using a different scheme: nb-cell-0-code (and nb-cell-0-output for output). It appears that cell index was used there instead of cell ID which would not be a stable identifier when user moves cells around. For that I would propose using #cell-index=0 format where 0 represents first cell (whether 0- or 1-based). Also, please note that in Jupyter notebooks any single cell may have multiple outputs, so cell ID cannot identify output (but barely a list of outputs).

@krassowski krassowski added the enhancement New feature or request label Aug 2, 2023
@welcome
Copy link

welcome bot commented Aug 2, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@krassowski
Copy link
Author

@rowanc1 would you be open to a pull request?

@krassowski
Copy link
Author

Just checking back here 👀

@rowanc1
Copy link
Member

rowanc1 commented Jul 17, 2024

Thanks @krassowski, always happy for a PR we can also look to your implementation in executablebooks/MyST-NB#519. The IDs are also involved in how we identify and replace outputs in thebe, and our default htmlIds do not currently allow =. We should also likely check that the IDs provided by the ipynb are not duplicated.

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

2 participants