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
6
votes
0answers
43 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
0answers
46 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 ...
10
votes
0answers
151 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
0answers
100 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 ...
5
votes
0answers
132 views

Code snippet link text conflicts with underline

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 ...
-4
votes
1answer
169 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 ...
6
votes
0answers
86 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
1answer
121 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
votes
0answers
73 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 ...
-10
votes
2answers
195 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 ...
8
votes
1answer
201 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!";...
2
votes
0answers
37 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
1answer
124 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 ...
5
votes
0answers
61 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 ...
5
votes
0answers
80 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 ...
2
votes
2answers
82 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 ...
2
votes
0answers
28 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
0answers
48 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
0answers
47 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
1answer
74 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
1answer
105 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 ...
3
votes
0answers
112 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> ...
0
votes
0answers
139 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 ...
4
votes
0answers
54 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
0answers
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
0answers
26 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 ...
4
votes
0answers
97 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.
3
votes
1answer
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
0answers
46 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 ...
2
votes
1answer
41 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
1answer
126 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 ...
2
votes
0answers
35 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?
5
votes
2answers
701 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.
3
votes
1answer
75 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 ...
5
votes
0answers
61 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 ...
3
votes
0answers
46 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 ...
16
votes
0answers
167 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 ...
5
votes
2answers
70 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 /...
2
votes
0answers
50 views

How to add multiple HTML pages to code snippets on Stack Overflow [closed]

How do you add multiple HTML pages to code snippets on Stack Overflow? If your code is interlinked with multiple HTML pages, then how do you add multiple pages in code snippets on Stack Overflow?
2
votes
0answers
30 views

Console on snippet going behind contents

I was googling for a code and I reached this Stack Overflow page. Owl Carousel on change not working I tried running the code in answer and it will log something in console in every slide change. ...
2
votes
0answers
32 views

Is the behaviour of code snippets correct, when doing a review task?

I was reviewing a post, and it looked to me that it had an obvious error in its code-- but it had a Code Snippet button, so I decided to click it to make sure this obvious error was there. Sure ...
4
votes
0answers
28 views

Prompt for confirmation when navigating away from stack snippet

In the following specific case: Click 'Ask Question' Click the stack snippet button without entering any other text or question titles or anything in the editor first. When you navigate away from ...
3
votes
1answer
42 views

While undeleting deleted answer, the snippet seems missing

Yesterday I made an answer to this question Why does width and height affect how a flex item is rendered?. I got some downvotes and so I decided to check am I missed something. I temporarily deleted ...
16
votes
0answers
351 views

SCSS, Sass and other CSS preprocessor support for code snippets

Add a possibility to run SCSS, Sass and other CSS preprocessors (LESS, Stylus, PostCSS, maybe others) in code snippets. Many developers use CSS preprocessors. This will remove need to convert demos to ...
2
votes
0answers
55 views

Add allow-same-origin to the Stack Snippet sandox in order to be able to run Geolocation API

Related support question: ERROR(1): User denied Geolocation Please add allow-same-origin to the Stack Snippet sandbox in order to be able to use the Geolocation API. As example, the following code ...
5
votes
1answer
2k 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 ...
8
votes
0answers
126 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 ...
-3
votes
1answer
70 views

Code snippets numbering lines with Number Anchors

This topic has been discussed before in Why are there no line numbers in the code listings?. The most powerful reason that prevents the implement of line numbers is changing code lines numbers and ...
2
votes
0answers
19 views

Repeating Run Code Snippet row when other answer gets reloaded

In a nutshell, this is the problem: You have an answer with a code snippet. There's another answer that just got updated. You see the "an edit has..." message and click on it. The moment, the other ...
6
votes
0answers
112 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 ...