Support Markdown/Notebook-Friendly Documentation Export for Downstream Integration (#18131)

Co-authored-by: 赵晨阳 <zhaochen20@outlook.com>
This commit is contained in:
Kun Lin
2026-02-02 21:43:20 -08:00
committed by GitHub
co-authored by 赵晨阳
parent 78bf13db44
commit f032c4f3d6
3 changed files with 89 additions and 1 deletions
+20
View File
@@ -38,6 +38,26 @@ compile:
echo "Total execution time: $${TOTAL_ELAPSED}s" >> logs/timing.log; \
echo "All Notebook execution timings:" && cat logs/timing.log
# Convert Notebook files to Markdown artifacts (no execution)
markdown:
@set -e; \
echo "Exporting notebooks to Markdown..."; \
mkdir -p "$(BUILDDIR)/html/markdown"; \
find $(SOURCEDIR) -path "*/_build/*" -prune -o -name "*.ipynb" -print0 | \
parallel -0 -j3 --halt soon,fail=1 ' \
NB_SRC="{}"; \
REL_DIR=$$(dirname "$$NB_SRC"); \
NB_NAME=$$(basename "$$NB_SRC"); \
NB_BASE=$${NB_NAME%.ipynb}; \
OUT_DIR="$(BUILDDIR)/html/markdown/$$REL_DIR"; \
mkdir -p "$$OUT_DIR"; \
jupyter nbconvert --to markdown "$$NB_SRC" \
--output "$$NB_BASE.md" \
--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)"