GitHub struggles to render math inside my exported Obsidian notes

I have made a a post before about how a lot of LaTeX code that works in Obsidian can fail to display when I upload the markdown files to GitHub. Since then, I have put in extra effort to ensure the LaTeX (both inline ($) and display math ($$) is valid and properly formatted. While it has helped a lot, I found that there are just issues with the way GitHub renders math, and I’m not sure if there’s anything I can do about it.

EX: I have one markdown file for each of my classes, so those files get pretty long (a couple thousand lines each). Most of the math renders flawlessly, but once I scroll down the document far enough on GitHub, none of the equations render anymore:

What I’m trying to do

Find some sort of solution that handles this automatically or somewhat manually, whether it’s another plugin, a new GitHub actions workflow, or anything else that can make all the math render on GitHub.

Things I have tried

  • A GitHub actions workflow that runs obsidian-export on all my notes whenever I make a push to the repository.
  • Installed Markdown Linter and set it to remove trailing spaces and put blank lines on both sides of display math blocks.

If you’re curious, here is my current GitHub Actions workflow file (heavily AI-assisted, to be honest):

name: Build GitHub-readable branch

# Publish gh-readable branch with exported Obsidian notes
# Triggers: pushes to main and manual dispatch. Adjust triggers as you like.
on:
  push:
    branches:
      - main
  workflow_dispatch:

permissions:
  contents: write

concurrency:
  group: publish-gh-readable-${{ github.ref }}
  cancel-in-progress: false

jobs:
  export-and-publish:
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - name: Checkout repository (full history)
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Install obsidian-export
        run: |
          cargo install --locked obsidian-export

      - name: Export vault
        run: |
          rm -rf _export
          mkdir -p _export
          obsidian-export . _export

      - name: Prepare gh-readable branch and commit export (safe)
        env:
          GIT_COMMITTER_NAME: "github-actions[bot]"
          GIT_COMMITTER_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
        run: |
          set -euo pipefail
          # Move the export out of the repo so branch cleanup won't delete it
          if [ -d "_export" ]; then
            TMP_EXPORT="$(mktemp -d)"
            mv _export "$TMP_EXPORT/export"
          else
            echo "ERROR: _export not found" >&2
            exit 1
          fi

          # Ensure origin remote URL is correct
          git remote set-url origin "https://github.com/${{ github.repository }}.git"

          # Fetch remote branch if it exists (ignore failure)
          git fetch origin gh-readable || true

          # If remote gh-readable exists, create/reset local branch from it; otherwise create an orphan branch
          if git ls-remote --exit-code --heads origin gh-readable >/dev/null 2>&1; then
            git checkout -B gh-readable origin/gh-readable
          else
            # create a new orphan branch with no history
            git checkout --orphan gh-readable
            # remove any remaining tracked files from index (ignore error)
            git rm -rf . || true
          fi

          # Extra cleanup of untracked files (safe: export is currently outside the repo)
          git clean -fdx || true

          # Copy the export contents into the repository root
          cp -a "$TMP_EXPORT/export/." .

          # Clean up temp dir
          rm -rf "$TMP_EXPORT"

          # Commit if there are changes
          git add -A
          if ! git diff --cached --quiet; then
            git -c user.name="github-actions[bot]" \
                -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
                commit -m "Export GitHub-readable snapshot: ${{ github.sha }}"
          else
            echo "No changes to commit on gh-readable branch"
          fi

      - name: Push gh-readable (authenticated)
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          # Push using http.extraheader to pass the token securely
          git -c http.extraheader="AUTHORIZATION: bearer $GITHUB_TOKEN" push -f origin gh-readable