Does anyone know a way to include a single file of a multi-file gist into a medium post?
I've tried, without luck, the solutions proposed here:
Does anyone know a way to include a single file of a multi-file gist into a medium post?
I've tried, without luck, the solutions proposed here:
There is a way for that without using <script>
, but it's kind of tricky:
⚠️ The order matters!
https://gist.github.com/MojtabaHs/91e34fd0e987fe7ce801936dc6ece0e8
⚠️ Do not hit search or return button
https://gist.github.com/MojtabaHs/91e34fd0e987fe7ce801936dc6ece0e8?file=Interface.swift
Note that ?file=Interface.swift
at the end of the URL, right?
Implement Custom Activity Indicator With The SwiftUI
⚠️ Note that you MUST copy an unformatted plain text in the medium and MUST NOT edit the URL after pasting it in the Medium! You can copy the link in an online textbox like google.com and after appending the query, copy it back and paste it in the Medium.
The Medium API for posts refers to "Accepted markup for Medium’s Publishing API" and the markdown syntax.
None of them includes a <script>
, needed to include a Gist single file
<script src="https://gist.github.com/<id>.js?file=afile" type="text/javascript" />
The only workaround is to generate the article content, included the gist file, and publish the built text with everything in it.
If the Gist changes though, that means the article has to be updated.
Phelipe Rocha mentions in the comments the article "Dealing with Code on Medium" from Egon Elbre
The least frustrating approach I’ve found was using code screenshots. Obviously, this is very annoying for readers.
I would add: combining a screenshot with an HTML link referencing the gist file might be an acceptable workaround (notwithstanding the gist changes, which would mean updating the screenshots).