-
Notifications
You must be signed in to change notification settings - Fork 393
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
How to specify that a code cell should be inactive in Jupyter in the Markdown format? #347
Comments
I'd be +1 on assuming that "any code blocks that aren't meant to be run should instead be rendered as markdown blocks". That seems like the most-common pattern to me. |
Good! Now, say that we are parsing a Markdown file, and we find something like
Would it be OK for you if we simply continue parsing the markdown cell (i.e. don't start a new code/markdown cell there)? Which exact pattern would you like Jupytext to look for? I'm asking as I am having second thought on using specialized markdown cells for inactive code. The initial reason for choosing raw cell is that one can switch easily between them and code cells (one keystroke), while with Markdown cells we would have to change the cell type and then manually remove the |
In my mind, it's fine not to create a new cell but to just keep it as a part of a single markdown cell, but it'd also be fine if it were easier to split off any "code-fences-in-markdown" chunks into their own separate cells. Does that clarify? |
@choldgraf , soon I will make sure that the So I think you will prefer another option to leave them as (non-executable) markdown cell. What do you think of something like def f(x)
return x+1 |
@choldgraf , the jupytext/tests/test_read_simple_markdown.py Lines 460 to 471 in d9463f6
|
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 ipython/ipython#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?
The text was updated successfully, but these errors were encountered: