1

I've seen a lot of questions about embedding Stack Overflow questions on other websites, but I'm thinking the other way around. Is it possible to embed, say, a StackBlitz instance inside a question, so people can see directly the code I'm experimenting with. I thought it just might be easier, but I also included a text link to the StackBlitz as well.

I am not sure if this is really a feature-request; I am just wondering if it's possible. Or even a good practice -- perhaps embedding a full StackBlitz isn't the thing to do, and I should just copy the entire file's text into a code block? I don't know.

1
  • 8
    All posts on Stack Overflow must be self-sufficient and reproducible without the need to visit an external service (which might or might not become accessible). If the question requires a full-scale external demo that cannot be fit into what is allowed by Stack Snippets natively, the asker did not provide a Minimal Reproducible Example. No need to copy the entire file's text - askers are expected to debug their programs to a point where they at least can identify where exactly the issue happens. Commented Jul 2, 2022 at 20:52

1 Answer 1

12

In a limited sense (for HTML/CSS/JavaScript in the browser), yes: this is what Stack Snippets are for. But otherwise, no.

We require that Stack Overflow posts be understandable without relying on content from external sites (i.sstatic.net doesn't count, as that's within Stack Overflow's control—but that's not suitable for uploading code).

This is because over time, those links may break. This isn't a theoretical concern: as a moderator, I've removed or had to otherwise manually fix countless old posts that were no longer useful due to a site going down or changing its URL structure—and then there's the popular reference site that expired due to its maintainer passing away and had its domain purchased by a spammer selling steroids...after being linked 900+ times on the network.

Thus, your alternative suggestion to put the code in a code block is exactly correct. This ensures that anyone reading your question has everything they need to answer it, whether they're answering it today or 10 years from now when there's a new, better way to do it.

1
  • 1
    Thank you for this answer, this makes a lot of sense. Commented Jul 3, 2022 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .