Skip to main content

Questions tagged [stack-snippets]

Stack Snippets are runnable code sandboxes of the front-end languages HTML, CSS, and JS for use within a Stack Exchange post. Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.

Filter by
Sorted by
Tagged with
794 votes
53 answers
23k views

Feedback requested: Runnable code snippets in questions and answers

Today we're proposing a new feature to the Stack Overflow community: Stack Snippets. What do Stack Snippets do? Stack Snippets make code blocks runnable. Here's an example: alert("You can even do ...
Haney's user avatar
  • 34.3k
168 votes
1 answer
34k views

I've been told to create a "runnable" example with "Stack Snippets". How do I do that?

Sometimes when asking a question or posting an answer related to HTML, CSS, and/or JavaScript, I've been told to create a minimal, complete, and verifiable example using Stack Snippets. How do I do ...
168 votes
10 answers
3k views

Stack Snippets being misused

Not long after the general introduction of Stack Snippets, there are already some posts that use them wrongly. Today I came across a question with a stack-snippet containing CasperJS code which is ...
Artjom B.'s user avatar
  • 61.7k
237 votes
108 answers
16k views

Stack Snippets Sandbox - Try It Out Here!

This post is dedicated to testing out the newly announced Stack Snippets feature. Feel free to answer with your own Stack Snippets, and have some fun!
139 votes
22 answers
5k views

Feedback requested: Stack Snippets 2.0

Thanks to the incredibly positive reception and great feedback on our announcement of Stack Snippets, today we've shipped version 2.0. Don't know what Stack Snippets are? Just read the link above for ...
Haney's user avatar
  • 34.3k
190 votes
18 answers
4k views

Feedback Requested: Code Editor and Stack Snippets

You probably all know about Stack Snippets (a.k.a. "JavaScript/HTML/CSS Snippets"), which we introduced almost a year ago. You probably also know that Stack Snippets are routinely misused for ...
Thomas Orozco's user avatar
8 votes
3 answers
665 views

Support running snippets in languages other than just JavaScript

From the Snippets Announcement Why? Every question is better for having minimal, reproducible code. ... Similarly, answers that include runnable code are easier to use and understand, because you can ...
gman's user avatar
  • 106k
25 votes
1 answer
665 views

Should we edit our old posts to include Stack Snippets?

Obviously only our posts which include HTML, CSS, and/or JavaScript, and that would perhaps benefit by having this feature in the post itself. What does Stack Exchange Inc. think? What do the ...
CRABOLO's user avatar
  • 8,744
174 votes
2 answers
11k views

How do I create a React Stack Snippet with JSX support?

In the Stack Snippets editor, I can see a drop-down box for including a version of React, but how do I actually create a snippet using React with JSX in it? Return to FAQ index
86 votes
2 answers
2k views

Allow to hide sections of Stack Snippets

I just answered a question about a JavaScript issue, and wanted to provide a runnable snippet with a complete demo based on the asker's code. The problem lies in the fact that the CSS is irrelevant ...
Lucas Trzesniewski's user avatar
46 votes
1 answer
661 views

Why aren't Stack Snippets available in the documentation beta? [closed]

Standard code highlighting works as it has for ages in the Documentation beta, but the Stack Snippets function doesn't exist there. Why not? For HTML, JavaScript (and the millions of related JS ...
j08691's user avatar
  • 207k
27 votes
2 answers
428 views

Snippets aren't working when refreshing an edit

Yes the title isn't very clear but here is the steps to reproduce the issue: You are in a question page where a post (either the question or an answer) contain a snippet An edit is made to the post ...
Temani Afif's user avatar
19 votes
1 answer
257 views

Stack Snippets delimiters are being parsed too eagerly

Stack Snippets have some strange issues centering around the way the delimiters are parsed. I was going to report an indentation bug, but then I was prevented from posting that by what seems to be an ...
BoltClock's user avatar
  • 719k
69 votes
0 answers
1k views

Update the version of Babel Standalone (and others) used by Stack Snippets

Please update the version of Babel Standalone used by Stack Snippets (and update the available versions of other scripts in the drop-down lists; ideally, update that list automatically). It's ...
T.J. Crowder's user avatar
52 votes
1 answer
920 views

Stack Snippets Console can't output ES6 data types

console.log(new Map([["a", 1], ["b", 2]])); // console: Map(2) {"a" => 1, "b" => 2} // SO console: {} console.log(new Set([1, 2, 3])); // console: Set(3) {1, 2, 3} // SO console: {} ...
Amadan's user avatar
  • 197k
42 votes
2 answers
1k views

MathJax-only code snippets could be simplified into Math Snippets

The request to enable MathJax on SO was declined for some good reasons. But after that discussion, Stack Snippets were introduced, making it possible to load and execute external JavaScript on demand. ...
user avatar
37 votes
0 answers
334 views

Code Snippet as a formatting tool

Since the Stack Snippet is being misused, let us make it a feature! My proposal is to add a dropdown to select the language, and let people paste their code inside to format the code. The language ...
nhahtdh's user avatar
  • 56.7k
129 votes
1 answer
1k views

Should it be more obvious that stack snippets are only meant for HTML/CSS/JS?

Sometimes I see questions like one, two and three where a user unfamiliar with stack snippets pastes their C or C++ code into the stack snippet box. Now admittedly this doesn't happen very often, but ...
user avatar
76 votes
4 answers
2k views

How can we discuss malicious code?

Since we're programmers, security is absolutely something we should all be concerned with. As such, it's important to understand what vulnerabilities to protect against and watch out for, and why ...
jpmc26's user avatar
  • 29.5k
61 votes
0 answers
448 views

Replace code snippets by normal code block if JavaScript tag is absent

Some users (probably mostly new users) tend to use the "code snippet" tool for code in languages that aren't supported by Stack Snippets. Would it not make sense to disable the code snippets ...
assylias's user avatar
  • 327k
52 votes
3 answers
1k views

Stack Snippets and non-runnable code

Since the introduction of Stack Snippets, I've noticed them showing up frequently with non-runnable code. (I spend most of my time on the google-apps-script tag, which is a server-side js variant. I ...
Mogsdad's user avatar
  • 45.6k
49 votes
0 answers
399 views

Abusing the Code Snippet for wrong languages

I see this at least once a day, someone puts their Java or even C code in the Code Snippet thing that's meant exclusively for HTML / CSS / JS. What it means - someone has to manually remove the magic ...
MightyPork's user avatar
  • 18.7k
35 votes
1 answer
296 views

Warning when snippet mark-up is used on posts not tagged with <...>

I've seen many questions where Java, SQL, etc. code was marked up using a snippet tool. In such cases we are presented with a more cluttered screen for no benefit at all. Since currently only HTML/...
PM 77-1's user avatar
  • 13.2k
91 votes
8 answers
3k views

Stack Snippets console output

TL;DR: see UPDATE#3 I recently answered a Stack Overflow question and inserted a stack snippet for a quick demo of my solution. However, it was a simple JavaScript-only related problem and I didn't ...
gion_13's user avatar
  • 41.5k
75 votes
3 answers
1k views

Cannot create Stack Snippet

I've tried in Chrome and Internet Explorer on my machine here, and it will not let me insert a snippet. I press the Insert into post button and nothing happens. Even here on MSO it's not working. ...
DavidG's user avatar
  • 118k
53 votes
2 answers
626 views

Can we have newer versions of third-party libraries in the Stack Snippets tool?

The latest available version of jQuery in the snippet editor is 2.1.1. This was released mid 2014! We're currently on version 2.2.4 and even jQuery 3 is out now with the first patch levels. Or another ...
eisbehr's user avatar
  • 12.4k
52 votes
2 answers
1k views

Stack Snippets logging nested objects weirdly

Now that @canon has (more than) fixed the issues, I'm updating this question from a bug report to a feature-request: Please update the stack snippets console code. The current version of the stack ...
Cerbrus's user avatar
  • 72.4k
43 votes
0 answers
737 views

Create a magic link introducing stack snippets

I just happen to come across another fiddle request. One feedback this thread: Inform the users about the existence of stack snippet while requesting external demos in comments received was the ...
T J's user avatar
  • 43.1k
42 votes
3 answers
870 views

External CSS in Stack Snippets takes priority over internal CSS

Stack Snippets are great, but I keep running into a recurring problem: external CSS is injected directly into the <body> tag and not the <head> but the internal CSS is injected into the &...
James Donnelly's user avatar
36 votes
0 answers
538 views

Please Fix Stack Snippets

Please fix the many outstanding issues with Stack Snippets: Why won't this snippet with async await work here on Stack Overflow snippet editor? Update the version of Babel Standalone (and others) ...
T.J. Crowder's user avatar
32 votes
2 answers
1k views

Stack-Snippets vs PasteBin, jsFiddle, and JSbin

One of our fellow SO members has been keenly proposing that SO snippets should trump external services like jsFiddle commenting answers in this question. Is there an overall consensus that snippets ...
David's user avatar
  • 3,176
27 votes
1 answer
744 views

Why won't this snippet with async await work here on Stack Overflow snippet editor?

Why won't the following snippet work here on Stack Overflow? I'm trying to add some example of basic async/await and returned promises. This exact same piece of code works just fine on my development ...
cbdeveloper's user avatar
  • 30.7k
21 votes
1 answer
319 views

Sticky top bar obscures full screen code snippets

The top menu bar, when set to sticky, hides content when one run a snippet in full screen. Is there some new setting to control this that I might have missed?, or someone else missed something :) ...
Asons's user avatar
  • 86.7k
