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
12 votes
0 answers
121 views

Snippet button missing on Staging Ground question creation

I've been wondering why there is no 'create snippet' button when asking a question on Stack Overflow! I found this meta post asking where it was 7 months ago and staff mentioned that it was being ...
7 votes
0 answers
75 views

Stack Snippets on Safari is really bad at throwing errors

If you run any script that contains a error in Stack Snippets, on Safari you're greeted with a generous "script error": It does work correctly, however, in Chrome: Could you please teach ...
  • 34.1k
7 votes
0 answers
114 views

Stack Snippet is not supported on mobile devices - time to reconsider it

There have been a couple of cases when I wanted to write an answer on my iPhone and ran into non-working stack snippets editor, only to be greeted with magnificent error: not supported on mobile. Well,...
  • 34.1k
3 votes
0 answers
96 views

Add syntax highlighting support for Solidity

Recently, I have been active a lot on the Ethereum site. It got a recent design overhaul which shows that some progression is happening. Unfortunately, one of the main issues is that the Solidity code ...
  • 131
12 votes
1 answer
161 views

Editor in "Ask Question" page has two snippet icons

There are two snippet icons displayed in the question's body Markdown editing tool. Clicking on both icons opens the snippet section. I am able to reproduce this on Meta Stack Exchange and Stack ...
  • 37k
21 votes
1 answer
347 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?
  • 313
4 votes
0 answers
110 views

Appearance of HTML and CSS snippet is changing when it is indented

Today I was editing this question to change the formatting of its code into a runnable snippet. Once I configured the snippet, Stack Overflow would not let me submit my question because it thought ...
  • 45
4 votes
0 answers
43 views

Snippets in nested list items break nesting in post preview

Similar to "Why aren't runnable code snippets formatted correctly within lists?" (which appears to be resolved), when a snippet is in an item in a nested markdown list, it breaks the nesting....
  • 172
13 votes
0 answers
126 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 ...
  • 2,532
6 votes
0 answers
69 views

Indenting interactive interpreter invokes interesting interactions [duplicate]

Stack Snippets still attempt to be rendered when indented or within code fences. This behaviour was first observed "in the wild" on this (now deleted) answer on Stack Overflow and in ...
  • 3,960
1 vote
0 answers
37 views

Quicker copying of code examples [duplicate]

There are some code snippets in answers that I want to take, but it is slightly inconvenient to select the whole thing. Could there be a button added next to every snippet that lets you copy the whole ...
  • 27
8 votes
0 answers
80 views

A small problem when using "Tidy" to format JS in the "Code Sandbox" if the code uses "dynamic import"

When creating an answer to the question, I drew attention to the incorrect formatting of the JS code via "Tidy" in "Code Snippet" when using "dynamic import" in the code. ...
1 vote
0 answers
43 views

Alignment bug of Run Code Snippet buttons after approving suggested edit

I approved a suggested edit on this post by clicking the edit link directly on the post. After approving the edit it seems the "Run code snippet" buttons are vertically aligned in the diff ...
2 votes
0 answers
46 views

Stack Snippet console styles can be overriden [duplicate]

