All Projects → aaren → Notedown

aaren / Notedown

Licence: bsd-2-clause
Markdown <=> IPython Notebook

Projects that are alternatives of or similar to Notedown

Nbstripout
strip output from Jupyter and IPython notebooks
Stars: ✭ 738 (-2.51%)
Mutual labels:  jupyter-notebook
Causal inference python code
Python code for part 2 of the book Causal Inference: What If, by Miguel Hernán and James Robins
Stars: ✭ 748 (-1.19%)
Mutual labels:  jupyter-notebook
Graphneuralnetwork
《深入浅出图神经网络:GNN原理解析》配套代码
Stars: ✭ 754 (-0.4%)
Mutual labels:  jupyter-notebook
Neural Processes
This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CNPs), Neural Processes (NPs), Attentive Neural Processes (ANPs).
Stars: ✭ 744 (-1.72%)
Mutual labels:  jupyter-notebook
Gans In Action
Companion repository to GANs in Action: Deep learning with Generative Adversarial Networks
Stars: ✭ 748 (-1.19%)
Mutual labels:  jupyter-notebook
Notes Machine Learning
鉴于我没有时间继续写这个东西,这个项目暂时废止
Stars: ✭ 750 (-0.92%)
Mutual labels:  jupyter-notebook
Essentialmath
Stars: ✭ 735 (-2.91%)
Mutual labels:  jupyter-notebook
Deep Learning Coursera
Deep Learning Specialization by Andrew Ng on Coursera.
Stars: ✭ 6,615 (+773.84%)
Mutual labels:  jupyter-notebook
Deeprl Tutorials
Contains high quality implementations of Deep Reinforcement Learning algorithms written in PyTorch
Stars: ✭ 748 (-1.19%)
Mutual labels:  jupyter-notebook
Machine learning refined
Notes, examples, and Python demos for the textbook "Machine Learning Refined" (published by Cambridge University Press).
Stars: ✭ 750 (-0.92%)
Mutual labels:  jupyter-notebook
Mememoji
A facial expression classification system that recognizes 6 basic emotions: happy, sad, surprise, fear, anger and neutral.
Stars: ✭ 743 (-1.85%)
Mutual labels:  jupyter-notebook
Dat4
General Assembly's Data Science course in Washington, DC
Stars: ✭ 748 (-1.19%)
Mutual labels:  jupyter-notebook
Learning From Data
记录Learning from data一书中的习题解答
Stars: ✭ 751 (-0.79%)
Mutual labels:  jupyter-notebook
Getting Things Done With Pytorch
Jupyter Notebook tutorials on solving real-world problems with Machine Learning & Deep Learning using PyTorch. Topics: Face detection with Detectron 2, Time Series anomaly detection with LSTM Autoencoders, Object Detection with YOLO v5, Build your first Neural Network, Time Series forecasting for Coronavirus daily cases, Sentiment Analysis with BERT.
Stars: ✭ 738 (-2.51%)
Mutual labels:  jupyter-notebook
Automatic Watermark Detection
Project for Digital Image Processing
Stars: ✭ 754 (-0.4%)
Mutual labels:  jupyter-notebook
Sgx Full Orderbook Tick Data Trading Strategy
Providing the solutions for high-frequency trading (HFT) strategies using data science approaches (Machine Learning) on Full Orderbook Tick Data.
Stars: ✭ 733 (-3.17%)
Mutual labels:  jupyter-notebook
Finetune alexnet with tensorflow
Code for finetuning AlexNet in TensorFlow >= 1.2rc0
Stars: ✭ 748 (-1.19%)
Mutual labels:  jupyter-notebook
Entity Embedding Rossmann
Stars: ✭ 758 (+0.13%)
Mutual labels:  jupyter-notebook
Jupyterhub
Multi-user server for Jupyter notebooks
Stars: ✭ 6,488 (+757.07%)
Mutual labels:  jupyter-notebook
Simclr
PyTorch implementation of SimCLR: A Simple Framework for Contrastive Learning of Visual Representations
Stars: ✭ 750 (-0.92%)
Mutual labels:  jupyter-notebook

Python 2/3 and IPython 4 / Jupyter compatible!

