summaryrefslogtreecommitdiff
path: root/tutorials/generate_notebook.sh
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2025-04-24 16:25:31 -0600
committerChristian Kolset <christian.kolset@gmail.com>2025-04-24 16:25:31 -0600
commit652f88728eb91bae1c4f30b63d1fbe60788ea938 (patch)
tree65cfe591da183b969885e8c557b1ac5810727ec8 /tutorials/generate_notebook.sh
parent42fca6122f4baf847ec2794b172abbc6a2193407 (diff)
Added jupyter notebook converter script. Converts markdown (.md) tutorials to jupyter notebook (.ipynb).
Diffstat (limited to 'tutorials/generate_notebook.sh')
-rwxr-xr-xtutorials/generate_notebook.sh22
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