Skip to content

Instantly share code, notes, and snippets.

View jonasrk's full-sized avatar

Jonas Kemper jonasrk

View GitHub Profile
myst-blogpost % jupyter nbconvert --to markdown output.ipynb
[NbConvertApp] Converting notebook output.ipynb to markdown
[NbConvertApp] Writing 99 bytes to output.md
myst-blogpost % ls
input.ipynb input.myst output.ipynb output.md
myst-blogpost % cat output.md
# My markdown document
```python
myst-blogpost % python
Python 3.9.6 (default, Jul 29 2021, 11:06:22)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nbformat
>>> import nbclient
>>> with open('input.ipynb') as ipynb_file:
... nb = nbformat.read(ipynb_file, nbformat.NO_CONVERT)
... nb_ex = nbclient.execute(nb)
...
myst-blogpost % ls
input.myst
myst-blogpost % cat input.myst
# My markdown document
```{code-cell}
print("Hello world! " * 2)
```
myst-blogpost % jupytext input.myst --to ipynb
# My markdown document
```{code-cell}
print("Hello world! " * 2)
```