Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fennifith/markdowntojupyter
NodeJS script to execute & convert code blocks in markdown files to a JupyterLab Notebook.
https://github.com/fennifith/markdowntojupyter
cli jupyter jupyter-notebook nodejs
Last synced: 12 days ago
JSON representation
NodeJS script to execute & convert code blocks in markdown files to a JupyterLab Notebook.
- Host: GitHub
- URL: https://github.com/fennifith/markdowntojupyter
- Owner: fennifith
- License: mit
- Created: 2018-09-05T16:41:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-12T15:22:54.000Z (about 6 years ago)
- Last Synced: 2024-11-02T06:09:26.624Z (15 days ago)
- Topics: cli, jupyter, jupyter-notebook, nodejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/mtjc
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The Markdown to Jupyter Conversion tool (MTJC) is a fairly simple script that converts a markdown file with code blocks to the JSON format used by [Jupyter](https://jupyter.org/) to create [Notebooks](https://jupyter-notebook.readthedocs.io/en/stable/).
MTJC separates the provided markdown file into "cells", looking for headers and code blocks to split the content at. Each header and any following text, list, or whatever will be placed in the same block until either another header or a code block ("```") is encountered.
When a code block is encountered, it writes the code to a file in .temp (relative to the folder it is run in), passes it to the relevant program to run, and stores the result.
For demonstration purposes, here is a sample [markdown file](./test-python.md) and the [notebook](./test-python.ipynb) output from the program as a result.
## Limitations
- Currently, this script can only process Python. I plan to change this, but as I have no use for any of the other possible languages myself, it is not high on my agenda.
- This script assumes that all output from a Python script will be sent to stdout. It is not currently capable of processing image data such as the charts and graphs that Jupyter Notebooks are capable of displaying.
- Code blocks are run individually. A variable set in one will not carry over to another. See issue [#3](https://jfenn.me/redirects/?t=github&d=MarkdownToJupyter/issues/3) for progress.## Installation
Assuming that you have already installed [npm](https://www.npmjs.com/), in the command line, type either one of the following:
### NPM
```bash
npm install -g mtjc
```### From Source
```bash
git clone https://github.com/TheAndroidMaster/MarkdownToJupyter
cd MarkdownToJupyter
npm install
```## Usage
```
mtjc
```Or, to specify a path for the output file...
```
mtjc
```