Skip to main content

Questions tagged [stack-snippets]

Stack Snippets are runnable code sandboxes of the front-end languages HTML, CSS, and JS for use within a Stack Exchange post. 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
3 votes
1 answer
152 views

Autocompletion of usernames when replying to comments on mobile website (Chrome Android)

When replying to a comment on desktop, one can write @Fir and have an autocompletion of usernames in the discussion that begin by Fir. Then we can either do TAB or click on the suggested username to ...
17 votes
1 answer
117 views

Staging Ground editor doesn't have Stack Snippets

The Stack Snippet icon in the Staging Ground editor inserts a code block instead. The Markdown preview mode doesn't render Stack Snippets, either.
8 votes
2 answers
718 views

How can I include Tailwind CSS as external source in a Stack Snippet?

The recommended way of directly including Tailwind CSS according to their documentation is to add <script src="https://cdn.tailwindcss.com"></script> to the HTML head. But when ...
5 votes
0 answers
71 views

Full screen snippets has an incorrect z-index in post revisions

Example post with a snippet https://stackoverflow.com/posts/71191950/revisions Click "Run code snippet" and then click the "Full page" link The top bar, side bar, and post ...
237 votes
108 answers
16k views

Stack Snippets Sandbox - Try It Out Here!

This post is dedicated to testing out the newly announced Stack Snippets feature. Feel free to answer with your own Stack Snippets, and have some fun!
9 votes
1 answer
187 views

Stack snippets no longer show logs

The stack snippets have lost their logging ability as of very recently. Demo. And note that the console in the stack snippet is enabled. console.log("hello"); Happens in both Firefox and ...
14 votes
3 answers
1k views

How do I create a Vue.js Stack Snippet?

I found detailed instructions here on how to create a Stack Snippet for React, but I have been unable to figure out how to do so for a Vue.js component. How do I create a runnable Stack Snippet of a ...
1 vote
1 answer
73 views

Wrong ordering of Stack Snippets console output

I noticed what seems to be a pretty bizarre bug with the in-built Stack Snippets console in my answer here: https://stackoverflow.com/questions/77858025/how-to-negate-the-whole-regex/ When I run the ...
174 votes
2 answers
11k views

How do I create a React Stack Snippet with JSX support?

In the Stack Snippets editor, I can see a drop-down box for including a version of React, but how do I actually create a snippet using React with JSX in it? Return to FAQ index
-24 votes
1 answer
180 views

Is it possible to auto-convert HTML/CSS/JS code into a Stack Snippet?

Why can't there be a automatic feature that detects if its HTML/CSS/JS code and auto makes it into a Stack Snippet? This would be very helpful and nice because I always find so many posts WITHOUT a ...
2 votes
0 answers
126 views

How can I define the order for a code snippet? [duplicate]

I'm trying to ask a CSS-related question with some demo code. I have some JavaScript there which is not directly related to the problem and is only used to toggle some dynamic state so that the ...
3 votes
1 answer
196 views

"</script>" causing issues in code snippet editor

console.log('</script>'); This would end up with this HTML: <script type="text/javascript"> console.log(' </script> '); That means the string "</script>&...
25 votes
1 answer
585 views

Please update the library versions included as "Options" in Stack Snippets (code provided)

Updating the list of libraries was last done in response to a 7-year-old request. That one was status-completed after Shog9 updated all of the listed libraries to the most recent versions available on ...
5 votes
0 answers
157 views

Support newer versions of Vue.js 3 in Stack Snippets [duplicate]

Why don't we still have any of the Vue.js 3 versions close to end of 2023, available to choose when due to GitHub, Vue.js 3 has been with us since the end of 2019 (of course, we still can add it as an ...
11 votes
2 answers
391 views

Stack Overflow's snippet giving wrong results

Have a look at this answer. Run the snippet and observe the results in snippet's console. Now, find the same code in JSFiddle, run it, and observe the results in your browser's console. I can't ...
35 votes
2 answers
780 views

Guideline on edits that only add/remove stack snippet

I am a new approver for the Suggested Edits review queue. After going through several of them yesterday; I found that 3 to 4 of them were just suggestions either to add or remove Stack Snippets from ...
4 votes
0 answers
64 views

Will the stack-snippets formatter support modern JavaScript syntax? [duplicate]

