Skip to content

Commit 90f50fe

Browse files
committed
Automate copying of 01-about/000_intro.md to index.md, and ignore index.md
1 parent 98072d1 commit 90f50fe

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/jupyter_execute
33
/conf.py
44
/_build
5+
/index.md

docs/create_toc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import os
22
from pathlib import Path
33

4+
# Copy 01-about/000_intro.md to index.md
5+
# We want the intro to the first chapter to also be the intro to the book,
6+
# and it doesn't seem to be easily possible to get rid of an index file entirely.
7+
directory = Path(__file__).parent
8+
with open(directory / "01-about/000_intro.md", "r", encoding="utf-8") as src:
9+
intro_content = src.read()
10+
with open(directory / "index.md", "w", encoding="utf-8") as dst:
11+
dst.write("<!-- This is a copy of 01-about/000_intro.md; DO NOT EDIT -->\n\n")
12+
dst.write(intro_content)
13+
414
# This script provides a platform-independent way of making the jupyter-book call (used in pyproject.toml)
515
folder = Path(__file__).parent
616
toc_file = folder / "_toc.yml"

docs/index.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)