Nbdev_2md export

I’m using nbdev_2md to convert jupyter notebooks to markdown files for a personal project like so:

nbdev_nb2md --dest tmp --jekyll=True nb_path

This works well, but it doesn’t convert all the metadata to jekyll yaml format. Specifically only some of the front matter at the top is converted to the markdown yaml front matter, and all the bools are ignored.

For example:

# Monty Hall
> Monty Hall brain teaser

- draft: False
- date: 2019-07-05
- tags: [python]
- toc: True
- showtoc: True
- testflag: False
- someyaml: this should become a string
- author: Some Author

becomes

---
title: Monty Hall
author: Some Author
date: 2019-07-05
tags: [python]
summary: "Monty Hall brain teaser"
description: "Monty Hall brain teaser"
---

I looked at the nbdev docs, and wasn’t clear as to how fastpages converts frontmatter to yaml. Is there a way to get the cli nbdev_nb2md to convert all the bulletpoints in the first cell to yaml?

Looks like you can edit templates/jekyll-md.tpl to add the tags you want. I’m sure there’s some better way to do this - if you know jekyll/liquid, feel free to do a PR that adds all the tags automatically.

1 Like