Add Markdown YAML header fields to notebook metadata
See original GitHub issueI 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:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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!
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.
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!