A screenshot of code is a dead end. Nobody can copy it, nobody can search it, and it ages the day you change a line. A gist stays live.
Paste the link
Copy your gist URL from GitHub, paste it on an empty line in the editor, and it becomes the gist. If you prefer the slash menu, /gist does the same thing.
What your readers get
The real gist: syntax highlighting, line numbers, file names, and a link back so they can fork it and run it. Fix a typo in the gist on GitHub and every article that embeds it is fixed too.
Good to know
- A gist with several files brings all of them along.
- Gists load only when the reader scrolls to them, so a long tutorial can carry a dozen without feeling heavy.
- In your newsletter, each gist becomes a neat "View on GitHub Gist" link, since no email client will run the embed.
- Writing in a repo already? GitHub can publish your posts on a git push.