Clicking "Tidy" breaks JavaScript code if it contains ?. Before formatting: const a = { b: 3 } console.log(a?.b) After formatting: const a = { b: 3 } console.log(a ? .b)
14 votes
1 answer
792 views

Please can we have runnable Python snippets using Skulpt?

Python is an extremely popular language, especially for beginners, who also happen to be the people who have the hardest time understanding how to post a MCVE as well as a traceback or output. Being ...
6 votes
2 answers
427 views

TypeScript in Stack Snippets

Lately, I have seen various questions that use TypeScript in Stack Snippets. They look like this: There is a problem with my code. Instead of doing x, it does y. Here is my code: function ...
10 votes
1 answer
154 views

Code snippet console render BigInt incorrectly

The console.log in code snippet currently does not support BigInt. To reproduce this problem, you may simply run this code snippet. The console shows null instead of 42. And it should show something ...
4 votes
0 answers
77 views

Stack Snippets console doesn't display JS BigInts [duplicate]

1n is a BigInt literal in JavaScript. BigInts currently display incorrectly/ don't display at all in the Stack Snippet console; console.log(1n) logs nothing and console.log([1n]) logs [null] instead ...
18 votes
2 answers
323 views

How do I make a code snippet with the new editor? Where did the button go?

Here is a comparison of old: and new: Where did the code snippet go? How can I make it now?
3 votes
0 answers
109 views

Add "Edit snippet" to snippets in an answer

Sometimes there're several snippets in an answer. It's very confusing/difficult to edit them in that case. Usually you look at a snippet you want to edit. Then you click 'Edit' for the answer it ...
6 votes
0 answers
99 views

Stack Snippet fullscreen close button is invisible [duplicate]

I'm running a Stack Snippet fullscreen, however the "Close" link is almost invisible. See image: Zoomed in: Could the close link have a solid background? Something like this: Or even ...
2 votes
0 answers
172 views

Latest Chrome breaks Stack Snippets (113.0.5672.126)

I've just upgraded my Google Chrome to version 113.0.5672.126 (Official Build) (arm64) on macOS 13.2.1. But afterwards, all Stack Snippets stopped working I've uninstalled all my extensions I've ...
20 votes
1 answer
373 views

Improvement request for Stack Snippets when misclicking preview area

While I was answering a question from Stack Overflow, I put some code in the Stack Snippets area. Sometimes, when I want to change back the code that I have typed, I wrongly click on the sentence edit ...
25 votes
2 answers
583 views

How to deal with a user reformatting snippet data to be in a single line

