Updated on August 2, 2026easy, ~2 min
How to Embed GitHub Code in Notion (Gists)
Notion supports GitHub Gist as a native embed, but not GitHub repository pages. Paste a gist URL onto a Notion page and choose "Create embed" and the code renders with syntax highlighting. Paste a repo or file URL and you get a bookmark rather than a preview, because GitHub blocks its own pages from being framed. If you want code visible on the page, a gist is the route that works.
Why embed GitHub Gist in Notion?
- Show a working code sample beside the documentation that explains it.
- Keep a snippet in one place so fixing it updates every page that shows it.
- Give a runbook real commands rather than a screenshot of them.
Can you embed a GitHub repo in Notion?
Not as a live preview, and this is the thing most people are actually asking. Notion lists GitHub Gist among its supported embeds, so gists render as code. Repository pages, file views, and pull requests do not: GitHub sends a header that stops browsers displaying those pages inside a frame, so Notion falls back to a bookmark. That behaviour is set by GitHub, and no Notion setting changes it.
- Want code visible on the page: move the snippet into a gist and embed that.
- Want to point at a repo: use a bookmark block, which shows the repo name and description.
- Want issues or pull requests inside Notion: that needs a connector, not an embed.
How to embed GitHub Gist in Notion
Create or open a gist
Go to gist.github.com and create a gist with your code, or open an existing one. Public and secret gists both embed; secret gists are simply unlisted, not private, so anyone with the URL can read them.
Copy the gist URL
Copy the address from your browser. It looks like https://gist.github.com/username/id. There is no need for the embed script GitHub offers, since Notion works from the URL.
Paste it into Notion
Paste the URL onto your Notion page and choose "Create embed", or type /embed first and paste. The code renders with syntax highlighting and a link back to the gist.
For a repo, use a bookmark instead
Paste the repository URL and choose "Create bookmark". You get a card with the repo name, description, and icon, which is the best available result for a page GitHub will not let anyone frame.
Good to know
- Repository pages, file views, issues, and pull requests cannot be embedded. GitHub blocks framing on those pages, so Notion shows a bookmark instead.
- Secret gists are unlisted rather than private. Anyone with the URL can read the code, including anyone who can see your Notion page.
- Long gists scroll inside the embed block, so a tall block is worth it for anything more than a few dozen lines.
- The embed shows the current version of the gist, so editing it changes what every page displays.
Frequently asked questions
How do I embed GitHub code in Notion?
Put the code in a GitHub Gist, copy the gist URL, and paste it onto a Notion page choosing "Create embed". The code appears with syntax highlighting. Repository file views cannot be embedded this way.
Why won't my GitHub repo embed in Notion?
GitHub sends a header that prevents its pages from loading inside a frame, so Notion cannot display a repo page and offers a bookmark instead. This is GitHub's restriction, not a Notion setting you can change.
Can I embed a private gist?
GitHub's secret gists are unlisted rather than private, and they do embed. There is no truly private option, so treat anything in an embedded gist as readable by anyone with the link.
Does the embed update when I edit the gist?
Yes. The embed points at the live gist, so an edit shows up on every Notion page that embeds it.
Need a widget that doesn’t exist yet?
Describe it in plain English and generate a custom Notion widget with a stable embed link — no code required.
Create a widget