As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [stack-snippets]

Stack Snippets are runnable inline code samples. Currently HTML, CSS, and JavaScript are supported. 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
204 votes
6 answers
5k views

Add a console to Stack Snippets

Currently, to see console.log() entries from StackSnippets, you need to open your browser console, and make sure it's recording from frames. Things could be a lot simpler if you would add a console to ...
Scimonster's user avatar
  • 14.7k
21 votes
1 answer
373 views

On what sites are Stack Snippets enabled?

Stack Snippets is now a feature on some Stack Exchange sites. On what sites is this feature enabled? Where is it being discussed? And where has it actively been decided not to implement the feature? ...
62 votes
12 answers
1k views

Stack Snippets Upgrade: Virtual Console

It's been a long time since we worked on Stack Snippets. I'm sorry. It's mostly because I created it, then I got promoted to management, and now I don't code much anymore and nobody else has time to ...
Haney's user avatar
  • 7,473
44 votes
25 answers
5k views

Stack Snippets Sandbox: Try It Out Here! [duplicate]

This post is dedicated to testing out the newly announced Stack Snippets feature. Feel free to answer with your own Stack Snippets!
4 votes
0 answers
120 views

If you run a code snippet, a hat still appears (hats are above snippets in the Z-order) [duplicate]

If you run a code snippet, a hat still appears. Steps to repro: Go to a question where there is a snippet and where the OP wear a hat well, if you find that hard, just go here. rowspan not changing ...
ppwater's user avatar
  • 576
13 votes
1 answer
137 views

Clicking to reload an updated answer removes the code snippet buttons and removes syntax highlighting

If you are looking at an answer with a code snippet in it, and the answerer updates the answer, you see An edit has been made (etc.). If you click that, the answer is refreshed, but the code snippet ...
Peter B's user avatar
  • 451
11 votes
0 answers
182 views

Code snippet comments in code formatting break the formatting of the post