Convert IPython Notebooks to markdown (and back)

notedown is a simple tool to create IPython notebooks from markdown (and r-markdown).

notedown separates your markdown into code and not code. Code blocks (fenced or indented) go into input cells, everything else goes into markdown cells.

Usage:

notedown input.md > output.ipynb

Installation:

pip install notedown

or the latest on github:

pip install https://github.com/aaren/notedown/tarball/master

Conversion to markdown

Convert a notebook into markdown, stripping all outputs:

notedown input.ipynb --to markdown --strip > output.md

Convert a notebook into markdown, with output JSON intact:

notedown input.ipynb --to markdown > output_with_outputs.md

The outputs are placed as JSON in a code-block immediately after the corresponding input code-block. notedown understands this convention as well, so it is possible to convert this markdown-with-json back into a notebook.

This means it is possible to edit markdown, convert to notebook, play around a bit and convert back to markdown.

NB: currently, notebook and cell metadata is not preserved in the conversion.

Strip the output cells from markdown:

notedown with_output_cells.md --to markdown --strip > no_output_cells.md

Running an IPython Notebook

notedown notebook.md --run > executed_notebook.ipynb

Editing in the browser (new!)

You can configure IPython / Jupyter to seamlessly use markdown as its storage format. Add the following to your config file:

c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager'

Now you can edit your markdown files in the browser, execute code, create plots - all stored in markdown!

For Jupyter, your config file is jupyter_notebook_config.py in ~/.jupyter. For IPython your config is ipython_notebook_config.py in your ipython profile (probably ~/.ipython/profile_default):

Editing in vim

There is a vim plugin that allows editing notebooks (ipynb files) directly in vim. They will be automatically converted to markdown on opening the file, and converted back to the original json format on writing.

R-markdown

You can use notedown to convert r-markdown as well. We just need to tell notedown to use knitr to convert the r-markdown. This requires that you have R installed with knitr.

Convert r-markdown into markdown:

notedown input.Rmd --to markdown --knit > output.md

Convert r-markdown into an IPython notebook:

notedown input.Rmd --knit > output.ipynb
  • --rmagic will add %load_ext rpy2.ipython at the start of the notebook, allowing you to execute code cells using the rmagic extension (requires rpy2). notedown does the appropriate %R cell magic automatically.

Magic

Fenced code blocks annotated with a language other than python are read into cells using IPython's %% cell magic.

You can disable this with --nomagic.

  • --pre lets you add arbitrary code to the start of the notebook. e.g. notedown file.md --pre '%matplotlib inline' 'import numpy as np'

How do I put a literal code block in my markdown?

By using the --match argument. notedown defaults to converting all code-blocks into code-cells. This behaviour can be changed by giving a different argument to --match:

  • --match=all: convert all code blocks (the default)

  • --match=fenced: only convert fenced code blocks

  • --match=language: only convert fenced code blocks with 'language' as the syntax specifier (or any member of the block attributes)

  • --match=strict: only convert code blocks with Pandoc style attributes containing 'python' and 'input' as classes. i.e. code blocks must look like

      ```{.python .input}
      code
      ```
    

This isn't very interactive!

Try editing the markdown in the IPython Notebook using the NotedownContentsManager (see above).

You can get an interactive ipython session in vim by using vim-ipython, which allows you to connect to a running ipython kernel. You can send code from vim to ipython and get code completion from the running kernel. Try it!

Where's my syntax highlighting?!

Try using either vim-markdown or vim-pandoc. Both are clever enough to highlight code in markdown.

Rendering outputs in markdown

This is experimental!

Convert a notebook into markdown, rendering cell outputs as native markdown elements:

notedown input.ipynb --render

This means that e.g. png outputs become ![](data-uri) images and that text is placed in the document.

Of course, you can use this in conjuntion with runipy to produce markdown-with-code-and-figures from markdown-with-code:

notedown input.md --run --render > output.md

Not a notebook in sight!

The --render flag forces the output format to markdown.

TODO

  • [x] Python 3 support
  • [x] unicode support
  • [x] IPython 3 support
  • [x] IPython 4 (Jupyter) support
  • [ ] Allow kernel specification
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].