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
101 views

Can the Stack Overflow code snippet facility be updated with newer library options?

In Stack Overflow, there's a useful facility for adding runnable code in HTML and JavaScript. There is a dropdown list on the left-hand side of the dialog which offers several third-party libraries. ...
quilkin's user avatar
  • 229
13 votes
0 answers
181 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 ...
Zach Jensz's user avatar
6 votes
0 answers
103 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 ...
nicael's user avatar
  • 34.6k
7 votes
0 answers
117 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,...
nicael's user avatar
  • 34.6k
3 votes
0 answers
184 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 ...
Throvn's user avatar
  • 131
12 votes
1 answer
168 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 ...
Arulkumar's user avatar
  • 38.6k
22 votes
1 answer
416 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
  • 323
4 votes
0 answers
134 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 ...
aplua's user avatar
  • 45
4 votes
0 answers
48 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....
outis's user avatar
  • 172
14 votes
0 answers
159 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,959
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 ...
Henry Ecker's user avatar
  • 4,672
1 vote
0 answers
39 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 ...
CiY3's user avatar
  • 27
8 votes
0 answers
87 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. ...
Oleg Barabanov's user avatar
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 ...
bad_coder's user avatar
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 ...
Sam Onela's user avatar
  • 1,984
5 votes
1 answer
176 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 ...
jcubic's user avatar
  • 265
11 votes
1 answer
131 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 ...
SK-the-Learner's user avatar
5 votes
1 answer
131 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 ...
Toothpick Anemone's user avatar
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
  • 596
1 vote
1 answer
98 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 ...
Black's user avatar
  • 172
9 votes
0 answers
90 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
1 vote
0 answers
53 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 ...
customcommander's user avatar
13 votes
0 answers
187 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
1 vote
0 answers
260 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 ...
Nate's user avatar
  • 219
16 votes
1 answer
434 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 ...
janw's user avatar
  • 1,704
-4 votes
1 answer
323 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 ...
zomega's user avatar
  • 383
6 votes
0 answers
90 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:
Kaustubh Badrike's user avatar
17 votes
1 answer
143 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
  • 15.3k
9 votes
0 answers
80 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 ...
flyx's user avatar
  • 239
-10 votes
2 answers
328 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 ...
Coola's user avatar
  • 99
8 votes
1 answer
216 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!";...
David Wheatley's user avatar
3 votes
0 answers
55 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
13 votes
1 answer
140 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
  • 461
10 votes
0 answers
280 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
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 ...
mwilson's user avatar
  • 159
2 votes
2 answers
221 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 ...
Arulkumar's user avatar
  • 38.6k
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:
a wizard arachnid's user avatar
1 vote
0 answers
56 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 ...
Awesome Poodles's user avatar
5 votes
0 answers
51 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 ...
αλεχολυτ's user avatar
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 ...
Vidhyut Pandya's user avatar
-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
595 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> ...
Barrosy's user avatar
  • 131
0 votes
0 answers
166 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 ...
Alvaro Montoro's user avatar
5 votes
0 answers
72 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
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 ...
Tim Wheeler's user avatar
2 votes
0 answers
35 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 ...
nickhar's user avatar
  • 2,395
4 votes
0 answers
121 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.
Sakshi's user avatar
  • 141
3 votes
1 answer
60 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):
iBug says Reinstate Monica's user avatar
5 votes
0 answers
49 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 ...
DJSpud's user avatar
  • 486
2 votes
1 answer
47 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 ...
iBug says Reinstate Monica's user avatar