Skip to content

Commit

Permalink
How to filter notebook or cell metadata at the command line
Browse files Browse the repository at this point in the history
Added missing documentation #330
  • Loading branch information
mwouts committed Sep 15, 2019
1 parent e665cd2 commit 0fe2c0c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/using-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,20 @@ You may also find useful to `--pipe` the text representation of a notebook into
jupytext --sync --pipe black notebook.ipynb # read most recent version of notebook, reformat with black, save
```


Execute `jupytext --help` to access the full documentation.


## Notebook and cell metadata filters

If you want to preserve (or filter out) certain notebook or cell metadata, change the value of either `notebook_metadata_filter` or `cell_metadata_filter` with the `--update-metadata` option. For instance, if you wish to convert an `.ipynb` document to a `.md` file and preserve all the notebook metadata in that document, run

```bash
jupytext --to md --update-metadata '{"jupytext": {"notebook_metadata_filter":"all"}}' notebook.ipynb
```

Read more on the default and possible values for the metadata filters in [this section](using-server.md#metadata-filtering).


## Jupytext as a Git pre-commit hook

Jupytext is also available as a Git pre-commit hook. Use this if you want Jupytext to create and update the `.py` (or `.md`...) representation of the staged `.ipynb` notebooks. All you need is to create an executable `.git/hooks/pre-commit` file with the following content:
Expand Down

0 comments on commit 0fe2c0c

Please sign in to comment.