14 votes
1 answer
792 views

Please can we have runnable Python snippets using Skulpt?

Python is an extremely popular language, especially for beginners, who also happen to be the people who have the hardest time understanding how to post a MCVE as well as a traceback or output. Being ...
Alex Hall's user avatar
  • 35.9k
89 votes
2 answers
2k views

Help us easily create Twitter-Bootstrap Stack Snippets

There are currently five different ways to quickly bootstrap (no pun intended!) a Stack Snippet with specific frameworks: jQuery d3 KnockoutJS Angular Custom / "external library" At least one ...
Jeroen's user avatar
  • 63k
40 votes
1 answer
527 views

Bug in snippet's "Tidy" button

If you have a snippet in a StackOverflow post and you hit the Tidy button, the result is not always equivalent to the original! Take this snippet for instance <input name = textbox> ...
Mr Lister's user avatar
  • 46.4k
33 votes
2 answers
1k views

Add allow-modals to the sandbox of Stack Snippets, snippets are broken in Chrome 46+

Chrome blocks modal dialogs such as alert, confirm and prompt in sandboxed iframes unless allow-modals is set. This behavior became the default as of Chrome 46 and Opera 34. This breaks Stack ...
Rob W's user avatar
  • 347k
32 votes
3 answers
794 views

Sandbox the console separately?

