Algorithm for preparing the merge

This generates a valid `.ipynb` file that the extension renders with the controls.