Support Markdown/Notebook-Friendly Documentation Export for Downstream Integration (copy all markdown and rst files) (#18223)

This commit is contained in:
Kun Lin
2026-02-03 23:53:17 -05:00
committed by GitHub
parent b7c1dfc602
commit 669a9bd180

View File

@@ -41,8 +41,20 @@ compile:
# Convert Notebook files to Markdown artifacts (no execution)
markdown:
@set -e; \
echo "Exporting notebooks to Markdown..."; \
echo "Exporting docs to Markdown..."; \
mkdir -p "$(BUILDDIR)/html/markdown"; \
\
# 1) Copy .md and .rst files under subdirectories only (exclude root-level files) \
find $(SOURCEDIR) -mindepth 2 -path "*/_build/*" -prune -o \( -name "*.md" -o -name "*.rst" \) -print0 | \
parallel -0 -j3 --halt soon,fail=1 ' \
SRC="{}"; \
REL_DIR=$$(dirname "$$SRC"); \
OUT_DIR="$(BUILDDIR)/html/markdown/$$REL_DIR"; \
mkdir -p "$$OUT_DIR"; \
cp -f "$$SRC" "$$OUT_DIR/"; \
' || exit 1; \
\
# 2) Convert .ipynb -> .md (all notebooks, including root if any) \
find $(SOURCEDIR) -path "*/_build/*" -prune -o -name "*.ipynb" -print0 | \
parallel -0 -j3 --halt soon,fail=1 ' \
NB_SRC="{}"; \
@@ -56,8 +68,10 @@ markdown:
--output-dir "$$OUT_DIR" \
>/dev/null; \
' || exit 1; \
\
echo "Markdown artifacts written to: $(BUILDDIR)/html/markdown"
# Serve documentation with auto-build and live reload
serve:
@echo "Starting auto-build server at http://0.0.0.0:$(PORT)"