In [ ]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
%config InlineBackend.figure_format = 'retina'

In [ ]:
from lib import read_mkdocs
mkdocs_config = read_mkdocs()
from pyprojroot import here

In [ ]:
nav = mkdocs_config["nav"]
docroot = here() / "docs"

In [ ]:
from lib import parse_navigation

# The goal here is to flatten the tree structure into a list of 2-tuples,
# where the title is the first element and the filename is the second element.
title_files = parse_navigation(nav, [])
title_files

In [ ]:
from lib import exclude

exclusion = [
    "Welcome", 
    "Get Setup",
    # "Linear Algebra",
    "Further Learning",
    "Style Guide",
]

title_files = exclude(title_files, titles=exclusion)

In [ ]:
title_files

In [ ]:
from lib import read_markdown
print(read_markdown(docroot / "index.md"))

In [ ]:
from lib import read_notebook

In [ ]:
nb = read_notebook(here() / "docs/practical/io.ipynb")
# nb["cells"]

In [ ]:
nb.keys()

In [ ]:
# nb.metadata

This is how we are going to approach the problem. We are going to create ONE GIANT NOTEBOOK and use the PDFExporter to do exporting.

God Bless Me as I attempt this...


In [ ]:
from lib import md2nbcell, compile_code_cells

In [ ]:
cells = compile_code_cells(title_files, docroot)

In [ ]:
# Debugging purposes only.
for cell in cells:
    if cell["source"] == "":
        print(cell)

In [ ]:
from lib import make_compiled_notebook
compiled_nb = make_compiled_notebook(cells, title="Network Analysis Made Simple")

In [ ]:
from pyprojroot import here

docs_dir = here() / "docs"

In [ ]:
from lib import to_pdf

In [ ]:
to_pdf(compiled_nb, kernel="nams", fpath="output.pdf")

In [ ]: