Convert Markdown files to Jupyter notebooks with a single Markdown block
Project description
md2nb - Converting Markdown Files to Jupyter Notebook
Created by Qin Yu, Nov 2020 - Dec 2020
Table of Contents
Manifesto
Taking notes using Markdown makes it easier for sharing on GitHub, but GitHub doesn't display Latex-style mathematics in .md files. A good workaround is to write Markdown in Jupyter notebooks and share the .ipynb files on GitHub, since everything inside is usually rendered properly. However, it is easier to take notes on a local text editor such as VSCode with Markdown support, becuase it automatically generates and updates the table of content, and you don't have to run a notebook server to take notes.
This package is quite simple, all it does it to create a Jupyter notebook and paste the content of one file into a Markdown block in this notebook. But the author decided to make it a package because of the encouraging talk by Mark Smith at EuroPython 2019.
Installation
$ # install using:
$ python -m pip install md2nb
$
$ # to verify installation and show help:
$ md2nb
Usage
As the simplest example, in the root directory of this repo, this will convert all .md files to .ipynb files (if there is no .m2n file found in the specified directories):
$ md2nb --dir .
Converting '.md' files within ./:
./README.md
But if .m2n files are found in the specified directories, e.g. here in the ./test/ folder, then only .m2n files are converted. This is because you may only want to convert some Markdown files to Jupyter notebooks, and you can mark these files by making their extension .m2n:
$ md2nb --dir ./test
Converting '.m2n' files within ./test/:
./test/example.m2n
./test/example-gB18030.m2n
In short, use md2nb PATH_TO_FILE1 PATH_TO_FILE2, or md2nb --dir PATH_TO_DIRECTORY1 PATH_TO_DIRECTORY2. There are two recommended ways of using md2nb:
md2nbconverts all files with--extspecified extensions in the--dirspecified directories into.ipynbfiles with a single Markdown block. For example:# to convert all Markdown and text files in the current directory and all of its subdirectories $ md2nb --dir . -r --ext .md .txt
md2nbconverts all files identified by their file paths. For example:# to convert all Markdown files in the current directory and all of its subdirectories $ md2nb *.md -r
- In fact, these two ways can be combined. For example:
# to convert README, LICENSE, all .md and .txt files in . and ./doc/ $ md2nb README.md LICENSE --dir . test --ext .md .txt
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md2nb-0.2.0.tar.gz.
File metadata
- Download URL: md2nb-0.2.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e480925d0b819245e526cbcc7820b8c0f332f6a871c7fef89748b18b8d88b203
|
|
| MD5 |
f8a99945f8e7bdf82d50fda660ad24f3
|
|
| BLAKE2b-256 |
36e40b04c1c9dd4f8108a539250a63016d8c837b566ad428b85496b931da8dd4
|
File details
Details for the file md2nb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: md2nb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef86936c3bb7cef50e800cec1843c10ae6a42fec01b972a4fc8c40b0f67eb632
|
|
| MD5 |
9c77402369ea46c3e679019f5b86a81b
|
|
| BLAKE2b-256 |
c28ef5402ae0e32103850e6129c9b1f67714ef765eab58e0b6bf7038a6948df0
|