This is my setup:
Use the Python libraries below. First, PyGithub does the Github work (connecting, pulling gists, pushing updates, etc) - excellent documentation here. The next two libraries allow for the Markdown in the gists to be processed with the last one being an extension for Github Flavored Markdown (my preference, but also makes sense because Github is being used - do what you will).
# IMPORT PYGITHUB (OCTOKIT)
from github import Github
# IMPORT MARKDOWN TO CONVERT GIST
import markdown
# IMPORT PY-GFM FOR GITHUB MARKDOWN STYLE
from mdx_gfm import GithubFlavoredMarkdownExtension
I recommend using a token for authentication which can be generated by going to your Github Settings > Developer Settings > Personal access tokens > Generate new token. Select your scopes as you see fit. Don't let anyone have access to your token!
Now, set variables, connect to Github, and pull gists:
# GITHUB VARIABLES
owner = 'USERNAME'
repo = 'USERNAME.github.io' # SHOULD BE GH PAGES REPO IN THIS CASE
branch = 'master'
token = 'YOUR TOKEN'
# CONNECT TO GITHUB CLIENT WITH TOKEN
ghub = Github(token)
# SET USER
user = ghub.get_user(owner)
# PULL USER GISTS
gists = user.get_gists()
Now we can start generating our content. Everyone will want to do this differently, but I'll summarize what I did and give a few tips.
I ran into issues with images - I had to store them in my Github pages repo as base64 strings and then use JavaScript to update the tags accordingly.
...To Be Continued...