htmlpreview / htmlpreview.github.com

HTML Preview for GitHub Repositories
htmlpreview.github.com
1.51k stars 303 forks source link

Also works with gists... #125

Open oaustegard opened 1 year ago

oaustegard commented 1 year ago

Not an issue, more of a PSA: this also works with the raw url of an html gist (public or private).

See e.g. https://htmlpreview.github.io/?gist.githubusercontent.com/oaustegard/a1902d995b5c6157a9eaf69afa355723/raw/helloworld.html

rendering the helloworld.html file in https://gist.github.com/oaustegard/a1902d995b5c6157a9eaf69afa355723

Note: you likely have to strip the revision identifier from your raw gist's url

If your gist only contains the one file you can simply use the https://gist.githubusercontent.com/oaustegard/a1902d995b5c6157a9eaf69afa355723/raw url => https://htmlpreview.github.io/?gist.githubusercontent.com/oaustegard/a1902d995b5c6157a9eaf69afa355723/raw

oaustegard commented 1 year ago

If any users are interested in "hosting" their own version to specifically surface their own gists, take a look at the fork at https://github.com/oaustegard/oaustegard.github.io/blob/main/pv.html and https://github.com/oaustegard/oaustegard.github.io/blob/main/scripts/htmlpreview.js

It allows surfacing your own gists with a short url like https://austegard.com/pv?a1902d995b5c6157a9eaf69afa355723 rather than the lengthy generic version above (*also includes the license/attribution back to this repo)