Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
/ ipynb_notedown.vim Public archive

vim plugin for editing jupyter notebook (ipynb) files through notedown

License

Notifications You must be signed in to change notification settings

goerz/ipynb_notedown.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ipynb_notedown.vim

Vim/Neovim plugin for editing Jupyter notebook (ipynb) files through notedown.

http://www.vim.org/scripts/script.php?script_id=5506

This plugin is obsolete: use jupytext.vim instead

Installation

  1. Copy the ipynb_notedown.vim script to your vim plugin directory (e.g. $HOME/.vim/plugin). Refer to :help add-plugin, :help add-global-plugin and :help runtimepath for more details about Vim plugins.
  2. Restart Vim.

Usage

When you open a Jupyter Notebook (*.ipynb) file, it is automatically converted from json to markdown through the notedown utility. Upon saving the file, the content is converted back to the json notebook format.

The purpose of this plugin is to allow editing notebooks directly in vim. The conversion json → markdown → json is relatively lossless, although some of the restrictions of the notedown utility apply. In particular, notebook and cell metadata are lost, and consecutive markdown cells are merged into one cell.

Configuration

The following settings in your ~/.vimrc may be used to configure the plugin:

  • g:notedown_enable=1

    You may disable the automatic conversion between the notebook json format and markdown (i.e., deactivate this plugin) by setting this to 0.

  • g:notedown_code_match='all'

    Value for the --match command line option of notedown. There are known problems with using the value 'strict', but 'fenced' may be a good alternative if you need code blocks in markdown.

jupytext.vim

The jupytext utility is an alternative to notedown that has considerably less shortcomings. In particular, it guarantees the roundtrip conversion ipynb → markdown → ipynb to be lossless (metadata is preserved, consecutive markdown cells are possible). This is achieved by the markdown file containing only the notebook inputs, and the conversion back to the notebook format using the data from the original notebook file for the outputs. The jupytext.vim plugin provides similar capabilities to ipynb_notedown.vim, but using jupytext instead of notedown by default. If you still want to use notedown over jupytext, e.g. because you need cell outputs to be contained in the markdown representation, you can still use the new jupytext.vim plugin, with the following custom configuration in your ~/.vimrc:

let g:jupytext_command = 'notedown'
let g:jupytext_fmt = 'markdown'
let g:jupytext_to_ipynb_opts = '--to=notebook'

Thus, jupytext.vim supersedes the ipynb_notedown.vim entirely, and should be used instead of it.

About

vim plugin for editing jupyter notebook (ipynb) files through notedown

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published