How do I embed a single file from a GitHub gist with the new gist interface?

前端 未结 4 2003
我寻月下人不归
我寻月下人不归 2020-12-22 20:45

The new GitHub Gist interface has one embed snippet for the entire gist which embeds all files in the gist. The old interface had embed code for each file in the gist. Anyon

4条回答
  •  我在风中等你
    2020-12-22 21:14

    Medium

    For those who want to use it on the medium, Medium does not support and does not query parameters in the URL when you add it after the paste of the URL. So just follow these 4 steps IN THE ORDER.

    So:

    ⚠️ Order matters!

    1. Copy the (multi-file) gist path. e.g.:
    https://gist.github.com/MojtabaHs/91e34fd0e987fe7ce801936dc6ece0e8
    

    1. Paste it somewhere else than the Medium article that not preserves the rich data of the text. Like an online textbox for example:

    ⚠️ Do not hit search or return button


    1. Append the query param for the file to the URL. e.g:
    https://gist.github.com/MojtabaHs/91e34fd0e987fe7ce801936dc6ece0e8?file=Interface.swift
    

    Note that ?file=Interface.swift at the end of the URL, right?


    1. Copy and paste it in the article and see the magic

提交回复
热议问题