Documentation source for the tatva library.
Built with Zensical from Markdown sources. Notebooks are authored as .ipynb files and converted to Markdown offline before building.
notebooks/ # Jupyter notebooks (source of truth — edit these)
examples/
external_solvers/
operator.ipynb
...
docs/ # Zensical docs_dir (do not edit generated files)
examples/
linear_elasticity.md # generated from notebook
linear_elasticity_files/ # extracted matplotlib images
assets/
notebooks/ # .ipynb copies served for download
index.md # hand-written
getting_started.md # hand-written
...
mkdocs.yml # site configuration (nav, theme, plugins)
convert_notebooks.py # offline notebook → markdown conversion script
pyproject.toml
Requires uv.
git clone https://github.com/smec-ethz/tatva-docs.git
cd tatva-docs
uv syncuv run zensical serveThe site is served at http://localhost:8000 with live reload.
Notebooks live in notebooks/ and are not executed by the build. After editing or re-running a notebook, convert it to Markdown manually:
# Convert all notebooks
uv run convert_notebooks.py
# Preview what will be converted without doing anything
uv run convert_notebooks.py --checkThis will:
- Run
nbconverton each.ipynbinnotebooks/, writing.md+ image files into the matching path underdocs/ - Copy each
.ipynbtodocs/assets/notebooks/so it can be downloaded from the site - Inject the Colab badge, download button, and any collapse/tag directives into the Markdown
Commit both the notebook and the generated files:
git add notebooks/examples/my_example.ipynb
git add docs/examples/my_example.md
git add docs/examples/my_example_files/
git add docs/assets/notebooks/examples/my_example.ipynb
git commit -m "feat: add my_example notebook"-
Create the notebook under
notebooks/, mirroring thedocs/subdirectory you want it to appear in:notebooks/examples/my_example.ipynb -
Add an entry to the
navinmkdocs.ymlpointing to the.mdpath:nav: - Examples: - My Example: "examples/my_example.md"
-
Run the converter and commit:
uv run convert_notebooks.py git add notebooks/examples/my_example.ipynb \ docs/examples/my_example.md \ docs/examples/my_example_files/ \ docs/assets/notebooks/examples/my_example.ipynb git commit -m "feat: add my_example"
Add a directive comment as the first line of a cell to control how it renders on the site:
# [collapse: code] Setup
import matplotlib.pyplot as plt
...| Directive | Effect |
|---|---|
# [collapse: code] Title |
Code block collapsed, output visible |
# [collapse: all] Title |
Code and output both collapsed |
# [output: hide] Title |
Code visible, output collapsed |
Add a # tags: [...] comment anywhere in a code cell to render tag badges below the page title:
# tags: [elasticity, tutorial, 3d]These are injected automatically during conversion — no action needed.
To control which GitHub branch the Colab link points to, set the LIB_TAG environment variable before converting:
LIB_TAG=v0.7.1 uv run convert_notebooks.pyDefaults to main.
The CI pipeline only builds the site — it does not execute notebooks or run convert_notebooks.py. Generated .md files must be committed to the repository.