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
Metadata
Release files for md2nb 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| md2nb-0.2.0.tar.gz | 4.2 kB | Without provenance | Details for md2nb-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| md2nb-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for md2nb-0.2.0-py3-none-any.whl |
Total release size: 12.0 kB
Release files / md2nb-0.2.0.tar.gz
| Download URL | md2nb-0.2.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e480925d0b819245e526cbcc7820b8c0f332f6a871c7fef89748b18b8d88b203
|
|
BLAKE2b-256 checksum How to use checksums |
36e40b04c1c9dd4f8108a539250a63016d8c837b566ad428b85496b931da8dd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / md2nb-0.2.0-py3-none-any.whl
| Download URL | md2nb-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef86936c3bb7cef50e800cec1843c10ae6a42fec01b972a4fc8c40b0f67eb632
|
|
BLAKE2b-256 checksum How to use checksums |
c28ef5402ae0e32103850e6129c9b1f67714ef765eab58e0b6bf7038a6948df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for md2nb 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.