Publish markdown guides from a repo as GitHub gists that work on their own. Local screenshots are uploaded to an image host, links to other guides point to their gists, other repo links go to github.com, "← Home / Next →" navigation is removed, and it refuses to publish if a username or secret is in the text. Keeps a link map so guides link to each other's gists, and updates existing gists in p...
Download skill (.zip) Files on GitHubGuide → gist publisher
Gists can’t hold folders or images and don’t know about the repo, so a guide that looks fine in the repo breaks as a gist. This script fixes that and publishes it.
Needs
The Bash GitHub key with Gists: Read and write, attached for api.github.com. (See the GitHub
setup guide. Fine-grained tokens can’t git push to gists, so this uses the API only.)
Publish
P=<skill>/scripts/publish-guide.py
python3 $P docs/03-itch-setup.md --dry-run --map gists/links.json --repo OWNER/REPO --term <username> # preview
python3 $P docs/03-itch-setup.md --map gists/links.json --repo OWNER/REPO --term <username> # new secret gist
python3 $P docs/03-itch-setup.md --gist <id> --map gists/links.json --repo OWNER/REPO --term <username> # update
python3 $P docs/04-actions.md --extra .github/workflows/deploy.yml --extra scripts/export.sh # attach files
What happens:
| Part of the guide | In the gist |
|---|---|
 and <img src> |
Uploaded to freeimage.host (cached by content, so re-runs reuse the same URL). --images repo uses raw GitHub URLs instead, which only work once the repo is public |
| Link to another guide that’s in the link map | Link to that guide’s gist |
Other relative links (../scripts/x.sh) |
github.com/OWNER/REPO/blob/main/... with --repo, otherwise plain text with a warning |
First and last navigation lines ([← Home](...), [← Previous] · [Next →]) |
Removed (--keep-nav to keep them) |
--term words, tokens, webhook URLs, private keys |
Stops and publishes nothing |
Gists are secret by default (unlisted: anyone with the link can open them). Use --public only when the user asks.
The script prints the short link form (gist.github.com/<id>), which doesn’t show the username.
Keeping a set of guides in sync
- Keep
gists/links.jsonin the repo:{"docs/01-setup.md": "https://gist.github.com/<id>", …}. The script adds each new gist to it. - Publish guides that others link to first, so their gist links exist. Then publish the rest.
If two guides link to each other, publish both, then re-run the first with
--gist <id>. - After editing a guide, re-run with
--gist <id>(the ID is in the link map). Re-run attached files with--extratoo, or they’ll go stale. - Optionally keep a table of all gists in the repo’s README.
Checks before telling the user it’s done
- Run with
--dry-runfirst and read/tmp/<name>. Look for!warnings (missing images, links with no target). - After publishing, fetch it back and check that it rendered right:
curl -s https://api.github.com/gists/<id> | python3 -c "import json,sys;print(json.load(sys.stdin)['files'].keys())" - Open one image URL to make sure it loads (HTTP 200).
- If you have the bash-public-repo-privacy-check skill, use the same
--termwords as that scan.
Notes
- Images uploaded to freeimage.host are public to anyone with the URL, even if the gist is secret. Blur personal info in screenshots first (bash-screenshot-marker skill).
- Delete a test gist with
curl -X DELETE https://api.github.com/gists/<id>(the token needs Gists: write). - The freeimage.host key in the script is the public key from their API docs, not a secret.