Questions tagged [stack-snippets]
Stack Snippets are runnable inline code samples (currently HTML, CSS, and JavaScript are supported, but more languages are apparently on the roadmap). Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.
159
questions
794
votes
53
answers
22k
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 ...
169
votes
1
answer
27k
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 ...
165
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 ...
233
votes
105
answers
15k
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!
137
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 ...
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 ...
6
votes
3
answers
559
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 ...
23
votes
1
answer
657
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 ...
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 ...
28
votes
2
answers
357
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 ...
163
votes
1
answer
9k
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
85
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 ...
41
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. ...
36
votes
0
answers
327
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 ...
18
votes
1
answer
246
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 ...
128
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 ...
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 ...
59
votes
0
answers
423
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 ...
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 ...
48
votes
0
answers
392
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 ...
35
votes
1
answer
295
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/...
90
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 ...
76
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.
...
65
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 ...
50
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 ...
49
votes
1
answer
884
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: {}
...
44
votes
0
answers
734
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 ...
42
votes
3
answers
807
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 &...
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 ...
23
votes
1
answer
587
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 ...
21
votes
1
answer
316
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 :)
...
10
votes
1
answer
650
views
Please can we have runnable Python snippets using Skulpt?
Skulpt is an entirely in-browser implementation of Python.
No preprocessing, plugins, or server-side support required, just write Python and reload.
Python is an extremely popular language, ...
6
votes
2
answers
494
views
Is it possible to add a CSS compiler/transpiler (Sass or Less) in stack code snippets?
We need to support a CSS compiler - Sass and Less. If CSS compilers are not supported on Stack Overflow code snippet which must be included. If it can't be supported in stack code snippets, allow ...
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 ...
41
votes
1
answer
525
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>
...
34
votes
0
answers
484
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) ...
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 ...
30
votes
3
answers
773
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;
}
...
27
votes
1
answer
681
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?
26
votes
1
answer
616
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 ...
10
votes
4
answers
1k
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 ...
10
votes
0
answers
194
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
9
votes
1
answer
303
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 ...
3
votes
0
answers
83
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 ...
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 ...
49
votes
2
answers
556
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 ...
38
votes
0
answers
199
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 ...
27
votes
0
answers
345
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 ...
25
votes
0
answers
270
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(...
17
votes
0
answers
301
views
Add a means for tab stacking code snippets
The vast majority of questions on Stack Overflow come with a specific language tag and no post in the tag will contain any language other than that specified language.
However, for some questions are ...