#!/usr/bin/env bash

# Update notebooks in the demo directory from upstream repo
git submodule foreach git pull origin main
rm -r demo && cp -r jupytext/demo demo

# Copy jupytext's jupyter config to open md and script files as notebooks by default.
mkdir -p ${HOME}/.jupyter/labconfig
cp jupytext/binder/labconfig/* ${HOME}/.jupyter/labconfig

# Create the notebook for our jupytext demo
jupytext demo/get_started.md --to ipynb --update-metadata '{"jupytext":null}'

# Remove the markdown representation
# (the demo starts with just the ipynb file)
rm demo/get_started.md

# Trust our World Population notebook
jupyter trust demo/World\ population.ipynb
