Integrating Github Gists on MSDN and Technet's Posts! RRS feed

  • General discussion

  • the Idea is to have a feature to embed code that already exists on Github, for example, consider this gist embeddable script tag:

    <script src="https://gist.github.com/mouadcherkaoui/2d0fc04017a084d5f2e5d596a2381c81.js"></script>

    to access it through the API:  we use this address: https://api.github.com/gists/2d0fc04017a084d5f2e5d596a2381c81

          "url": "https://api.github.com/.../2d0fc04017a084d5f2e5d596a2381c81",
          "id": "2d0fc04017a084d5f2e5d596a2381c81",
          "files": {
               "UIHelper.cs": {
               "filename": "UIHelper.cs",
               "type": "text/plain",
               "language": "C#",
               "raw_url": "https://gist.githubusercontent.com/.../4d6343.../UIHelper.cs",
               "size": 6778,
               "truncated": false,
               "content": "using System.Collections.Generic;\nusing System.Windows;\nusing System.Windows.Media;\n\nnamespace Hardcodet.Wpf.Util\n{\n ........}"

    then we can already use the api or the embed tag in the front end part, for example:

    1. Calling the API to list the user's public Gists. https://apis.github.com/users/username/gists
    2. Let the user select a Gist.
    3. Calling the API to load the Gist's Content. https://apis.github.com/users/username/gists/ Id
    4. Let the user choose which content to embed.
    5. and then loading the content in the post.

    Good Coding.

    Tuesday, November 6, 2018 12:54 AM

All replies

  • Question: Will the reader of the post with this embedded code be required to have a GitHub account to see the code?

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Tuesday, November 6, 2018 2:49 PM
  • Hi Richard,

    I think the answer is yes if the gist is public, to tackle this part we can use for example a call to Github's APIs and extract the gist content, and store it as any code in forums, but I think it should be hard to integrate with existing architecture.

    Best Regards,


    Tuesday, November 6, 2018 7:09 PM