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

Add cell-id anchor for cell identification #1897

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

krassowski
Copy link
Member

Addresses #1862.

Reference implementation for jupyter/nbformat#317. Accompanies a PR for JupyterLab: jupyterlab/jupyterlab#13285.

Adds a id attribute to code and markdown cells for cells which have ID, which contains cell id prefixed with cell-id.

Code cell:

<div id="cell-id=a91264b6-ccda-4dad-ab2e-60bcc12c0066" class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
    <div class="jp-Cell-inputWrapper">
        <div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser"></div>
        <div class="jp-InputArea jp-Cell-inputArea">
            <div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[&nbsp;]:</div>
            <div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
                <div class="CodeMirror cm-s-jupyter">
                    <div class="highlight hl-ipython3">
                        <pre><span></span><span class="n">test</span></pre>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Markdown:

<div id="cell-id=0df699d1-77ea-432a-a203-fafd77e87462" class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
    <div class="jp-Cell-inputWrapper">
        <div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser"></div>
        <div class="jp-InputArea jp-Cell-inputArea">
            <div class="jp-InputPrompt jp-InputArea-prompt"></div>
            <div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
                <p>test</p>
            </div>
        </div>
    </div>
</div>

Question: why are cell tags for markdown cells in lab template applied on jp-MarkdownOutput rather than for jp-MarkdownCell, differently to code cells and classic template?

Copy link

@ndmlny-qs ndmlny-qs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants