diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index 0efb4248..13b293eb 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -16,6 +16,46 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Block node_modules changes on pull requests + if: github.event_name == 'pull_request' + run: | + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + CHANGED_NODE_MODULES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- 'node_modules/**')" + + if [ -n "${CHANGED_NODE_MODULES}" ]; then + echo "::error title=Blocked path::Pull request includes changes under node_modules/." + echo "${CHANGED_NODE_MODULES}" + exit 1 + fi + + - name: Block node_modules changes on pushes + if: github.event_name == 'push' + run: | + BASE_SHA="${{ github.event.before }}" + HEAD_SHA="${{ github.sha }}" + ZERO_SHA="0000000000000000000000000000000000000000" + + if [ "${BASE_SHA}" = "${ZERO_SHA}" ]; then + echo "Initial push detected; skipping node_modules diff guard." + exit 0 + fi + + CHANGED_NODE_MODULES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- 'node_modules/**')" + + if [ -n "${CHANGED_NODE_MODULES}" ]; then + echo "::error title=Blocked path::Push includes changes under node_modules/." + echo "${CHANGED_NODE_MODULES}" + exit 1 + fi + + - name: Verify thesis navigation docs stay in sync + run: | + chmod +x scripts/check-phd-thesis-nav-docs.sh + ./scripts/check-phd-thesis-nav-docs.sh - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/update-search.yml b/.github/workflows/update-search.yml index 89914408..e7949b50 100644 --- a/.github/workflows/update-search.yml +++ b/.github/workflows/update-search.yml @@ -35,6 +35,7 @@ jobs: fetch-depth: 0 # Fetch all history for proper git operations - name: Clone comphy-search repository + id: clone-search-repo run: | GITHUB_ORG="${GITHUB_REPOSITORY%%/*}" SEARCH_REPO="${SEARCH_REPO:-comphy-search}" @@ -42,20 +43,35 @@ jobs: if git clone "https://github.com/${GITHUB_ORG}/${SEARCH_REPO}.git"; then mkdir -p assets/js + echo "clone_ok=true" >> "${GITHUB_OUTPUT}" echo "Search database repository cloned successfully" else + echo "clone_ok=false" >> "${GITHUB_OUTPUT}" echo "Warning: Could not clone ${GITHUB_ORG}/${SEARCH_REPO}" echo "Search functionality may be limited. This is expected if the search repository does not exist." + echo "::warning title=Search DB clone failed::Could not clone ${GITHUB_ORG}/${SEARCH_REPO}. Search update will be skipped." + { + echo "### Search DB update skipped" + echo "- Clone failed for \`${GITHUB_ORG}/${SEARCH_REPO}\`." + } >> "${GITHUB_STEP_SUMMARY}" exit 0 fi - name: Copy search database + id: copy-search-db + if: steps.clone-search-repo.outputs.clone_ok == 'true' run: | SEARCH_REPO="${SEARCH_REPO:-comphy-search}" + echo "search_db_available=false" >> "${GITHUB_OUTPUT}" if [ ! -d "${SEARCH_REPO}" ]; then echo "Warning: ${SEARCH_REPO} directory not found (clone may have failed)" echo "Search functionality will be limited" + echo "::warning title=Search DB directory missing::Directory ${SEARCH_REPO} was not found." + { + echo "### Search DB update skipped" + echo "- Directory \`${SEARCH_REPO}\` was not found after clone." + } >> "${GITHUB_STEP_SUMMARY}" exit 0 fi @@ -63,14 +79,21 @@ jobs: if [ -f "${SEARCH_REPO}/search_db.json" ]; then cp "${SEARCH_REPO}/search_db.json" assets/js/search_db.json + echo "search_db_available=true" >> "${GITHUB_OUTPUT}" echo "Search database copied successfully" else echo "Warning: search_db.json not found in ${SEARCH_REPO}" echo "Search functionality will be limited" + echo "::warning title=search_db.json missing::No search_db.json found in ${SEARCH_REPO}." + { + echo "### Search DB update skipped" + echo "- Missing \`${SEARCH_REPO}/search_db.json\`." + } >> "${GITHUB_STEP_SUMMARY}" exit 0 fi - name: Commit and push changes + if: steps.copy-search-db.outputs.search_db_available == 'true' run: | git config --local user.name 'comphy-search-updater[bot]' git config --local user.email "${{ env.APP_BOT_USER_ID }}+comphy-search-updater[bot]@users.noreply.github.com" diff --git a/.gitignore b/.gitignore index 69eb34f3..b1246c4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.comphy _site/ .sass-cache/ .jekyll-cache/ diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 00000000..45757da9 --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -0,0 +1,6 @@ +{ + "config": { + "MD034": true, + }, + "ignores": ["node_modules/**", "assets/css/academicons-1.7.0/README.md"], +} diff --git a/AGENTS.md b/AGENTS.md index a61d57e3..146e1a07 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -82,6 +82,17 @@ The following pages redirect to the CoMPhy Lab website: - **\_layouts/default.html**: Base template for all pages - **Gemfile**: Ruby dependencies including Jekyll 4.3.2 and various plugins +- **MathJax**: Loaded from the local vendored asset first + (`/assets/js/mathjax/tex-svg.js`) for offline and archival reproducibility, + with a pinned jsDelivr fallback + (`https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg.js`, with SRI) + for consistent behavior when online (requires CDN availability). + +### Math Authoring Policy + +- Inline math supports both `\(...\)` and `$...$`. +- Escape literal dollar signs in content as `\$` to prevent accidental math + parsing. ### Content Management diff --git a/README.md b/README.md index c9eaf513..5633868c 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ The personal website for Vatsal Sanjay, hosted at [comphy-lab.org/vatsalsy](http ```bash bundle exec jekyll serve ``` - - Visit http://localhost:4000 in the browser + - Visit in the browser - Changes in source files trigger automatic rebuilds 4. **Deployment** diff --git a/_layouts/default.html b/_layouts/default.html index 49959315..d8f995d7 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -28,6 +28,7 @@ - +