Migrate to nbprocess

Utilities for migrating to nbprocess

Convert fastpages blog posts to nbprocess

Migrate notebooks


migrate_nb_fm

 migrate_nb_fm (path, overwrite=True)

Migrate fastpages front matter in notebooks to a raw cell.

_nb = migrate_nb_fm('../tests/2020-09-01-fastcore.ipynb', overwrite=False)
print(_get_raw_fm(_nb))
---
title: "fastcore: An Underrated Python Library"
description: A unique python library that extends the python programming language and provides utilities that enhance productivity.
author:  "<a href='https://twitter.com/HamelHusain'>Hamel Husain</a>"
image:  images/copied_from_nb/fastcore_imgs/td.png
categories:  [fastcore, fastai]
aliases: [/fastcore/]
---
_nb = migrate_nb_fm('../tests/2020-02-20-test.ipynb', overwrite=False)
print(_get_raw_fm(_nb))
---
title: Fastpages Notebook Blog Post
description: A tutorial of fastpages for Jupyter notebooks.
image:  images/chart-preview.png
categories:  [jupyter]
aliases: [/jupyter/2020/02/20/test]
---

Migrate Markdown Files


migrate_md_fm

 migrate_md_fm (path, overwrite=True)

Make fastpages front matter in markdown files quarto compliant.

Here is what the front matter of a markdown post looks like before:

print(run('head -n13 ../tests/2020-01-14-test-markdown-post.md'))
---
toc: true
layout: post
description: A minimal example of using markdown with fastpages.
categories: [markdown]
title: An Example Markdown Post
---
# Example Markdown Post

## Basic setup

Jekyll requires blog post files to be named according to the following format:

And this is what it looks like after:

_res = migrate_md_fm('../tests/2020-01-14-test-markdown-post.md', overwrite=False)
print(_res[:300])
---
title: An Example Markdown Post
description: A minimal example of using markdown with fastpages.
categories: [markdown]
aliases: [/markdown/2020/01/14/test-markdown-post]
---
# Example Markdown Post

## Basic setup

Jekyll requires blog post files to be named according to the following format:

Convert nbdev v1 projects to nbdev v2

Migrate Directives


nbprocess_migrate_directives

 nbprocess_migrate_directives (fname:str=None, disp:bool=False,
                               stdin:bool=False, no_skip:bool=False)

Convert all directives in fname from v1 to v2.

Type Default Details
fname str None A notebook name or glob to convert
disp bool False Print the outputs with newly formatted directives
stdin bool False Read input stream and not nb folder
no_skip bool False Do not skip directories beginning with an underscore