File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Find Markdown files convert.
4
+ all_markdown_files=$( find tutorials -type f)
5
+ if [ $# -gt 0 ]; then
6
+ files_to_process=" $@ "
7
+ else
8
+ files_to_process=$all_markdown_files
9
+ fi
10
+
11
+ OUTDIR=" _build/ipynbs"
12
+
13
+ # Identify Markdown files that are Jupytext and convert them all.
14
+ for file in ${files_to_process} ; do
15
+ echo " Making directory: $OUTDIR /$( dirname $file ) "
16
+ mkdir -p $OUTDIR /$( dirname $file )
17
+
18
+ echo loop in $file
19
+ # Extract the kernel information from the Jupytext Markdown file.
20
+ kernel_info=$( grep -A 10 ' ^---$' " $file " | grep -E ' kernelspec' )
21
+ # Skip if no kernel information was found.
22
+ if [ -z " $kernel_info " ]; then
23
+ cp $file $OUTDIR /$file
24
+ continue
25
+ fi
26
+ # Convert to ipynb format, to be consumed by pytest nbval plugin.
27
+ notebook_file=" ${file% .md} .ipynb"
28
+ jupytext --to ipynb " $file " --output $OUTDIR /${notebook_file}
29
+ # Stash file in array to be cleaned up at the end.
30
+ done
Original file line number Diff line number Diff line change @@ -89,10 +89,11 @@ jupyterlab-myst = ">=2.4"
89
89
90
90
[feature .jupyterlite-host .tasks ]
91
91
setup_wasm = {cmd = " pixi install -e jupyterlite-runtime" , inputs = [" pixi.lock" ]}
92
+ convert_ipynbs = {cmd = " bash convert_all_jupyterlite.sh" , inputs = [" tutorials/" ], outputs = [" _build/ipynbs" ]}
92
93
93
94
[feature .jupyterlite-host .tasks .build_wasm ]
94
- cmd = " jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir _build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG"
95
- depends-on = [" setup_wasm" ]
95
+ cmd = " jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents _build/ipynbs/ tutorials --output-dir _build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG"
96
+ depends-on = [" setup_wasm" , " convert_ipynbs " ]
96
97
outputs = [" _build/html/jupyterlite/" ]
97
98
inputs = [" pixi.lock" , " tutorials/" ]
98
99
You can’t perform that action at this time.
0 commit comments