A lot of your issues are just being caused by trying to do things markdown is tricky about handling or not using enough whitespace. For example, you shouldn’t indent the code blocks. Markdown will do that for you and as you see it causes issues if you try to do it yourself. And about the whitespace, you need a new line below a heading and other text.
In fact, I note that when you get to what you have for the ### Install Docker Compose
portion, things really go off the rails even in a live notebook.
Additionally, never rely on GitHub for accurate rendering of notebooks. I always tell people it is meant for nothing more than a quick preview. Always use the Jupyter provided nbviewer. nbviewer will render public notebooks that are on GitHub and has the ability to render many more features than GitHub and renders it more accurately. Plus, the interface that faces users from nbviewer is more palatable to those unfamiliar with GitHub and so it is best to share that. The URL for the nbviewer rendering is a simple variation on the GitHub URL. You can get the URL by pasting the GitHub URL here.
To illustrate all of this, you can find the code block from what you included in your screenshot MODIFIED TO FIX THE ISSUES here.
Here it is rendered via nbviewer.
Note how it is very different than you see at GitHub’s quick preview
Even the nbviewer rendering for the same markdown in the notebook is not as nice as the rendering in active JupyterLab.
Or rendering within the active classic notebook.
But the nbviewer rendering is much closer.
Keep in mind that the free service at nbviewer doesn’t update as fast a GitHub directly though, and because of that you need to be patient. Once you render it once at nbviewer, it has gotten to the point it can take hours before nbviewer will pick up and render any additional changes and edits you post at GitHub. As reported here even the trigger to workaround this isn’t quite working well at present. I just tested it and I could get an update using it, but then if I updated again, the newer update didn’t show after many minutes. (It’s not browser caching causing this because opening a different browser and using the two variations of the the URL, one with ?flush_cache=true
and one without, yielded the same outdated two versions.)
For NOW this workaround of using raw link that has commit sha as ref works when you need to see how nbviewer will render the most up to date notebook code. For using notebooks from gists, this means going to the current GitHub page for it and pressing the raw button and using that URL in the form at nbviewer. For a standard GitHub repo, this means going to the listing of all the commits by pressing ‘History’ on the right side of the main page, then from the list selecting the last commit tag stub in blue on the right, then from that next page selecting the ‘Browse files’ button in the upper right, then while browsing the files from that commit, navigating to the notebook you want and collecting the ‘raw’ URL to use at nbviewer. However, as noted by the person who posted this isn’t really “a practical solution”.