Motivation
After we share our files on GitHub, we might want to share the file in our WordPress blog. However, it’s not easy.
Take the jupyter notebook as an example: The naive solution is to convert the jupyter notebook to HTML / markdown, then share the HTML / markdown on WordPress. The drawback of the naive solution is
- You need to link the images in the jupyter notebook to post manually
- You need to repeat these steps if we change the file on GitHub
- The format of the HTML / markdown is not the same as what you see on GitHub and need to fix it manually
Solution
Note: Gist embedding works for supported/renderable Gist content; size, format and browser restrictions can affect the result.
Here’s an example for this file (link) on GitHub Gist
Step 1 Copy the Gist Embed Link
It’s on the top right corner of the Gist webpage
<script src="https://gist.github.com/Victoria-Pinzhen-Liao/874bba00b71d0bd4f3032d2f3f6d373a.js"></script>

Step 2: Add a WordPress Custom HTML block


Step 3: Paste the Gist embed script into the Custom HTML block, using an account allowed to save unfiltered HTML.

Historical alternatives
You can find these solutions online, but they don’t work for me (WordPress version: 6.0.2)
Might be due to a version issue or a compatibility issue.
- Historical attempt 1: Install plugin Documents from Git, and use ShortCode [git-github-jupyter]
- Historical attempt 2: Install plugin WP Pusher and plugin ghandic/nbconvert, and use ShortCode [nbconvert]
- Historical attempt 3: Use GitHub-Gist’s Share link in WP ShortCode (Note: Share link won’t work, need to use embed link)
Example
Looks good : )
Takeaway
Use the actual embed script rather than a share URL, and always provide a normal source link as a fallback. Embedding loads GitHub’s external script; a supported static export is another option when offline availability or avoiding third-party requests is more important. The WordPress6.0.2 compatibility notes above are historical observations.