When special HTML comments used for snippets are present in a post, these comments break the rendering of the post. For example, consider the following markdown code (notice that the whole thing is ...
Donald Duck's user avatar
  • 7,825
6 votes
1 answer
95 views

How do I select which lines of code to show and which lines to hide?

Sometimes only 10 lines of 100 are relevant to the question/answer, the other 90 are setup. Is there a way to hide 90 those in lines in the answer?
gman's user avatar
  • 4,350
4 votes
1 answer
225 views

Do Stack Exchange sites allow to include copyright/license in code snippets?

Suppose we see an answer with a code snippet like this: // Copyright (c) 2017, <some guy's name and email> // // Permission to use, copy, modify, and/or distribute this software for any // ...
Alexander Abakumov's user avatar
15 votes
1 answer
117 views

Stacksnippets has the incorrect SSL certificate :(

As discussed here, was prompted to post it as a brand new question, so here it is :-). Earlier today there was an issue with Stack Snippets, caused by the move to Denver. That issue was fixed, but ...
AStopher's user avatar
  • 589
10 votes
0 answers
163 views

Allow hiding walls of text somehow

Sometimes there are questions which could benefit from additional information in an unobstrusive way. Example: A question about a bug in an MCVE with sample data to use. It might be nice to allow ...
Vogel612's Shadow's user avatar
9 votes
1 answer
145 views

Can I call out different parts of a snippet

I often format answers something like Do this var a = b * c; Then do this log("the answer is " + a); Is it possible to pull those lines separately out of a snippet of say 10 lines to include in ...
gman's user avatar
  • 4,350
7 votes
0 answers
74 views

Snippet CSS content is corrupting the console display

I have encountered a bug in the Stack Overflow snippet interface. I have created a div and wrote some css in the CSS section for the same. I noticed that the div CSS content is affecting the console ...
Bhuwan's user avatar
  • 209
5 votes
1 answer
125 views

How do I force Stack Snippets to render as a code block?

Usually, posting blocks of code on Stack Exchange websites is very simple: You can indent everything by 4 spaces. Both lines are indented by 4 spaces. or ``` You can start and end the code ...
Samuel Muldoon's user avatar
4 votes
0 answers
73 views

Browser back leaves page after going fullscreen in stack snippet

Opening a Stack Snippet in full screen should use history.pushState() to add an entry to the browser history stack. Clicking back will then close the snippet rather than leave the page completely.
Austyn Mahoney's user avatar
3 votes
0 answers
106 views

Copy-paste from question to snippet

When I'm editing a stack snippet, I often want to copy code from the original question into the snippet. But while the snippet editor is on display, there's no way to access the question, other than ...
Barmar's user avatar
  • 2,211
22 votes
2 answers
189 views

After the move to Denver Stacksnippets.net is offline

After the move of all services to Denver it was tweeted that there was some performance degradation. Initial reports showed that at least chat search seemded to be the victim of that. I would like to ...
rene's user avatar
  • 85.5k
21 votes
1 answer
364 views

Who sniped the snippet?

I am trying to ask a question on Stack Overflow but the code snippet button is missing for some reason. Expecting this Currently Available How can I bring back the code snippet?
smpa01's user avatar
  • 313
21 votes
2 answers
579 views

How is my browser protected from XSS in Stack Snippets?

Firefox 32.0.2 with NoScript and AdBlockEdge. Steps I have done to enable Stack Snippets: Allowed scripts from http?://stacksnippets.net In NoScript settings, went to XSS tab and added exceptions ...
Deer Hunter's user avatar
  • 6,217
20 votes
0 answers
180 views

Deploy updated snippet script and implement a UI for the Stack Snippet console options

Back in May 2016 @canon implemented several useful options in the Stack Snippets console script (there's a demo here). Please Deploy the updated script so those options can be used (currently, only ...
T.J. Crowder's user avatar
  • 22.7k
17 votes
1 answer
129 views

Ejecutar (Run) button background is the same color of the button text: white

This is related to Submit buttons change color when hovering on non-English Stack Overflow sites, but in this case it's a problem because the button background is the same color as the button text: ...
Rubén's user avatar
  • 12k
15 votes
2 answers
279 views

Snippets editor won't insert and close on SO

This just started: I went to add a snippet to an answer on SO, typed it in, clicked the Insert button, and...nothing. No error in the console, but nothing inserted in the question. Earlier today they ...
T.J. Crowder's user avatar
  • 22.7k
14 votes
0 answers
145 views

Bump outdated React version code snippet

The Stack Snippet React version is outdated to such an extent that using a CDN link has become mandatory. Stack Snippets provide React 16.6.3 as highest version. However; React 16.6 is a very old ...
0stone0's user avatar
  • 2,542
14 votes
3 answers
285 views

Are Stack Snippets a good enough reason to increase the 30k post limit?

On all public Stack Exchange sites, questions and answers cannot be longer than 30,000 characters. One clear benefit to this limit is that users won't attempt to post tens of thousands of characters ...
Calvin's Hobbies's user avatar
14 votes
0 answers
162 views

How to make use of the "Stack Snippets" more intuitive to new users?

I noticed that some users are using the Stack Snippets for ruby, vb, java, php and other "things", even though implicit in the text fields the words html, css and javascript. I suggested: ...
Guilherme Nascimento's user avatar
12 votes
0 answers
177 views

Snippet Tidy breaks Optional Chaining

The Tidy button is adding spaces before and after any question mark that is part of an optional chaining operator (?.). This breaks optional chaining. It appears to be recognizing question marks as ...
user120242's user avatar
10 votes
0 answers
257 views

Improved support for React in the code snippet editor?

Overview of Feedback Supported React Versions Development vs. Production Auto-enable Use BabelJS / ES2015 Insert React boilerplate React Version Currently, the newest version of React available in ...
skovy's user avatar
  • 209
9 votes
0 answers
89 views

JavaScript code snippet Tidy function injects a separating space into the null coalesce operator

For JavaScript snippets, the Tidy feature injects a space between the question marks that compose the nullish coalescing operator ??[1]. Example: Prior to Tidy: console.log(((a, b) => { return a ?...
RamblinRose's user avatar
6 votes
0 answers
127 views

Can't run Stack code Snippets on the mobile site

Is it a known issue that stack snippets don't have the "Run code snippet" button underneath on the mobile version of the site? Searching for this yielded nothing, both on MSE and MSO. I've posted a ...
Dan Dascalescu's user avatar
5 votes
1 answer
101 views

Distinguish languages when displaying stack snippets

I just integrated my first snippet on an existing post, nice work. I put it on this post: https://stackoverflow.com/a/19932511/731138 Code appears without language distinction, with a small space as ...
Ninsuo's user avatar
  • 655
5 votes
0 answers
66 views

Allow the stack snippets console to be maximized

Consider the following stack snippet: // A Tree(a) is one of: // - null // - tree(a, Tree(a), Tree(a)) const tree = (value, left, right) => ({ value, left, right }); const buildTree =...
Aadit M Shah's user avatar
5 votes
1 answer
3k views

ERROR(1): User denied Geolocation

While I was researching in order to answer a question on Stack Oveflow en español, I decided to try the code on https://developer.mozilla.org/docs/Web/API/Geolocation/getCurrentPosition1. But I got ...
Rubén's user avatar
  • 12k
4 votes
0 answers
68 views

Snippet editor for touch devices can be opened if you show perseverance

Opening a code snippet editor via the button from the toolbar cannot be used on touch screen devices like my iPad, i.e. I see the following notice: But occasionally tapping code snippet button ...
αλεχολυτ's user avatar
3 votes
0 answers
49 views

Why aren't runnable code snippets formatted correctly within lists?

Consider the following code snippet. console.log("this line is all right"); console.log("but this line is indented"); This should be a part of the same bullet point but it's not. ...
Aadit M Shah's user avatar
3 votes
0 answers
50 views

The console should not display inherited properties

Currently, when you log an object to the virtual console, it shows all enumerable properties, both own and inherited. I think the inherited ones should be filtered out. Otherwise, the result can be ...
Oriol's user avatar
  • 1,423
3 votes
1 answer
91 views

Stack Snippet editor doesn't close with the background fade

While I was answering a question on Stack Overflow I wanted to insert a snippet... but then I changed my mind and pressed on the grayed out space near the snippet window (without releasing the mouse, ...
Spokey's user avatar
  • 183
2 votes
0 answers
45 views

Clicking back button after entering full screen [duplicate]

I'm clicking Run code snipped, then Full page and then the back button in my browser. And now I get a white blank page with only Close button. Expected results: the full screen should close and the ...
bpiec's user avatar
  • 121