nbconvert converts Jupyter Notebooks to other formats including HTML and PDF. While the built in export function of Jupyter Notebooks and [[VS Code]] can handle many export tasks, using `nbconvert` gives you the maximum control over outputs.
To use `nbconvert`, you may also need [[pandoc]] and [[MiKTeX]].
> [!Bug]
> I've had issues with `\begin{align}` and `\end{align}` when converting Jupyter Notebooks that contain LaTeX to PDF. One solution is to replace `{align}` with `{split}`. An alternative hack is to export to HTML and use the web browser's Print to PDF feature to get the PDF.
## export without code
Exporting embedded, interactive HTML elements without the code blocks is a great way to share an analysis with a non-technical audience.
```bash
jupyter nbconvert --to html_embed --no-input file.ipynb
```
## workflow with GitHub pages
```bash
jupyter nbconvert --to html_embed --no-input <file>.ipynb
mv <file>.html index.html
git commit -am "update page"
git pull
git push origin main
git checkout gh-pages
git checkout main index.html
git commit -am "updating gh-pages"
git push origin gh-pages
git checkout main
```