Skip to content

Commit

Permalink
How to add notebook metadata in the YAML header
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Apr 3, 2020
1 parent f43fe85 commit 1430069
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_read_simple_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,3 +694,34 @@ def test_update_metadata_filter_2(
nb = jupytext.reads(org, 'md')
text = jupytext.writes(nb, 'md')
compare(text, target)


def test_custom_metadata(no_jupytext_version_number,
nb=new_notebook(metadata={
"author": "John Doe",
"title": "Some serious math",
"jupytext": {
"notebook_metadata_filter": "title,author"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}}),
md="""---
jupyter:
author: John Doe
jupytext:
notebook_metadata_filter: title,author
kernelspec:
display_name: Python 3
language: python
name: python3
title: Some serious math
---
"""):
"""Here we test the addition of custom metadata, cf. https://github.com/mwouts/jupytext/issues/469"""
md2 = jupytext.writes(nb, 'md')
compare(md2, md)
nb2 = jupytext.reads(md, 'md')
compare_notebooks(nb2, nb)

0 comments on commit 1430069

Please sign in to comment.