Skip to content

Commit 1eef18d

Browse files
committed
Fix MyST static file detection by generating notebooks to project root
Changes notebook generation to create files in project root directories: - notebooks/ (instead of _build/html/notebooks/) - learn_probability_notebooks.zip (instead of _build/html/) This allows MyST to recognize them as static files during build and properly resolve the downloads: frontmatter configuration. MyST will automatically copy these files to _build/html/ during the build process. Also adds generated files to .gitignore to prevent them from being committed. Fixes the "Resource should be a URL or path to static file" errors.
1 parent 199780f commit 1eef18d

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ jobs:
3636
run: npm install -g mystmd
3737

3838
- name: Generate Jupyter Notebooks
39-
run: |
40-
mkdir -p _build/html/notebooks
41-
python generate_notebooks.py
39+
run: python generate_notebooks.py
4240

4341
- name: Build HTML Assets (execute)
4442
run: myst build --execute --html

.github/workflows/deploy.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ jobs:
6363
sed -i "s/COMMIT_HASH/${COMMIT_SHA}/g" footer.md
6464
6565
- name: Generate Jupyter Notebooks
66-
run: |
67-
mkdir -p _build/html/notebooks
68-
python generate_notebooks.py
66+
run: python generate_notebooks.py
6967

7068
- name: Build HTML Assets (execute)
7169
uses: nick-fields/retry@v3

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ _build/
33
.ipynb_checkpoints
44

55
*.svg
6+
7+
# Generated notebooks
8+
notebooks/
9+
learn_probability_notebooks.zip

generate_notebooks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def main():
7676
print("Generating Jupyter Notebooks from MyST Markdown")
7777
print("=" * 60)
7878

79-
# Create output directory
80-
output_dir = Path("_build/html/notebooks")
79+
# Create output directory in project root (not _build)
80+
output_dir = Path("notebooks")
8181
output_dir.mkdir(parents=True, exist_ok=True)
8282

8383
# Get all notebook files
@@ -93,10 +93,10 @@ def main():
9393

9494
print(f"\n✓ Successfully converted {len(converted_files)} notebooks")
9595

96-
# Create zip archive
96+
# Create zip archive in project root
9797
if converted_files:
9898
print("\nCreating zip archive...")
99-
zip_path = Path("_build/html/learn_probability_notebooks.zip")
99+
zip_path = Path("learn_probability_notebooks.zip")
100100
create_zip_archive(output_dir, zip_path)
101101

102102
# Calculate total size

0 commit comments

Comments
 (0)