diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-04-24 16:25:31 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-04-24 16:25:31 -0600 |
| commit | 652f88728eb91bae1c4f30b63d1fbe60788ea938 (patch) | |
| tree | 65cfe591da183b969885e8c557b1ac5810727ec8 /tutorials/generate_notebook.sh | |
| parent | 42fca6122f4baf847ec2794b172abbc6a2193407 (diff) | |
Added jupyter notebook converter script. Converts markdown (.md) tutorials to jupyter notebook (.ipynb).
Diffstat (limited to 'tutorials/generate_notebook.sh')
| -rwxr-xr-x | tutorials/generate_notebook.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tutorials/generate_notebook.sh b/tutorials/generate_notebook.sh new file mode 100755 index 0000000..33367d5 --- /dev/null +++ b/tutorials/generate_notebook.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Process each module_# directory +for module_path in module_*; do + [ -d "$module_path" ] || continue + + module_name=$(basename "$module_path") # e.g., module_1 + notebook_dir="$module_path/notebook_${module_name#module_}" # notebook_1, notebook_2, etc. + + mkdir -p "$notebook_dir" + + # Convert each .md file in the module root (not recursive) + for mdfile in "$module_path"/*.md; do + [ -f "$mdfile" ] || continue + + filename_no_ext=$(basename "$mdfile" .md) + output_file="$notebook_dir/$filename_no_ext.ipynb" + + pandoc -f markdown -t ipynb "$mdfile" -o "$output_file" + echo "Converted $mdfile -> $output_file" + done +done |