A user is going around reformatting Stack snippets to put all provided data on a single line, effectively turning things like this: const data = [{ id: 'id1', entries: [{ key: 'key1', ...
2 votes
0 answers
47 views

Broken snippet rendering [duplicate]

This question (in revision 1) has a really weird StackSnippet content that doesn't want to display properly. In the question it renders nested scrollbars: Scrolling down to the bottom of the outer ...
168 votes
1 answer
34k views

I've been told to create a "runnable" example with "Stack Snippets". How do I do that?

Sometimes when asking a question or posting an answer related to HTML, CSS, and/or JavaScript, I've been told to create a minimal, complete, and verifiable example using Stack Snippets. How do I do ...
13 votes
0 answers
189 views

Saving a Stack Snippet resets scroll to the top of the page

I've noticed while adding Stack Snippets or editing existing ones to answers, the scroll position is being reset to the top of the page when you click "Save and Insert into Post" to save your Stack ...
1 vote
0 answers
139 views

Why does Stack Overflow's code snippet show a different result compared with a normal editor?

Today, when I was answering a question, I observed that the result from the code snippet Stack Overflow give us is different from other editors. For example, this and this both shows the right result, ...
15 votes
1 answer
315 views

Feature request to allow executable XSLT code snippets

For questions related to HTML/JavaScript/CSS, Stack Overflow allows you to embed executable code snippets in a question and/or answer. I would suggest to allow that too for XSLT questions: XSLT 1.0 is ...
3 votes
2 answers
96 views

How do I hide the HTML preview for a Stack Snippet?

I have a simple JavaScript code snippet that displays an alert message. alert("Hello world!") Running the code snippet shows the alert as expected, but it also displays a white empty box ...
36 votes
0 answers
538 views

Please Fix Stack Snippets

Please fix the many outstanding issues with Stack Snippets: Why won't this snippet with async await work here on Stack Overflow snippet editor? Update the version of Babel Standalone (and others) ...
22 votes
2 answers
925 views

How can I add code to the head element when posting a code snippet?

I wanted to post a code snippet with a meta tag in the document head, so I created a code snippet with a complete HTML document. Later I saw that Stack Overflow automatically creates an HTML document ...
1 vote
2 answers
204 views

"Edit the above snippet" is very small on Ask Question page in Edge

The visual appearance of Edit the above snippet is very small in Edge. In Chrome It is perfect. But In Edge More Details Edge "Mozilla/5.0 (Windows NT 10.0; Win64; x64; ServiceUI 8) AppleWebKit/...
-3 votes
1 answer
98 views

SO Snippet should warn about wrong HTML usage

Considering this question about a not-working CSS :first-child selector. The OP posted a question with a full HTML structure in the question, and later it was edited into an SO Snippet showing that ...
3 votes
0 answers
54 views

Add toggle line wrap in snippet editor

I pasted a really long line of code into the snippet editor—so long that the editor decided to ignore the rest of it. Here you can see that it has overflowed to the next line (for some reason, there's ...
1 vote
0 answers
82 views

When you click on "Tidy", "/>" from "<img/>" goes to the next line if there are too many characters

It's just a little thing, but I noticed that if an img element is closed like <img /> and you click on the Tidy button, the /> is put on the next line when there are too much characters ...
11 votes
1 answer
223 views

Promote Stack Overflow HTML, JS, CSS Stack Snippets

Stack Overflow now supports Snippets for a while now. Yet ever so often, I stumble across new questions that use JSFiddle, people answering with JSFiddle links. I guess it hard to unlearn some habits. ...
2 votes
1 answer
175 views

HTML/JS/CSS auto-surround?

This post is related to two older posts. One is an old feature request, Promote Stack Overflow HTML, JS, CSS Stack Snippets, which did not receive much attention but I think is good. The second is a ...
2 votes
0 answers
92 views

Add more languages to Stack Snippets [duplicate]

Stack snippets are a great feature. They greatly increase the reproducibility of answers in JavaScript, HTML, and CSS, as well as supported frameworks like React. Already, many answers link to ...
5 votes
0 answers
129 views

Show a warning when on Stack Snippets throwing errors

Tl;Dr: Make use of the Ask question warnings to reduce the misuse of Stack Snippets. Automatically run it in the background when the user click the "Review your questions button", if there ...
69 votes
0 answers
1k views

Update the version of Babel Standalone (and others) used by Stack Snippets

Please update the version of Babel Standalone used by Stack Snippets (and update the available versions of other scripts in the drop-down lists; ideally, update that list automatically). It's ...
11 votes
4 answers
2k views

Is it possible to have Python code snippets in Stack Overflow?

Is it currently possible to have Python snippets on Stack Overflow? Python is getting increasingly popular and is also currently the most tagged language in Stack Overflow. It has got 1177 questions ...
6 votes
1 answer
196 views

In Stack Snippets, "console.log(map)" prints "{}" instead of the contents of the Map

When answering this question, I tried to put my JS-only code into a snippet. Here's the snippet: const lines = ['The foo is black', 'The bar barks']; let wordCount = new Map(); for (let i = 0; i &...
1 vote
0 answers
58 views

Strange behavior in Stack Overflow: unwanted scrolling of the page on Run code snippet button click [duplicate]

When I edit a new question or answer, if I insert a code snippet and then I click on Run code snippet blue button, to check if it works as expected, I noticed that such an action triggers a wrong ...
0 votes
0 answers
69 views

Why am I seeing two snippet buttons? [duplicate]

I just noticed there are two snippet buttons!? Clicking either of them works as expected. Pressing the shortcut Ctrl + M opens both modal dialogs at the same time.
12 votes
1 answer
201 views

I see two snippet buttons in the editor

I'm using Firefox 104.0.1 (64-bit). I see this in Private tabs, too. I also see it in Chrome. It only shows up on the "Ask Question" page (both in the question editor, and also in the answer ...
27 votes
2 answers
502 views

Should I suggest edits to transform code blocks into Stack Snippets for HTML/CSS/JS questions?

I occasionally come across questions which contain HTML/CSS/JS which are formatted using the standard code blocks (backticks or indentation) that would be better as a runnable snippet. Is it good ...

1
2 3 4 5
10