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
4 votes
0 answers
34 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....
user avatar
  • 172
13 votes
0 answers
105 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 ...
user avatar
  • 2,266
6 votes
0 answers
57 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 ...
user avatar
  • 1,648
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 ...
user avatar
  • 27
8 votes
0 answers
62 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. ...
user avatar
1 vote
0 answers
41 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 ...
user avatar
  • 18.2k
2 votes
0 answers
45 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 ...
user avatar
  • 1,072
5 votes
1 answer
155 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 ...
user avatar
  • 265
11 votes
1 answer
121 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 ...
user avatar
6 votes
1 answer
105 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 ...
user avatar
4 votes
0 answers
118 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 ...
user avatar
  • 526
1 vote
1 answer
88 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 ...
user avatar
  • 172
9 votes
0 answers
83 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 ?...
user avatar
1 vote
0 answers
48 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 ...
user avatar
11 votes
0 answers
166 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 ...
user avatar
1 vote
0 answers
158 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 ...
user avatar
  • 219
10 votes
1 answer
265 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 ...
user avatar
  • 1,171
-4 votes
1 answer
261 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 ...
user avatar
  • 221
6 votes
0 answers
88 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:
user avatar
16 votes
1 answer
124 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: ...
user avatar
  • 7,627
9 votes
0 answers
75 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 ...
user avatar
  • 239
-10 votes
2 answers
233 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 ...
user avatar
  • 99
8 votes
1 answer
207 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!";...
user avatar
3 votes
0 answers
47 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. ...
user avatar
13 votes
1 answer
131 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 ...
user avatar
  • 451
9 votes
0 answers
164 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 ...
user avatar
  • 199
5 votes
0 answers
83 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 ...
user avatar
  • 159
2 votes
2 answers
122 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 ...
user avatar
  • 33.3k
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:
user avatar
1 vote
0 answers
51 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 ...
user avatar
5 votes
0 answers
49 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 ...
user avatar
3 votes
1 answer
81 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 ...
user avatar
-11 votes
1 answer
106 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
174 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> ...
user avatar
  • 131
0 votes
0 answers
157 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 ...
user avatar
4 votes
0 answers
63 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 =...
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 ...
user avatar
2 votes
0 answers
33 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 ...
user avatar
  • 2,385
4 votes
0 answers
106 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.
user avatar
  • 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):
user avatar
5 votes
0 answers
47 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 ...
user avatar
  • 476
2 votes
1 answer
45 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 ...
user avatar
1 vote
1 answer
139 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 ...
user avatar
2 votes
0 answers
38 views

Does code snippet support CSS modules?

I want to ask a question related to CSS modules (https://github.com/css-modules). Is it possible to use CSS module syntax in a snippet? Such as @value? If yes, how can I enable it?
user avatar
  • 129
8 votes
2 answers
1k views

Embedding code sandbox

Is it possible to embed codesandbox preview in Stack Overflow? I have tried iframe, embed URL and links but none of it works.
user avatar
  • 183
3 votes
1 answer
80 views

Creative Commons Attribution-Share Alike and licences information on delivery

is it sufficient to add the Creative Commons Attribution-Share Alike Attributions inside the source code or should it be also added inside a separate licensing file on delivery. E.g. I create a ...
user avatar
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 ...
user avatar
  • 209
4 votes
0 answers
60 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 ...
user avatar
17 votes
0 answers
245 views

Add detailed help for Stack Snippets to the editor's "Code" section and the advanced help

Stack Snippets are markedly under-documented. Please update the "Code" section of the help you get when you click the (?) icon in the editor, as well as the advanced help, to provide detailed ...
user avatar
  • 22.4k
4 votes
2 answers
74 views

Is it new stack snippets feature: show few snippets in one scrollable block? [duplicate]

If snippets code have four spaces from start line, then in preview shown just And in finish view snippets shown in one scrollable block (function(){ // some code // some code /...
user avatar
  • 462