Stack snippets are a great feature. They greatly increase the reproducibility of answers in JavaScript, HTML, and CSS, as well as supported frameworks like React.
Already, many answers link to external services for this functionality. Many Rust questions link to the Rust playground and Python questions to repl.it. This greatly increases the quality of these questions, but often people post only a link and don't include the actual code which harms the quality.
My request is to build a feature like this into Stack Overflow, to promote short reproducible examples in all languages. Either by building something yourself or by partnering with one of the many services that offer code execution.
Some services that include a convenient API for integration include:
- Piston
- Attempt this Online
- Many interpreted languages can be built to WebAssembly, like Pyodide
There is an extensive list here. Not all of these offer APIs though.
Of course, using any of these services should include a financial contribution to their hosters, so they can deal with the increase in scale required.
I'm aware of this question which suggests iframing a specific service while I think a better approach is keeping the UI entirely inside SO and then communicating via a API.