Consider the below Snippet: console.log("Hello."); console.log("OMG. See how big?"); div { border: 1px dashed #f90; background: #fc6; line-height: 5; text-align: center; } ...
Praveen Kumar Purushothaman's user avatar
27 votes
1 answer
690 views

Some posts with snippets do not have a run button - Why?

Considering this post (an answer): scrollTop() jQuery not working I couldn't see the Run Snippet button. Any reason?
Praveen Kumar Purushothaman's user avatar
26 votes
1 answer
619 views

Is there an easier way to mess (fiddle) with someone's code snippet?

I posted a question with an HTML/CSS code snippet. The answer also provides code snippets, but they're not working 100%. Some are close though, so I'd like to mess with them, the same as when I wrote ...
Dov's user avatar
  • 16k
11 votes
4 answers
2k views

Is it possible to have Python code snippets in Stack Overflow?

Is it currently possible to have Python snippets on Stack Overflow? Python is getting increasingly popular and is also currently the most tagged language in Stack Overflow. It has got 1177 questions ...
Safwan Samsudeen's user avatar
9 votes
1 answer
353 views

Occasional failure to save when improving a question using the Snippet Editor

Occasionally (say, 1 in every 25) when improving another users' question by adding their existing code to a snippet using the editor I am unable to save the changes I have made; nothing happens when I ...
Rory McCrossan's user avatar
9 votes
0 answers
195 views

Stack Snippets Returning a 503 Service Unavailable Error

Not sure if it's just me but Stack Snippets seems to be down E.g. http://stacksnippets.net/ Hi
j08691's user avatar
  • 207k
3 votes
0 answers
89 views

Can't view input part of snippet editor

For some reason, when I try to open the stack snippets editor, I only see the sidebar, and I don't see the input fields on the right side. Here's a screenshot of the problem (along with the console ...
Freyja's user avatar
  • 40.4k
102 votes
1 answer
2k views

Code snippets are a pest

I find it extremely cumbersome that code snippets add lots of buttons and borders and make it much harder to read through questions. I answer a lot of question in angular2, and in a lot of questions ...
Günter Zöchbauer's user avatar
38 votes
0 answers
210 views

Add information on Stack Snippets to Help Center

There isn't currently any page on the Stack Overflow help center that relates to Stack Snippets, and a search for that term in the help center does not return any valid results. I have twice used a ...
AmeliaBR's user avatar
  • 27.5k
37 votes
0 answers
499 views

Close Snippet obstructed in Full Screen

Alter the z-index of fixed top bar when using Full Screen Snippets has been fixed. But click on the full screen preview and try to close the snippet? Hello! Click on the full page above right and ...
Praveen Kumar Purushothaman's user avatar
27 votes
0 answers
346 views

Are there any built-in resources that you can link to from within question to use in a code snippet on the Stack Overflow domain?

I answered this question, which asks how to be able to start/stop an audio clip on mouse enter/leave. I came back to it while later after seeing the new runnable code snippets and wanted to play ...
zero298's user avatar
  • 26.6k
25 votes
1 answer
584 views

Please update the library versions included as "Options" in Stack Snippets (code provided)

Updating the list of libraries was last done in response to a 7-year-old request. That one was status-completed after Shog9 updated all of the listed libraries to the most recent versions available on ...
mplungjan's user avatar
  • 175k
25 votes
0 answers
273 views

Snippet Editor gets out of sync scrolling and gets very difficult to use

Generate a 1000 lines and paste it into the JavaScript area of a snippet I just opened the JavaScript console and typed a = []; for (var i = 0; i < 1000; ++i) {a.push("line:" + i); } console.log(...
gman's user avatar
  • 106k