question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Markdown YAML header fields to notebook metadata

See original GitHub issue

I would like to add custom fields to the Markdown YAML header (title: and author:) and have them end up in the notebook’s "metadata": field upon conversion from Markdown to .ipynb, instead of being copied as literal YAML into a raw cell at the beginning of the notebook. Is there a way to achieve that?

I tried the following but it doesn’t seem to work:

jupytext --to notebook test.md --update-metadata '{"jupytext": {"notebook_metadata_filter":"title,author"}}'

The title: and author: YAML fields stay in the raw cell, and the notebook’s "metadata": field contains just literally what I passed to the --update-metadata option, i.e. {"jupytext": {"notebook_metadata_filter":"title,author"}}.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mwoutscommented, Apr 3, 2020

I have added a quick note about custom notebook metadata as you suggested it (and fixed the broken link). Thanks for your getting in touch!

1reaction
dlukescommented, Mar 28, 2020

D’oh! So close 😃 On the other hand, if this information makes it into the docs, I hope it will have been worth it, I think it will be useful for other people who use Jupytext with Jupyter Book.

Where do you think we should add this?

I searched the docs for ‘metadata’, so I looked here (FYI, that section has a broken link to here which should probably point here instead?) and here.

However, I think it would be most natural to put it in the Jupytext Markdown format description. There’s already an example YAML block there, so add the custom metadata to that and one or two sentences commenting on it in the main text?

And thank you for Jupytext as well as for responding so quickly!

Read more comments on GitHub >

github_iconTop Results From Across the Web

2.2 R Markdown anatomy - Bookdown
The YAML metadata (also called the YAML header) is processed in many stages of the rendering process and can influence the final document...
Read more >
9 Lesson 4: YAML Headers | R Markdown Crash Course
A YAML header contains YAML arguments, such as “title”, “author”, and “output”, demarcated by three dashes (—) on either end. 9.1 Title. The...
Read more >
The YAML Fieldguide
The YAML Fieldguide. ymlthis attempts to write common YAML for you in the right way and to document the many YAML field options...
Read more >
Pandoc User's Guide
Thus, adding an input or output format requires only adding a reader or writer. ... Note: if the source document is Markdown, a...
Read more >
Configuration - Jupytext documentation - Read the Docs
A minus sign - in front of a keyword means exclusion. Suppose you want to keep all the notebook metadata but widgets and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found