SO provides great support for Q&A with Code Snippet capability. Many posts also provide external links to jFiddle.

Here are examples of an individual using an external jFiddle link and a code snippet.

I find both technologies very useful. However, SO's code snippets are significantly easier to execute and visualize as they are embedded within the webpage. External resources, like jFiddle, take the user away from the site ( temporarily ) and prevent a seamless integration.

My question: Can stack app developers extend the current Code Snippet capability to offer embedded third-party services? (Run and test code that is written during Q&A, yet remain on the SO webpage) There is no mention of this in API docs, and I am unsure if this is even possible.

Example scenario: The user posts a java question and provides some code to reproduce the problem. They format troubling code that is friendly for SO, and add a link to an external service that can execute it. All users get a chance to see "Run code snippet via third-party-app". third-party-app is registered with StackApps and agrees to some contract of execution. After someone clicks the "Run" button, SO provides the output without requiring the user to leave the webpage.

My reasoning: I understand that external websites might prove to be unreliable, and as such, OPs should post the code within the question they ask. The same holds for individuals that answer. However, supported technologies in this dev blog are behind what external resources offer. For example, online resources exist to compile java and c# code. If developers are allowed to extend the Code Snippet functionality, users of SO can be exposed to technology outside of SO. Since shared code in questions or answers is also formatted and third-party-apps are controlled by SO, "dead external resources" can be removed or fixed with ease. (I would infer) It would also leave it up to the user to select where their code can be run.

  • Welcome to Stack Apps! This is not a bad idea, so +1, but the company has stopped actively working on the API. Sometimes, small bugs are fixed, but that's about it.
    – Glorfindel
    Feb 13, 2021 at 7:10
  • @Glorfindel I'd be willing to offer my time to get this to work. Would they entertain my help?
    – angryip
    Feb 13, 2021 at 15:46
  • That's very generous of you but I'm not sure they will take the offer. A request to make the mobile apps open source has been declined: meta.stackexchange.com/q/315791/295232 and the reasons there apply to this case as well. Unless you're employed by Stack Exchange, you can't change the codebase. SEDE is about the only exception.
    – Glorfindel
    Feb 13, 2021 at 18:56


You must log in to answer this question.

Browse other questions tagged .