Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom notebook metadata not stored #330

Closed
IanHawke opened this issue Sep 10, 2019 · 2 comments
Closed

Custom notebook metadata not stored #330

IanHawke opened this issue Sep 10, 2019 · 2 comments
Milestone

Comments

@IanHawke
Copy link

When converting an old notebook using jupytext from the command line to an alternate format (tried md and py), any custom metadata added to the entire notebook (not to an individual cell) is not stored in the resulting text file.

I was running jupytext on the notebooks at https://github.com/IanHawke/maths-with-python to test. There's custom notebook level metadata (under the "nbconvert" group, called "title") to use in a hacky ipynb->pdf book pipeline. The pipeline probably won't be useful, but notebook-level metadata might be useful for other purposes.

@mwouts
Copy link
Owner

mwouts commented Sep 10, 2019

Hello Ian, indeed by default a filter is applied to the metadata. The use of these filters is documented here in the context of Jupyter.

But I see it's not documented in the context of the command line, I'll try to fix this at some point. Anyway, I think what you are looking for is --update-metadata '{"jupytext": {"notebook_metadata_filter":"all"}}'. See for instance:

srv002983:~$ jupytext --to md --update-metadata '{"jupytext": {"notebook_metadata_filter":"all"}}' 00-first-steps.ipynb  -o - | head -n 26
---
jupyter:
  jupytext:
    notebook_metadata_filter: all
    text_representation:
      extension: .md
      format_name: markdown
      format_version: '1.1'
      jupytext_version: 1.2.3
  kernelspec:
    display_name: Python 3
    language: python
    name: python3
  language_info:
    codemirror_mode:
      name: ipython
      version: 3
    file_extension: .py
    mimetype: text/x-python
    name: python
    nbconvert_exporter: python
    pygments_lexer: ipython3
    version: 3.4.4
  nbconvert:
    title: First Steps
---

@IanHawke
Copy link
Author

Brilliant, thanks.

@mwouts mwouts added this to the 1.2.4 milestone Sep 15, 2019
mwouts added a commit that referenced this issue Sep 15, 2019
@mwouts mwouts mentioned this issue Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants