question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to specify that a code cell should be inactive in Jupyter in the Markdown format?

See original GitHub issue

This is a follow-up on an earlier discussion with @choldgraf at #321.

The only way, currently, to have a code cell inactive in Jupyter, is to escape it with Markdown region markers (<!-- #region --> and <!-- #endregion -->).

It would be more user-friendly to offer a active-md tag or metadata to let Jupytext/Jupyter know that a given code chunk should not be executed in Jupyter.

The subject of inactive cells in Jupyter was discussed at https://github.com/ipython/ipython/issues/2125, but inactive cells were finally not coded in base Jupyter (only, in Jupyter notebook, the runtools extension allows to mark some code cells as inactive).

In Jupytext, inactive cells for the other formats are currently mapped to Raw cells, but maybe we should reconsider that (that representation is not compatible with nbconvert and will break #321). Should we map them to a Markdown cell instead? Is this easier to do than to implement an ‘inactive’ cell functionalilty in the Jupytext extensions for Jupyter Notebook/Jupyter Lab, and also in Jupyter Book?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mwoutscommented, Oct 18, 2019

@choldgraf , soon I will make sure that the active-md tag works for code extracts in Markdown files. But these cells will appear as raw cells in Jupyter (sorry that’s not great regarding nbconvert compatibility - that’s for consistency with the other formats).

So I think you will prefer another option to leave them as (non-executable) markdown cell. What do you think of something like ```python .noeval? Or any other name at your convenience? The .noeval attribute seems to cause no issue with GitHub:

def f(x)
    return x+1
Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown Cells — Jupyter Notebook 6.5.2 documentation
Markdown Cells . Text can be added to Jupyter Notebooks using Markdown cells. You can change the cell type to Markdown by using...
Read more >
The Ultimate Markdown Guide (for Jupyter Notebook) - Medium
Markdown Cells allows you to write and render Markdown syntax. Here's where you can explain and document the processes. On the other hand,...
Read more >
Code and Markdown Cells in Jupyter Notebook - Earth Lab
Create New Cells​​ Cell type options include Code, Markdown, Raw NBConvert (for text to remain unmodified by nbconvert), and Heading. You can ......
Read more >
Quick Guide: How to Write Markdown in Jupyter Notebooks
Markdown is a way to format text. By default, Jupyter notebooks cells are formatted to display code, so without markdown, there is no...
Read more >
Chapter 11 Combining code and text with Jupyter | Data Science
To edit a Markdown cell in Jupyter, you need to double click on the cell. Once you do this, the unformatted (or unrendered)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found