Description
Description
Hi there! Thank you for Jupytext and its CLI, it's been quite useful for me recently for converting Jupytext-formatted Markdown files to IPyNB format. What I am going to describe might not be the best approach to what I am trying to do, but at PyWavelets/pywt#741, I am trying to display Markdown notebooks with MyST-NB, a tool similar to nbsphinx
(#119) for a Sphinx-based documentation websites and then convert them to IPyNB format at the time of building the documentation pages, so that I can use these notebooks with JupyterLite via jupyterlite-sphinx
on a Sphinx-based webpage (because JupyterLite does not seem to support Markdown-based notebooks yet: jupyterlite/jupyterlite#731, #1225).
Essentially, I have a .md
file that gets converted to .ipynb
, then executed to bring out its outputs and rendered by MyST-NB via Sphinx. A preliminary deployment can be viewed here: https://pywavelets--741.org.readthedocs.build/en/741/regression/wavelet.html, where, upon expanding the dropdown and viewing the notebook(s) (or downloading them) this big cell at the top is revealed (and it is present because it existed in the .md
file prior to conversion to .ipynb
):
Tap to expand
```{eval-rst}
.. currentmodule:: pywt
.. dropdown:: 🧑🔬 This notebook can be executed online. Click this section to try it out! ✨
:color: success
.. notebooklite:: dwt-idwt.ipynb
:width: 100%
:height: 600px
:prompt: Open notebook
.. dropdown:: Download this notebook
:color: info
:open:
Please use the following links to download this notebook in various formats:
1. :download:`Download IPyNB (IPython Notebook) <dwt-idwt.ipynb>`
2. :download:`Download Markdown Notebook (Jupytext) <dwt-idwt.md>`
```
Proposition
I was wondering if it is possible to hide this code block in particular when I pursue this conversion, i.e., by letting Jupytext parse through the cell to find some metadata of the form
```{eval-rst}
---
tags: [ignore]
---
This cell should not be present after conversion
```
or with Markdown cells, another way could be:
+++ {"tags": ignore}
This cell should not be present after conversion
+++
that can be added to this cell (and for other cells that I want not to be parsed). This is sort of related to #220, but it is also a fundamentally different issue and possibly unique ask since I wish to ignore a particular cell entirely during conversion from one file format to another (in this case Markdown to IPyNB, while #220 is most likely talking about other formats ➡️ Markdown and its flavours).
Additional context
This is how it ends up looking like on the above link when I render the notebook with the NotebookLite directive to be able to run it inside the browser:
therefore, this is a cell that I don't wish to retain after conversion, and so my notebook can be made cleaner and improved if it starts with the relevant contents directly (in this case, the Markdown heading of the notebook) and skips adding this cell.
Any help or suggestions would be greatly appreciated—especially if the --pipe
option can be made of use or similar—thanks!