While editing a post I put the code into a runnable Stack Snippet and noticed that the styles affected the console: console.log('good luck reading this when the console wrapper dimensions are ...
  • 1,834
5 votes
1 answer
164 views

Can I reuse and republish code snippets from Stack Exchange sites under a new license?

I want to start a project, Scheme Cookbook, with a better license because an old cookbook, that is no longer available online, was licensed under LGPL, which requires the inclusion of the license with ...
  • 265
11 votes
1 answer
127 views

Is there something wrong with the snippets?

I posted a question on Code Review. It did not meet the standards and was closed. I asked the same question on Stack Overflow. While the code in Code Review produces error, the code in Stack Overflow ...
5 votes
1 answer
124 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 ...
4 votes
0 answers
119 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 ...
  • 576
1 vote
1 answer
92 views

Bug when running code snippet [closed]

I discovered a bug in the code editor. The following code has two videos, which should automatically play if the video is in the viewport and pause if the video is not in the viewport anymore. This ...
  • 172
9 votes
0 answers
88 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 ?...
1 vote
0 answers
51 views

Code snippet to offer additional libraries based on tags

The code snippet comes with a preselection of popular JavaScript libraries but it could extend its offering based on tags. For example in this case it could offer to load the Ramda library: I also ...
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 ...
1 vote
0 answers
223 views

How can I explicitly show the return value of a code snippet/sample

Is there an commonly accepted way (best practice if you wish) to show the return value of example code in markdown? One solution is to add a comment at the end of the function, but I am concerned ...
  • 219
16 votes
1 answer
366 views

Code snippet link text conflicts with underline in Firefox

On my browser, the Show code snippet link for the code snippet alert("This is some example code"); renders as follows: It looks like the line and the text are in separate elements, allowing ...
  • 1,256
-4 votes
1 answer
280 views

Can you make it possible to embed and run code snippets other than JavaScript/HTML/CSS?

This would really be great. I saw people posting code that doesn't run because of syntax errors. I told them that there are errors in the code but they didn't believe me. I had to explain exactly ...
  • 385
6 votes
0 answers
89 views

Inline diff view in revision history breaks runnable code snippets

When viewing the inline diff view in the revision history of a post, pressing the "Run code snippet" button tries to concatenate both revisions:
16 votes
1 answer
125 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: ...
  • 9,738
9 votes
0 answers
78 views

I cannot type certain special characters in the snippet editor

When using the snippet editor, I cannot type the following characters: : (deletes the next word instead) = (moves cursor forward a word instead) I assume this is because the snippet editor uses ...
  • 239
-10 votes
2 answers
254 views

Have "Run Code Snippet" before the code

Suggestion to move the "Run Code Snippet" section of a JavaScript/HTML/CSS snippet before the code in Stack Overflow. The reason I think this will be preferable, is because if the result does not ...
  • 99
8 votes
1 answer
215 views

Snippets can be formatted in monospace

Example answer with bug. By indenting the snippet generating comments, you can make a pretty odd snippet style, where the button titles are shown in a monospaced font. let test = "Hello, world!";...
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. ...
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 ...
  • 451
10 votes
0 answers
246 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 ...
  • 209
5 votes
0 answers
93 views

Inline Code Editor Unusable in Chrome

From what I've read, this is the proper place for this thing. I first thought tweeting you would get an answer, but I guess not. On Stack Overflow, when you answer/ask a question, you have the option ...
  • 159
2 votes
2 answers
169 views

How to find answers which use code snippets?

How can I find a list of answers which use code snippets? If I want to find answers having a code block for a specific tag, I can find it with the following search query: code:true is:a [C#] Is ...
  • 37k
2 votes
0 answers
30 views

Icons in snippet editor don't match link color

On sites with non-blue accent colors, the icons next to the "Tidy" and "Reset" links in the snippet editor stay blue and don't match the accent color. For example, on Code Golf:
1 vote
0 answers
52 views

The Snippets console is getting truncated too severely

Plenty of Snippets don't need HTML and just put their results in the console. See an example below. The problem is that the console only displays the last 50 lines -- which completely borks some ...
5 votes
0 answers
50 views

Links overlap on snippets

With certain screen widths, the “Hide results” and “Full page” links on snippets overlap (e.g. here, you need to run the code snippet to repro) Using a smaller or bigger width makes the page ...
3 votes
1 answer
82 views

Getting JS Error while clicking Copy Snippet to answer

To answer this question, I hit "Copy Snippet To Answer" button. But nothing happened. So that I checked my console and found below error. I did hard refresh and checked for the same, still getting ...
-11 votes
1 answer
107 views

Why are code snippets unavailable on profiles?

I have a profile. The picture contains a unicorn, and it talks of unicorns, but when I try to insert a snippet of code about unicorns: There is no snippet button: I also tried to manually add ...
user avatar
3 votes
0 answers
512 views

Options from HTML select inside a Stack Overflow question or answer will be positioned fixed [closed]

As the title already tells: When someone is answering a question or creating a question with a fiddle inside and when this fiddle contains a HTML <select> element, the child <option> ...
  • 131
0 votes
0 answers
160 views

Code snippet has a different behavior on Chrome when running in modal or post

I am using Chrome on a Mac, and noticed that some snippets were not working as expected. The interesting part is that when you edit the snippet (on the modal) they run fine; but when you run the ...
5 votes
0 answers
65 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 =...
4 votes
0 answers
39 views

Increase min-height on SE code snippets to prevent scrollbar from blocking code [duplicate]

When using Stack Exchange/Stack Overflow, anytime there's a one-line code snippet with a horizontal scrollbar, the majority of the code becomes covered. I am using Chrome v72.0.3626.109. Looks ...
2 votes
0 answers
34 views

Edits to a post to provide a snippet, but the snippet doesn't work

I found an edit to a post of mine on the 4th Feb this year. To be honest, there wasn't anything wrong with the post (other than a cheeky response/salutation, which I've now removed), but the user ...
  • 2,395
4 votes
0 answers
116 views

Vertical scroll bar overlaps top static bar

In attached image, Vertical scrollbar just overlaps when code snippets is too big and am scrolling up on code snippet area that time vertical scroll will overlap to top static bar.
  • 141
3 votes
1 answer
59 views

Broken view after expanding a snippet

Find a post with Stack Snippet (HTML/CSS/JavaScript) and go for "Expand snippet", for example this one. I got this strange view on Chrome 70 (Windows 10):
5 votes
0 answers
48 views

Why don't code snippets work in Tag Wikis?

I noticed code snippets don't work in tag wikis. E.g. https://stackoverflow.com/tags/css/info My reasoning for asking: In most front end tags there will be examples of the relevant code. Snippets ...
  • 476
2 votes
1 answer
46 views

How can I provide a utility on sites without Stack Snippets in an appropriate manner?

I just wrote this answer and in the last paragraph I decided to create a small utility as part of the answer. The utility is needed for the process. After submitting, I found that Android Enthusiasts ...
1 vote
1 answer
146 views

Can not create Stack Snippet with YouTube API

When writing How to remove event listener on Youtube player?, I tried to create a Stack Snippet but I could not add the YouTube API client, which was needed to display the issue. The client is on ...