How to specify that a code cell should be inactive in Jupyter in the Markdown format?
See original GitHub issueThis 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:
- Created 4 years ago
- Comments:5 (5 by maintainers)
@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:@choldgraf , the
.noeval
attribute has reached master:https://github.com/mwouts/jupytext/blob/d9463f6aa5c751c7953073add969d57744f5bb5f/tests/test_read_simple_markdown.py#L460-L471