A simple, fast and beautiful tool to convert jupyter notebook to markdown file.
I want to used markdown to display notebook in my blog. But the official nbconvert did not satisfy me. Therefore, I customized this ipynb2md
.
You can see examples here . There are three markdown file in the example directory. They are conversion results of example.ipynb
:
example_ipynb2md.md
: by ipynb2mdexample_nbconvert.md
: by nbconverteaxmple_vertopal.md
: by vertopal
Since Github can not render markdown with color, you can copy the markdown raw code, and have a look on your own markdown renderer like VSCode or directly visit here.
ipynb2md vs nbconvert --to markdown:
- Advantages:
- This does not require any third-party libraries.
- This is faster than official nbconvert.
- This looks more like the source notebook by adding more html blocks.
- Disadvantages:
- This only has one function: convert
.ipynb
to.md
- This is not convenient because you can just use it by passing the
.ipynb
file path.
- This only has one function: convert
Just copy the source code of ipynb2md.py
.
Or clone this repository to have a test of eaxmple.ipynb
.
In console:
python ipynb2md.py example/example.ipynb