From 669a9bd1809a344fae5b9d962d2cd6f842cb50c1 Mon Sep 17 00:00:00 2001 From: Kun Lin <81014421+klhhhhh@users.noreply.github.com> Date: Tue, 3 Feb 2026 23:53:17 -0500 Subject: [PATCH] Support Markdown/Notebook-Friendly Documentation Export for Downstream Integration (copy all markdown and rst files) (#18223) --- docs/Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index 3b437725c..a15ce24d9 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -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)"