Skip to content

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Dec 31, 2025

The JavaScript that rewrites relative URLs for gistpreview.github.io now handles dynamic content and SPA-style navigation:

  • Skip already-rewritten links (starting with '?') to prevent double-rewriting when JS runs multiple times
  • Use MutationObserver to catch dynamically added links
  • Run on DOMContentLoaded as fallback for DOM timing issues
  • Add longer delay retry (2s) for slow-loading content

Fixes #26

https://gisthost.github.io/?3581c145202388b43862c93176e9f8ad

claude and others added 2 commits December 30, 2025 17:53
The JavaScript that rewrites relative URLs for gistpreview.github.io
now handles dynamic content and SPA-style navigation:

- Skip already-rewritten links (starting with '?') to prevent
  double-rewriting when JS runs multiple times
- Use MutationObserver to catch dynamically added links
- Run on DOMContentLoaded as fallback for DOM timing issues
- Add longer delay retry (2s) for slow-loading content

Fixes #26
Resolved conflict in __init__.py comment: combined the expanded gist host
description (gisthost.github.io or gistpreview.github.io) with the issue #26
reference.
@simonw
Copy link
Owner Author

simonw commented Dec 31, 2025

Manually tested the merged version by deploying this:

https://gisthost.github.io/?11348748f46fc7f45bdeaca0cc4bff4d

Everything works correctly.

@simonw simonw merged commit 0154c2b into main Dec 31, 2025
30 checks passed
simonw added a commit that referenced this pull request Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination links broken on gistpreview.github.io due to relative href paths

3 participants